@legit-sdk/assistant-ui 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +102 -102
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,139 +1,139 @@
1
1
  // @legit-sdk/assistant-ui bundle (ESM)
2
2
  // Generated by esbuild
3
3
 
4
- var tN=Object.create;var En=Object.defineProperty;var rN=Object.getOwnPropertyDescriptor;var iN=Object.getOwnPropertyNames;var nN=Object.getPrototypeOf,sN=Object.prototype.hasOwnProperty;var $0=t=>{throw TypeError(t)};var oN=(t,e,r)=>e in t?En(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e)=>En(t,"name",{value:e,configurable:!0}),ie=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var aN=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),cN=(t,e)=>{for(var r in e)En(t,r,{get:e[r],enumerable:!0})},B0=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of iN(e))!sN.call(t,n)&&n!==r&&En(t,n,{get:()=>e[n],enumerable:!(i=rN(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?tN(nN(t)):{},B0(e||!t||!t.__esModule?En(r,"default",{value:t,enumerable:!0}):r,t)),Od=t=>B0(En({},"__esModule",{value:!0}),t);var U=(t,e,r)=>oN(t,typeof e!="symbol"?e+"":e,r),M0=(t,e,r)=>e.has(t)||$0("Cannot "+r);var Jo=(t,e,r)=>(M0(t,e,"read from private field"),r?r.call(t):e.get(t)),Ko=(t,e,r)=>e.has(t)?$0("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xo=(t,e,r,i)=>(M0(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var Vt=T(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.constants=is.SEP=void 0;is.SEP="/";is.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Md=T(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.Stats=void 0;var wN=Vt(),{S_IFMT:yN,S_IFDIR:gN,S_IFREG:bN,S_IFBLK:_N,S_IFCHR:SN,S_IFLNK:vN,S_IFIFO:EN,S_IFSOCK:FN}=wN.constants,Gc=class Gc{static build(e,r=!1){let i=new Gc,{uid:n,gid:s,atime:o,mtime:f,ctime:c}=e,a=r?h=>BigInt(h):h=>h;i.uid=a(n),i.gid=a(s),i.rdev=a(e.rdev),i.blksize=a(4096),i.ino=a(e.ino),i.size=a(e.getSize()),i.blocks=a(1),i.atime=o,i.mtime=f,i.ctime=c,i.birthtime=c,i.atimeMs=a(o.getTime()),i.mtimeMs=a(f.getTime());let u=a(c.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(o.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=a(0),i.mode=a(e.mode),i.nlink=a(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&yN)===e}isDirectory(){return this._checkModeProperty(gN)}isFile(){return this._checkModeProperty(bN)}isBlockDevice(){return this._checkModeProperty(_N)}isCharacterDevice(){return this._checkModeProperty(SN)}isSymbolicLink(){return this._checkModeProperty(vN)}isFIFO(){return this._checkModeProperty(EN)}isSocket(){return this._checkModeProperty(FN)}};l(Gc,"Stats");var Vc=Gc;ia.Stats=Vc;ia.default=Vc});var mb=T(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.Buffer=void 0;var TN=ie("node:buffer");Object.defineProperty(Jc,"Buffer",{enumerable:!0,get:l(function(){return TN.Buffer},"get")})});var Kr=T(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.bufferFrom=Jr.bufferAllocUnsafe=Jr.Buffer=void 0;var Kc=mb();Object.defineProperty(Jr,"Buffer",{enumerable:!0,get:l(function(){return Kc.Buffer},"get")});function wb(t,...e){return new Kc.Buffer(t,...e)}l(wb,"bufferV0P12Ponyfill");var kN=Kc.Buffer.allocUnsafe||wb;Jr.bufferAllocUnsafe=kN;var RN=Kc.Buffer.from||wb;Jr.bufferFrom=RN});var jd=T(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.inherits=ON;ns.promisify=xN;ns.inspect=Ld;ns.format=AN;function ON(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(ON,"inherits");function xN(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(xN,"promisify");function Ld(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>Ld(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Ld(i)}`).join(", ")} }`:String(t)}l(Ld,"inspect");function AN(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(AN,"format")});var na=T(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.AssertionError=Je.RangeError=Je.TypeError=Je.Error=void 0;Je.message=bb;Je.E=Xr;var qd=jd(),yb=typeof Symbol>"u"?"_kCode":Symbol("code"),gb={};function Wd(t){var e;return e=class extends t{constructor(i,...n){super(bb(i,n)),this.code=i,this[yb]=i,this.name=`${super.name} [${this[yb]}]`}},l(e,"NodeError"),e}l(Wd,"makeNodeError");var Xc=globalThis,zd=class zd extends Xc.Error{constructor(e){if(typeof e!="object"||e===null)throw new Je.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,qd.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,qd.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,Je.Error.captureStackTrace(this,e.stackStartFunction)}};l(zd,"AssertionError");var Ud=zd;Je.AssertionError=Ud;function bb(t,e){if(typeof t!="string")throw new Je.Error("Error message key must be a string");let r=gb[t];if(!r)throw new Je.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=qd.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(bb,"message");function Xr(t,e){gb[t]=typeof e=="function"?e:String(e)}l(Xr,"E");Je.Error=Wd(Xc.Error);Je.TypeError=Wd(Xc.TypeError);Je.RangeError=Wd(Xc.RangeError);Xr("ERR_DIR_CLOSED","Directory handle was closed");Xr("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Xr("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Xr("ERR_INVALID_FILE_URL_PATH","File URL path %s");Xr("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Xr("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Xr("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var sa=T(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ENCODING_UTF8=void 0;Ci.assertEncoding=NN;Ci.strToEncoding=DN;var Hd=Kr(),PN=na();Ci.ENCODING_UTF8="utf8";function NN(t){if(t&&!Hd.Buffer.isEncoding(t))throw new PN.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(NN,"assertEncoding");function DN(t,e){return!e||e===Ci.ENCODING_UTF8?t:e==="buffer"?new Hd.Buffer(t):new Hd.Buffer(t).toString(e)}l(DN,"strToEncoding")});var Qc=T(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.Dirent=void 0;var CN=Vt(),IN=sa(),{S_IFMT:$N,S_IFDIR:BN,S_IFREG:MN,S_IFBLK:LN,S_IFCHR:jN,S_IFLNK:qN,S_IFIFO:UN,S_IFSOCK:WN}=CN.constants,Zc=class Zc{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Zc,{mode:n}=e.getNode();return i.name=(0,IN.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&$N)===e}isDirectory(){return this._checkModeProperty(BN)}isFile(){return this._checkModeProperty(MN)}isBlockDevice(){return this._checkModeProperty(LN)}isCharacterDevice(){return this._checkModeProperty(jN)}isSymbolicLink(){return this._checkModeProperty(qN)}isFIFO(){return this._checkModeProperty(UN)}isSocket(){return this._checkModeProperty(WN)}};l(Zc,"Dirent");var Yc=Zc;oa.Dirent=Yc;oa.default=Yc});var ss=T(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.basename=ke.isAbsolute=ke.normalize=ke.dirname=ke.relative=ke.join=ke.posix=ke.sep=ke.resolve=void 0;var Rr=ie("node:path");Object.defineProperty(ke,"resolve",{enumerable:!0,get:l(function(){return Rr.resolve},"get")});Object.defineProperty(ke,"sep",{enumerable:!0,get:l(function(){return Rr.sep},"get")});Object.defineProperty(ke,"posix",{enumerable:!0,get:l(function(){return Rr.posix},"get")});Object.defineProperty(ke,"join",{enumerable:!0,get:l(function(){return Rr.join},"get")});Object.defineProperty(ke,"relative",{enumerable:!0,get:l(function(){return Rr.relative},"get")});Object.defineProperty(ke,"dirname",{enumerable:!0,get:l(function(){return Rr.dirname},"get")});Object.defineProperty(ke,"normalize",{enumerable:!0,get:l(function(){return Rr.normalize},"get")});Object.defineProperty(ke,"isAbsolute",{enumerable:!0,get:l(function(){return Rr.isAbsolute},"get")});Object.defineProperty(ke,"basename",{enumerable:!0,get:l(function(){return Rr.basename},"get")})});var il={};cN(il,{__addDisposableResource:()=>zb,__assign:()=>el,__asyncDelegator:()=>$b,__asyncGenerator:()=>Ib,__asyncValues:()=>Bb,__await:()=>os,__awaiter:()=>xb,__classPrivateFieldGet:()=>qb,__classPrivateFieldIn:()=>Wb,__classPrivateFieldSet:()=>Ub,__createBinding:()=>rl,__decorate:()=>vb,__disposeResources:()=>Hb,__esDecorate:()=>Fb,__exportStar:()=>Pb,__extends:()=>_b,__generator:()=>Ab,__importDefault:()=>jb,__importStar:()=>Lb,__makeTemplateObject:()=>Mb,__metadata:()=>Ob,__param:()=>Eb,__propKey:()=>kb,__read:()=>Jd,__rest:()=>Sb,__rewriteRelativeImportExtension:()=>Vb,__runInitializers:()=>Tb,__setFunctionName:()=>Rb,__spread:()=>Nb,__spreadArray:()=>Cb,__spreadArrays:()=>Db,__values:()=>tl,default:()=>VN});function _b(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vd(t,e);function r(){this.constructor=t}l(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Sb(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function vb(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var f=t.length-1;f>=0;f--)(o=t[f])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function Eb(t,e){return function(r,i){e(r,i,t)}}function Fb(t,e,r,i,n,s){function o(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}l(o,"accept");for(var f=i.kind,c=f==="getter"?"get":f==="setter"?"set":"value",a=!e&&t?i.static?t:t.prototype:null,u=e||(a?Object.getOwnPropertyDescriptor(a,i.name):{}),h,d=!1,p=r.length-1;p>=0;p--){var m={};for(var w in i)m[w]=w==="access"?{}:i[w];for(var w in i.access)m.access[w]=i.access[w];m.addInitializer=function(b){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(b||null))};var y=(0,r[p])(f==="accessor"?{get:u.get,set:u.set}:u[c],m);if(f==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(h=o(y.get))&&(u.get=h),(h=o(y.set))&&(u.set=h),(h=o(y.init))&&n.unshift(h)}else(h=o(y))&&(f==="field"?n.unshift(h):u[c]=h)}a&&Object.defineProperty(a,i.name,u),d=!0}function Tb(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0}function kb(t){return typeof t=="symbol"?t:"".concat(t)}function Rb(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Ob(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xb(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return l(n,"adopt"),new(r||(r=Promise))(function(s,o){function f(u){try{a(i.next(u))}catch(h){o(h)}}l(f,"fulfilled");function c(u){try{a(i.throw(u))}catch(h){o(h)}}l(c,"rejected");function a(u){u.done?s(u.value):n(u.value).then(f,c)}l(a,"step"),a((i=i.apply(t,e||[])).next())})}function Ab(t,e){var r={label:0,sent:l(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},i,n,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=f(0),o.throw=f(1),o.return=f(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(a){return function(u){return c([a,u])}}function c(a){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(r=0)),r;)try{if(i=1,n&&(s=a[0]&2?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,n=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){r.label=a[1];break}if(a[0]===6&&r.label<s[1]){r.label=s[1],s=a;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(a);break}s[2]&&r.ops.pop(),r.trys.pop();continue}a=e.call(t,r)}catch(u){a=[6,u],n=0}finally{i=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Pb(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rl(e,t,r)}function tl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:l(function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jd(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){o={error:f}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function Nb(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Jd(arguments[e]));return t}function Db(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,f=s.length;o<f;o++,n++)i[n]=s[o];return i}function Cb(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function os(t){return this instanceof os?(this.v=t,this):new os(t)}function Ib(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",o),n[Symbol.asyncIterator]=function(){return this},n;function o(p){return function(m){return Promise.resolve(m).then(p,h)}}function f(p,m){i[p]&&(n[p]=function(w){return new Promise(function(y,b){s.push([p,w,y,b])>1||c(p,w)})},m&&(n[p]=m(n[p])))}function c(p,m){try{a(i[p](m))}catch(w){d(s[0][3],w)}}function a(p){p.value instanceof os?Promise.resolve(p.value.v).then(u,h):d(s[0][2],p)}function u(p){c("next",p)}function h(p){c("throw",p)}function d(p,m){p(m),s.shift(),s.length&&c(s[0][0],s[0][1])}}function $b(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:os(t[n](o)),done:!1}:s?s(o):o}:s}}function Bb(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof tl=="function"?tl(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(f,c){o=t[s](o),n(f,c,o.done,o.value)})}}function n(s,o,f,c){Promise.resolve(c).then(function(a){s({value:a,done:f})},o)}}function Mb(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Lb(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Gd(t),i=0;i<r.length;i++)r[i]!=="default"&&rl(e,t,r[i]);return zN(e,t),e}function jb(t){return t&&t.__esModule?t:{default:t}}function qb(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)}function Ub(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function Wb(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function zb(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose],r&&(n=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");n&&(i=l(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}function Hb(t){function e(s){t.error=t.hasError?new HN(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}l(e,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(s).then(n,function(o){return e(o),n()})}else i|=1}catch(o){e(o)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return l(n,"next"),n()}function Vb(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,i,n,s,o){return i?e?".jsx":".js":n&&(!s||!o)?r:n+s+"."+o.toLowerCase()+"js"}):t}var Vd,el,rl,zN,Gd,HN,VN,nl=aN(()=>{Vd=l(function(t,e){return Vd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},Vd(t,e)},"extendStatics");l(_b,"__extends");el=l(function(){return el=Object.assign||l(function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},"__assign"),el.apply(this,arguments)},"__assign");l(Sb,"__rest");l(vb,"__decorate");l(Eb,"__param");l(Fb,"__esDecorate");l(Tb,"__runInitializers");l(kb,"__propKey");l(Rb,"__setFunctionName");l(Ob,"__metadata");l(xb,"__awaiter");l(Ab,"__generator");rl=Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:l(function(){return e[r]},"get")}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]};l(Pb,"__exportStar");l(tl,"__values");l(Jd,"__read");l(Nb,"__spread");l(Db,"__spreadArrays");l(Cb,"__spreadArray");l(os,"__await");l(Ib,"__asyncGenerator");l($b,"__asyncDelegator");l(Bb,"__asyncValues");l(Mb,"__makeTemplateObject");zN=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},Gd=l(function(t){return Gd=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},Gd(t)},"ownKeys");l(Lb,"__importStar");l(jb,"__importDefault");l(qb,"__classPrivateFieldGet");l(Ub,"__classPrivateFieldSet");l(Wb,"__classPrivateFieldIn");l(zb,"__addDisposableResource");HN=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};l(Hb,"__disposeResources");l(Vb,"__rewriteRelativeImportExtension");VN={__extends:_b,__assign:el,__rest:Sb,__decorate:vb,__param:Eb,__esDecorate:Fb,__runInitializers:Tb,__propKey:kb,__setFunctionName:Rb,__metadata:Ob,__awaiter:xb,__generator:Ab,__createBinding:rl,__exportStar:Pb,__values:tl,__read:Jd,__spread:Nb,__spreadArrays:Db,__spreadArray:Cb,__await:os,__asyncGenerator:Ib,__asyncDelegator:$b,__asyncValues:Bb,__makeTemplateObject:Mb,__importStar:Lb,__importDefault:jb,__classPrivateFieldGet:qb,__classPrivateFieldSet:Ub,__classPrivateFieldIn:Wb,__addDisposableResource:zb,__disposeResources:Hb,__rewriteRelativeImportExtension:Vb}});var Jb=T(Gb=>{"use strict";Object.defineProperty(Gb,"__esModule",{value:!0})});var Xd=T(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.flattenJSON=void 0;var Kb=Kr(),Kd=ss(),GN=Kd.posix?Kd.posix.join:Kd.join,JN=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=GN(i,s);typeof o=="string"||o instanceof Kb.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof Kb.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");sl.flattenJSON=JN});var aa=T(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.FanOut=void 0;var Zd=class Zd{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(r=>r(e))}listen(e){let r=this.listeners;return r.add(e),()=>r.delete(e)}};l(Zd,"FanOut");var Yd=Zd;ol.FanOut=Yd});var cl=T(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.createProcess=Xb;var KN=l(()=>{if(typeof process<"u")return process;try{return ie("process")}catch{return}},"maybeReturnProcess");function Xb(){let t=KN()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(Xb,"createProcess");al.default=Xb()});var tp=T(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.Node=void 0;var XN=aa(),Zb=cl(),xt=Kr(),YN=Vt(),{S_IFMT:Or,S_IFDIR:ZN,S_IFREG:QN,S_IFLNK:Yb,S_IFCHR:eD}=YN.constants,ll=l(()=>Zb.default.getuid?.()??0,"getuid"),fl=l(()=>Zb.default.getgid?.()??0,"getgid"),ep=class ep{constructor(e,r=438){this.changes=new XN.FanOut,this._uid=ll(),this._gid=fl(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Or}set perm(e){this.mode=this.mode&Or|e&~Or,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this.buf=(0,xt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),(0,xt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,xt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Or)===QN}isDirectory(){return(this.mode&Or)===ZN}isSymlink(){return(this.mode&Or)===Yb}isCharacterDevice(){return(this.mode&Or)===eD}makeSymlink(e){this.mode=Yb|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,xt.bufferAllocUnsafe)(n+i);this.buf.copy(s,0,0,this.buf.length),this.buf=s}return e.copy(this.buf,n,r,r+i),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),n>=this.buf.length)return 0;let s=i;s>e.byteLength&&(s=e.byteLength),s+n>this.buf.length&&(s=this.buf.length-n);let o=e instanceof xt.Buffer?e:xt.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(o,r,n,n+s),s}truncate(e=0){if(!e)this.buf=(0,xt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,xt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,xt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}this.touch()}chmod(e){this.mode=this.mode&Or|e&~Or,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=ll(),r=fl()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=ll(),r=fl()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=ll(),r=fl()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(ep,"Node");var Qd=ep;ul.Node=Qd});var ip=T(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.Link=void 0;var tD=Vt(),rD=aa(),{S_IFREG:iD}=tD.constants,ca=class ca{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new rD.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(iD|438)){let i=new ca(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new ca(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(ca,"Link");var rp=ca;hl.Link=rp});var op=T(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.File=void 0;var nD=Vt(),{O_APPEND:sD}=nD.constants,sp=class sp{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&sD&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(sp,"File");var np=sp;dl.File=np});var ls=T(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.FLAGS=cs.ERRSTR=void 0;var oD=Vt();cs.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:Qb,O_WRONLY:pl,O_RDWR:as,O_CREAT:Yr,O_EXCL:ml,O_TRUNC:wl,O_APPEND:yl,O_SYNC:e_}=oD.constants,t_;(function(t){t[t.r=Qb]="r",t[t["r+"]=as]="r+",t[t.rs=Qb|e_]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=as|e_]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=pl|Yr|wl]="w",t[t.wx=pl|Yr|wl|ml]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=as|Yr|wl]="w+",t[t["wx+"]=as|Yr|wl|ml]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=pl|yl|Yr]="a",t[t.ax=pl|yl|Yr|ml]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=as|yl|Yr]="a+",t[t["ax+"]=as|yl|Yr|ml]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(t_||(cs.FLAGS=t_={}))});var cp=T(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Sl=T(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.filenameToSteps=Be.resolve=Be.unixify=Be.isWin=void 0;Be.isFd=i_;Be.validateFd=wD;Be.dataToBuffer=yD;var bl=ss(),gl=Kr(),r_=cl(),aD=sa(),cD=ls();Be.isWin=r_.default.platform==="win32";var lD=bl.resolve,fD=bl.posix?bl.posix.sep:bl.sep,uD=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||Be.isWin&&r==="\\")},"isSeparator"),hD=l(t=>{let e=t.length-1;if(e<2)return t;for(;uD(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),dD=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=hD(t)),t},"normalizePath"),pD=l((t,e=!0)=>Be.isWin?(t=dD(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Be.unixify=pD;var _l=l((t,e=r_.default.cwd())=>lD(e,t),"resolve");Be.resolve=_l;if(Be.isWin){let t=_l;Be.resolve=_l=l((e,r)=>(0,Be.unixify)(t(e,r)),"resolve")}var mD=l((t,e)=>{let i=_l(t,e).substring(1);return i?i.split(fD):[]},"filenameToSteps");Be.filenameToSteps=mD;function i_(t){return t>>>0===t}l(i_,"isFd");function wD(t){if(!i_(t))throw TypeError(cD.ERRSTR.FD)}l(wD,"validateFd");function yD(t,e=aD.ENCODING_UTF8){return gl.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,gl.bufferFrom)(t):e==="buffer"?(0,gl.bufferFrom)(String(t),"utf8"):(0,gl.bufferFrom)(String(t),e)}l(yD,"dataToBuffer")});var Zr=T(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getWriteSyncArgs=Ne.getWriteArgs=Ne.bufToUint8=void 0;Ne.promisify=bD;Ne.validateCallback=n_;Ne.modeToNumber=s_;Ne.nullCheck=o_;Ne.pathToFilename=vD;Ne.createError=MD;Ne.genRndStr6=LD;Ne.flagsToNumber=jD;Ne.streamToBuffer=qD;Ne.bufferToEncoding=HD;Ne.isReadableStream=VD;var la=ls(),lp=na(),fp=Kr(),gD=cp(),vl=Sl();function bD(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(o,f)=>o?s(o):n(r(f)))})}l(bD,"promisify");function n_(t){if(typeof t!="function")throw TypeError(la.ERRSTR.CB);return t}l(n_,"validateCallback");function _D(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return s_(e)}l(_D,"_modeToNumber");function s_(t,e){let r=_D(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(la.ERRSTR.MODE_INT);return r}l(s_,"modeToNumber");function o_(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,gD.default)(()=>{e(r)}),!1}return!0}l(o_,"nullCheck");function SD(t){if(t.hostname!=="")throw new lp.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new lp.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(SD,"getPathFromURLPosix");function vD(t){if(t instanceof Uint8Array&&(t=(0,fp.bufferFrom)(t)),typeof t!="string"&&!fp.Buffer.isBuffer(t)){try{if(!(t instanceof ie("url").URL))throw new TypeError(la.ERRSTR.PATH_STR)}catch{throw new TypeError(la.ERRSTR.PATH_STR)}t=SD(t)}let e=String(t);return o_(e),e}l(vD,"pathToFilename");var ED="ENOENT",FD="EBADF",TD="EINVAL",kD="EPERM",RD="EPROTO",OD="EEXIST",xD="ENOTDIR",AD="EMFILE",PD="EACCES",ND="EISDIR",DD="ENOTEMPTY",CD="ENOSYS",ID="ERR_FS_EISDIR",$D="ERR_OUT_OF_RANGE";function BD(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case ED:return`ENOENT: no such file or directory, ${e}${n}`;case FD:return`EBADF: bad file descriptor, ${e}${n}`;case TD:return`EINVAL: invalid argument, ${e}${n}`;case kD:return`EPERM: operation not permitted, ${e}${n}`;case RD:return`EPROTO: protocol error, ${e}${n}`;case OD:return`EEXIST: file already exists, ${e}${n}`;case xD:return`ENOTDIR: not a directory, ${e}${n}`;case ND:return`EISDIR: illegal operation on a directory, ${e}${n}`;case PD:return`EACCES: permission denied, ${e}${n}`;case DD:return`ENOTEMPTY: directory not empty, ${e}${n}`;case AD:return`EMFILE: too many open files, ${e}${n}`;case CD:return`ENOSYS: function not implemented, ${e}${n}`;case ID:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case $D:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(BD,"formatError");function MD(t,e="",r="",i="",n=Error){let s=new n(BD(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(MD,"createError");function LD(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(LD,"genRndStr6");function jD(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=la.FLAGS[t];if(typeof e<"u")return e}throw new lp.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(jD,"flagsToNumber");function qD(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(fp.Buffer.concat(e))),t.on("error",i)})}l(qD,"streamToBuffer");var UD=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Ne.bufToUint8=UD;var WD=l((t,e,r,i,n,s)=>{(0,vl.validateFd)(t);let o=0,f,c=null,a,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(o=r|0,u=i):m==="function"?(o=r|0,f=i,u=n):(o=r|0,f=i,c=n,u=s):d==="function"?u=r:p==="function"?(c=r,u=i):m==="function"&&(c=r,a=i,u=n);let w=(0,vl.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=n_(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");Ne.getWriteArgs=WD;var zD=l((t,e,r,i,n)=>{(0,vl.validateFd)(t);let s,o,f,c,a=typeof e!="string";a?(o=(r||0)|0,f=i,c=n):(c=r,s=i);let u=(0,vl.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");Ne.getWriteSyncArgs=zD;function HD(t,e){return!e||e==="buffer"?t:t.toString(e)}l(HD,"bufferToEncoding");function VD(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(VD,"isReadableStream")});var h_=T(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.Superblock=void 0;var Me=ss(),GD=tp(),a_=ip(),JD=op(),KD=Kr(),c_=cl(),ar=Vt(),l_=ls(),V=Zr(),Gt=Sl(),XD=Xd(),fs=Me.posix?Me.posix.sep:Me.sep,f_=Me.posix?Me.posix.relative:Me.relative,YD=Me.posix?Me.posix.join:Me.join,{O_RDONLY:up,O_WRONLY:El,O_RDWR:hp,O_CREAT:u_,O_EXCL:ZD,O_TRUNC:QD,O_APPEND:eC,O_DIRECTORY:tC}=ar.constants,us=class us{static fromJSON(e,r){let i=new us;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new us;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,o=!0)=>{let f=this.openFile(i,n,s,o);if(!f)throw(0,V.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,o)=>{let f=typeof i=="number",c;f?c=i:c=this.open((0,V.pathToFilename)(i),s,o);let a=0,u=n.length,h=s&eC?void 0:0;try{for(;u>0;){let d=this.write(c,n,a,u,h);a+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(c)}},this.read=(i,n,s,o,f)=>{if(n.byteLength<o)throw(0,V.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,V.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(o),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let o=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let c=0;for(let a of n){let u=o.read(a,0,a.byteLength,f);if(f=void 0,c+=u,u<a.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let o=(0,Me.dirname)(n),f;try{f=this.getLinkOrThrow(o,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let c=(0,Me.basename)(n);if(f.getChild(c))throw(0,V.createError)("EEXIST","link",i,n);let a=s.getNode();a.nlink++,f.createChild(c,a)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,Gt.filenameToSteps)(n),o;try{o=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(o.getChild(f))throw(0,V.createError)("EEXIST","symlink",i,n);let c=o.getNode();if(!c.canExecute()||!c.canWrite())throw(0,V.createError)("EACCES","symlink",i,n);let a=o.createChild(f);return a.getNode().makeSymlink(i),a},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let o;try{o=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,V.createError)("EINVAL","rename",i,n);let c=f.getNode(),a=o.getNode();if(!c.canExecute()||!c.canWrite()||!a.canExecute()||!a.canWrite())throw(0,V.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Me.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Gt.filenameToSteps)(i);if(!s.length)throw(0,V.createError)("EEXIST","mkdir",i);let o=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(o.getChild(f))throw(0,V.createError)("EEXIST","mkdir",i);let c=o.getNode();if(!c.canWrite()||!c.canExecute())throw(0,V.createError)("EACCES","mkdir",i);o.createChild(f,this.createNode(ar.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,Gt.filenameToSteps)(i),f=null,c=o.length;for(c=o.length;c>=0&&(f=this.getResolvedLink(o.slice(0,c)),!f);c--);for(f||(f=this.root,c=0),f=this.getResolvedLinkOrThrow(Me.sep+o.slice(0,c).join(Me.sep),"mkdir"),c;c<o.length;c++){let a=f.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,V.createError)("EACCES","mkdir",i)}else throw(0,V.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(o[c],this.createNode(ar.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,V.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let o;try{o=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(o.getNode().isDirectory()&&!s)throw(0,V.createError)("ERR_FS_EISDIR","rm",i);if(!o.parent?.getNode().canWrite())throw(0,V.createError)("EACCES","rm",i);this.deleteLink(o)},this.close=i=>{(0,Gt.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(ar.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new a_.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&ar.constants.S_IFMT?n&ar.constants.S_IFMT:i?ar.constants.S_IFDIR:ar.constants.S_IFREG,c=s&~ar.constants.S_IFMT|f;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:us.fd--}createNode(e){let r=new GD.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let o,f;e instanceof a_.Link?(o=e.steps,f=fs+o.join(fs)):typeof e=="string"?(o=(0,Gt.filenameToSteps)(e),f=e):(o=e,f=fs+o.join(fs));let c=this.root,a=0;for(;a<o.length;){let u=c.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,V.createError)("EACCES",s,f)}else if(a<o.length-1)throw(0,V.createError)("ENOTDIR",s,f);if(c=c.getChild(o[a])??null,!c){if(i)throw(0,V.createError)("ENOENT",s,f);return null}if(u=c?.getNode(),u.isSymlink()&&(r||a<o.length-1)){let h=(0,Me.isAbsolute)(u.symlink)?u.symlink:YD((0,Me.dirname)(c.getPath()),u.symlink);o=(0,Gt.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=c_.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,V.createError)(h,s,f)}a++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,Gt.filenameToSteps)(e)).slice(0,-1),n=fs+i.join(fs),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Gt.isFd)(e))throw TypeError(l_.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,V.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,o=e.children;e.getNode().isFile()&&(o=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of o.keys()){if(c==="."||c==="..")continue;s=!1;let a=e.getChild(c);if(!a)throw new Error("_toJSON: unexpected undefined");let u=a.getNode();if(u.isFile()){let h=a.getPath();i&&(h=f_(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(a,r,i,n)}let f=e.getPath();return i&&(f=f_(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let o of e){let f=(0,V.pathToFilename)(o),c=this.getResolvedLink(f);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let o of s)this._toJSON(o,r,i?o.getPath():"",n);return r}fromJSON(e,r=c_.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Gt.resolve)(i,r),typeof n=="string"||n instanceof KD.Buffer){let s=(0,Me.dirname)(i);this.mkdirp(s,511);let o=(0,Gt.dataToBuffer)(n);this.writeFile(i,o,l_.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,XD.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(ar.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,V.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(up|hp|El))!==up)throw(0,V.createError)("EISDIR","open",e.getPath())}else if(r&tC)throw(0,V.createError)("ENOTDIR","open",e.getPath());if((r&(up|hp|El))!==El&&!s.canRead()||r&(El|hp)&&!s.canWrite())throw(0,V.createError)("EACCES","open",e.getPath());let o=new JD.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&QD&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,Gt.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&u_&&r&ZD)throw(0,V.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&u_){let c=(0,Me.dirname)(e),a=this.getResolvedLinkOrThrow(c),u=a.getNode();if(!u.isDirectory())throw(0,V.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,V.createError)("EACCES","open",e);i??(i=438),o=this.createLink(a,s[s.length-1],!1,i)}else throw f}if(o)return this.openLink(o,r,n);throw(0,V.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let o=this.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,V.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(us,"Superblock");var Fl=us;Tl.Superblock=Fl;Fl.fd=2147483647});var p_=T(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Superblock=At.File=At.Link=At.Node=void 0;var d_=(nl(),Od(il));d_.__exportStar(Jb(),At);d_.__exportStar(Xd(),At);var rC=tp();Object.defineProperty(At,"Node",{enumerable:!0,get:l(function(){return rC.Node},"get")});var iC=ip();Object.defineProperty(At,"Link",{enumerable:!0,get:l(function(){return iC.Link},"get")});var nC=op();Object.defineProperty(At,"File",{enumerable:!0,get:l(function(){return nC.File},"get")});var sC=h_();Object.defineProperty(At,"Superblock",{enumerable:!0,get:l(function(){return sC.Superblock},"get")})});var m_=T(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.StatFs=void 0;var Rl=class Rl{static build(e,r=!1){let i=new Rl,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,o=1e6,f=Math.min(s*2,o),c=o-f;i.blocks=n(o),i.bfree=n(c),i.bavail=n(c);let a=1e6;return i.files=n(a),i.ffree=n(a-s),i}};l(Rl,"StatFs");var kl=Rl;fa.StatFs=kl;fa.default=kl});var w_=T(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});function oC(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(oC,"setTimeoutUnref");dp.default=oC});var g_=T(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.Writable=hs.Readable=void 0;var y_=ie("node:stream");Object.defineProperty(hs,"Readable",{enumerable:!0,get:l(function(){return y_.Readable},"get")});Object.defineProperty(hs,"Writable",{enumerable:!0,get:l(function(){return y_.Writable},"get")})});var pp=T(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.EventEmitter=void 0;var aC=ie("node:events");Object.defineProperty(Ol,"EventEmitter",{enumerable:!0,get:l(function(){return aC.EventEmitter},"get")})});var b_=T(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.FileHandle=void 0;var Ke=Zr(),cC=pp(),wp=class wp extends cC.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,Ke.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ke.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ke.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,Ke.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,Ke.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async o=>{try{let f=o.byobRequest?.view;if(!f){let a=new Uint8Array(16384),u=await this.read(a,0,a.length,n);if(u.bytesRead===0){o.close(),s();return}n+=u.bytesRead,o.enqueue(a.slice(0,u.bytesRead));return}let c=await this.read(f,f.byteOffset,f.byteLength,n);if(c.bytesRead===0){o.close(),s();return}n+=c.bytesRead,o.byobRequest.respond(c.bytesRead)}catch(f){o.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,o=await(0,Ke.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=o.bytesRead),o}readv(e,r){return(0,Ke.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ke.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ke.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ke.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ke.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ke.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",o=s?this.position:n,f=await(0,Ke.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,o);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,Ke.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ke.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,Ke.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(wp,"FileHandle");var mp=wp;xl.FileHandle=mp});var __=T(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.FsPromises=void 0;var ne=Zr(),lC=Vt(),bp=class bp{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(bp,"FSWatchAsyncIterator");var yp=bp,_p=class _p{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=lC.constants,this.cp=(0,ne.promisify)(this.fs,"cp"),this.opendir=(0,ne.promisify)(this.fs,"opendir"),this.statfs=(0,ne.promisify)(this.fs,"statfs"),this.lutimes=(0,ne.promisify)(this.fs,"lutimes"),this.glob=(0,ne.promisify)(this.fs,"glob"),this.access=(0,ne.promisify)(this.fs,"access"),this.chmod=(0,ne.promisify)(this.fs,"chmod"),this.chown=(0,ne.promisify)(this.fs,"chown"),this.copyFile=(0,ne.promisify)(this.fs,"copyFile"),this.lchmod=(0,ne.promisify)(this.fs,"lchmod"),this.lchown=(0,ne.promisify)(this.fs,"lchown"),this.link=(0,ne.promisify)(this.fs,"link"),this.lstat=(0,ne.promisify)(this.fs,"lstat"),this.mkdir=(0,ne.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,ne.promisify)(this.fs,"mkdtemp"),this.readdir=(0,ne.promisify)(this.fs,"readdir"),this.readlink=(0,ne.promisify)(this.fs,"readlink"),this.realpath=(0,ne.promisify)(this.fs,"realpath"),this.rename=(0,ne.promisify)(this.fs,"rename"),this.rmdir=(0,ne.promisify)(this.fs,"rmdir"),this.rm=(0,ne.promisify)(this.fs,"rm"),this.stat=(0,ne.promisify)(this.fs,"stat"),this.symlink=(0,ne.promisify)(this.fs,"symlink"),this.truncate=(0,ne.promisify)(this.fs,"truncate"),this.unlink=(0,ne.promisify)(this.fs,"unlink"),this.utimes=(0,ne.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,ne.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,ne.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,ne.promisify)(this.fs,"open",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,ne.isReadableStream)(n)?(0,ne.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,ne.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new yp(this.fs,i,s)}}};l(_p,"FsPromises");var gp=_p;Al.FsPromises=gp});var S_=T(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.printTree=void 0;var fC=l((t="",e)=>{let r="",i=e.length-1;for(;i>=0&&!e[i];i--);for(let n=0;n<=i;n++){let s=e[n];if(!s)continue;let o=n===i,f=s(t+(o?" ":"\u2502")+" "),c=f?o?"\u2514\u2500":"\u251C\u2500":"\u2502";r+=`
5
- `+t+c+(f?" "+f:"")}return r},"printTree");Pl.printTree=fC});var v_=T(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.printBinary=void 0;var uC=l((t="",e)=>{let r=e[0],i=e[1],n="";return r&&(n+=`
6
- `+t+"\u2190 "+r(t+" ")),i&&(n+=`
7
- `+t+"\u2192 "+i(t+" ")),n},"printBinary");Nl.printBinary=uC});var E_=T(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.printJson=void 0;var hC=l((t="",e,r=2)=>(JSON.stringify(e,null,r)||"nil").split(`
4
+ var SS=Object.create;var Ws=Object.defineProperty;var ES=Object.getOwnPropertyDescriptor;var FS=Object.getOwnPropertyNames;var kS=Object.getPrototypeOf,RS=Object.prototype.hasOwnProperty;var Dw=i=>{throw TypeError(i)};var TS=(i,e,t)=>e in i?Ws(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var c=(i,e)=>Ws(i,"name",{value:e,configurable:!0}),rr=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var OS=(i,e)=>()=>(i&&(e=i(i=0)),e);var Ze=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),xS=(i,e)=>{for(var t in e)Ws(i,t,{get:e[t],enumerable:!0})},Nw=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of FS(e))!RS.call(i,n)&&n!==t&&Ws(i,n,{get:()=>e[n],enumerable:!(r=ES(e,n))||r.enumerable});return i};var Li=(i,e,t)=>(t=i!=null?SS(kS(i)):{},Nw(e||!i||!i.__esModule?Ws(t,"default",{value:i,enumerable:!0}):t,i)),kd=i=>Nw(Ws({},"__esModule",{value:!0}),i);var pt=(i,e,t)=>TS(i,typeof e!="symbol"?e+"":e,t),Cw=(i,e,t)=>e.has(i)||Dw("Cannot "+t);var vo=(i,e,t)=>(Cw(i,e,"read from private field"),t?t.call(i):e.get(i)),So=(i,e,t)=>e.has(i)?Dw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Eo=(i,e,t,r)=>(Cw(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t);var ii=Ze(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.constants=Sa.SEP=void 0;Sa.SEP="/";Sa.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Id=Ze(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.Stats=void 0;var jS=ii(),{S_IFMT:MS,S_IFDIR:$S,S_IFREG:LS,S_IFBLK:US,S_IFCHR:WS,S_IFLNK:qS,S_IFIFO:zS,S_IFSOCK:HS}=jS.constants,Ml=class Ml{static build(e,t=!1){let r=new Ml,{uid:n,gid:o,atime:f,mtime:m,ctime:l}=e,a=t?y=>BigInt(y):y=>y;r.uid=a(n),r.gid=a(o),r.rdev=a(e.rdev),r.blksize=a(4096),r.ino=a(e.ino),r.size=a(e.getSize()),r.blocks=a(1),r.atime=f,r.mtime=m,r.ctime=l,r.birthtime=l,r.atimeMs=a(f.getTime()),r.mtimeMs=a(m.getTime());let g=a(l.getTime());if(r.ctimeMs=g,r.birthtimeMs=g,t){r.atimeNs=BigInt(f.getTime())*BigInt(1e6),r.mtimeNs=BigInt(m.getTime())*BigInt(1e6);let y=BigInt(l.getTime())*BigInt(1e6);r.ctimeNs=y,r.birthtimeNs=y}return r.dev=a(0),r.mode=a(e.mode),r.nlink=a(e.nlink),r}_checkModeProperty(e){return(Number(this.mode)&MS)===e}isDirectory(){return this._checkModeProperty($S)}isFile(){return this._checkModeProperty(LS)}isBlockDevice(){return this._checkModeProperty(US)}isCharacterDevice(){return this._checkModeProperty(WS)}isSymbolicLink(){return this._checkModeProperty(qS)}isFIFO(){return this._checkModeProperty(zS)}isSocket(){return this._checkModeProperty(HS)}};c(Ml,"Stats");var jl=Ml;Ao.Stats=jl;Ao.default=jl});var hb=Ze($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.Buffer=void 0;var GS=rr("node:buffer");Object.defineProperty($l,"Buffer",{enumerable:!0,get:c(function(){return GS.Buffer},"get")})});var Wi=Ze(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.bufferFrom=Ui.bufferAllocUnsafe=Ui.Buffer=void 0;var Ll=hb();Object.defineProperty(Ui,"Buffer",{enumerable:!0,get:c(function(){return Ll.Buffer},"get")});function ub(i,...e){return new Ll.Buffer(i,...e)}c(ub,"bufferV0P12Ponyfill");var VS=Ll.Buffer.allocUnsafe||ub;Ui.bufferAllocUnsafe=VS;var KS=Ll.Buffer.from||ub;Ui.bufferFrom=KS});var jd=Ze(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.inherits=JS;Ea.promisify=YS;Ea.inspect=Bd;Ea.format=XS;function JS(i,e){if(i==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");i.super_=e,i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}c(JS,"inherits");function YS(i){if(typeof i!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((t,r)=>{i.call(this,...e,(n,o)=>{n?r(n):t(o)})})}}c(YS,"promisify");function Bd(i){return i===null?"null":i===void 0?"undefined":typeof i=="string"?`'${i}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[ ${i.map(t=>Bd(t)).join(", ")} ]`:typeof i=="object"?`{ ${Object.entries(i).map(([t,r])=>`${t}: ${Bd(r)}`).join(", ")} }`:String(i)}c(Bd,"inspect");function XS(i,...e){if(e.length===0)return i;let t=i,r=0;for(t=t.replace(/%[sdj%]/g,n=>{if(r>=e.length)return n;let o=e[r++];switch(n){case"%s":return String(o);case"%d":return Number(o).toString();case"%j":try{return JSON.stringify(o)}catch{return"[Circular]"}case"%%":return"%";default:return n}});r<e.length;)t+=" "+String(e[r++]);return t}c(XS,"format")});var Po=Ze(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.AssertionError=mr.RangeError=mr.TypeError=mr.Error=void 0;mr.message=mb;mr.E=qi;var Md=jd(),db=typeof Symbol>"u"?"_kCode":Symbol("code"),pb={};function Ld(i){var e;return e=class extends i{constructor(r,...n){super(mb(r,n)),this.code=r,this[db]=r,this.name=`${super.name} [${this[db]}]`}},c(e,"NodeError"),e}c(Ld,"makeNodeError");var Ul=globalThis,Ud=class Ud extends Ul.Error{constructor(e){if(typeof e!="object"||e===null)throw new mr.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,Md.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,Md.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,mr.Error.captureStackTrace(this,e.stackStartFunction)}};c(Ud,"AssertionError");var $d=Ud;mr.AssertionError=$d;function mb(i,e){if(typeof i!="string")throw new mr.Error("Error message key must be a string");let t=pb[i];if(!t)throw new mr.Error(`An invalid error message key was used: ${i}.`);let r;if(typeof t=="function")r=t;else{if(r=Md.format,e===void 0||e.length===0)return t;e.unshift(t)}return String(r.apply(null,e))}c(mb,"message");function qi(i,e){pb[i]=typeof e=="function"?e:String(e)}c(qi,"E");mr.Error=Ld(Ul.Error);mr.TypeError=Ld(Ul.TypeError);mr.RangeError=Ld(Ul.RangeError);qi("ERR_DIR_CLOSED","Directory handle was closed");qi("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");qi("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');qi("ERR_INVALID_FILE_URL_PATH","File URL path %s");qi("ERR_INVALID_OPT_VALUE",(i,e)=>`The value "${String(e)}" is invalid for option "${i}"`);qi("ERR_INVALID_OPT_VALUE_ENCODING",i=>`The value "${String(i)}" is invalid for option "encoding"`);qi("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Do=Ze(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ENCODING_UTF8=void 0;Zn.assertEncoding=ZS;Zn.strToEncoding=eE;var Wd=Wi(),QS=Po();Zn.ENCODING_UTF8="utf8";function ZS(i){if(i&&!Wd.Buffer.isEncoding(i))throw new QS.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",i)}c(ZS,"assertEncoding");function eE(i,e){return!e||e===Zn.ENCODING_UTF8?i:e==="buffer"?new Wd.Buffer(i):new Wd.Buffer(i).toString(e)}c(eE,"strToEncoding")});var zl=Ze(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.Dirent=void 0;var tE=ii(),rE=Do(),{S_IFMT:iE,S_IFDIR:nE,S_IFREG:sE,S_IFBLK:aE,S_IFCHR:oE,S_IFLNK:lE,S_IFIFO:cE,S_IFSOCK:fE}=tE.constants,ql=class ql{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,t){let r=new ql,{mode:n}=e.getNode();return r.name=(0,rE.strToEncoding)(e.getName(),t),r.mode=n,r.path=e.getParentPath(),r.parentPath=r.path,r}_checkModeProperty(e){return(this.mode&iE)===e}isDirectory(){return this._checkModeProperty(nE)}isFile(){return this._checkModeProperty(sE)}isBlockDevice(){return this._checkModeProperty(aE)}isCharacterDevice(){return this._checkModeProperty(oE)}isSymbolicLink(){return this._checkModeProperty(lE)}isFIFO(){return this._checkModeProperty(cE)}isSocket(){return this._checkModeProperty(fE)}};c(ql,"Dirent");var Wl=ql;No.Dirent=Wl;No.default=Wl});var Fa=Ze(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.basename=Vt.isAbsolute=Vt.normalize=Vt.dirname=Vt.relative=Vt.join=Vt.posix=Vt.sep=Vt.resolve=void 0;var Fi=rr("node:path");Object.defineProperty(Vt,"resolve",{enumerable:!0,get:c(function(){return Fi.resolve},"get")});Object.defineProperty(Vt,"sep",{enumerable:!0,get:c(function(){return Fi.sep},"get")});Object.defineProperty(Vt,"posix",{enumerable:!0,get:c(function(){return Fi.posix},"get")});Object.defineProperty(Vt,"join",{enumerable:!0,get:c(function(){return Fi.join},"get")});Object.defineProperty(Vt,"relative",{enumerable:!0,get:c(function(){return Fi.relative},"get")});Object.defineProperty(Vt,"dirname",{enumerable:!0,get:c(function(){return Fi.dirname},"get")});Object.defineProperty(Vt,"normalize",{enumerable:!0,get:c(function(){return Fi.normalize},"get")});Object.defineProperty(Vt,"isAbsolute",{enumerable:!0,get:c(function(){return Fi.isAbsolute},"get")});Object.defineProperty(Vt,"basename",{enumerable:!0,get:c(function(){return Fi.basename},"get")})});var Kl={};xS(Kl,{__addDisposableResource:()=>Lb,__assign:()=>Hl,__asyncDelegator:()=>Db,__asyncGenerator:()=>Pb,__asyncValues:()=>Nb,__await:()=>ka,__awaiter:()=>kb,__classPrivateFieldGet:()=>jb,__classPrivateFieldIn:()=>$b,__classPrivateFieldSet:()=>Mb,__createBinding:()=>Vl,__decorate:()=>wb,__disposeResources:()=>Ub,__esDecorate:()=>_b,__exportStar:()=>Tb,__extends:()=>gb,__generator:()=>Rb,__importDefault:()=>Bb,__importStar:()=>Ib,__makeTemplateObject:()=>Cb,__metadata:()=>Fb,__param:()=>bb,__propKey:()=>Sb,__read:()=>Hd,__rest:()=>yb,__rewriteRelativeImportExtension:()=>Wb,__runInitializers:()=>vb,__setFunctionName:()=>Eb,__spread:()=>Ob,__spreadArray:()=>Ab,__spreadArrays:()=>xb,__values:()=>Gl,default:()=>dE});function gb(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qd(i,e);function t(){this.constructor=i}c(t,"__"),i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function yb(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(i);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(i,r[n])&&(t[r[n]]=i[r[n]]);return t}function wb(i,e,t,r){var n=arguments.length,o=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var m=i.length-1;m>=0;m--)(f=i[m])&&(o=(n<3?f(o):n>3?f(e,t,o):f(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}function bb(i,e){return function(t,r){e(t,r,i)}}function _b(i,e,t,r,n,o){function f($){if($!==void 0&&typeof $!="function")throw new TypeError("Function expected");return $}c(f,"accept");for(var m=r.kind,l=m==="getter"?"get":m==="setter"?"set":"value",a=!e&&i?r.static?i:i.prototype:null,g=e||(a?Object.getOwnPropertyDescriptor(a,r.name):{}),y,b=!1,S=t.length-1;S>=0;S--){var F={};for(var T in r)F[T]=T==="access"?{}:r[T];for(var T in r.access)F.access[T]=r.access[T];F.addInitializer=function($){if(b)throw new TypeError("Cannot add initializers after decoration has completed");o.push(f($||null))};var P=(0,t[S])(m==="accessor"?{get:g.get,set:g.set}:g[l],F);if(m==="accessor"){if(P===void 0)continue;if(P===null||typeof P!="object")throw new TypeError("Object expected");(y=f(P.get))&&(g.get=y),(y=f(P.set))&&(g.set=y),(y=f(P.init))&&n.unshift(y)}else(y=f(P))&&(m==="field"?n.unshift(y):g[l]=y)}a&&Object.defineProperty(a,r.name,g),b=!0}function vb(i,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(i,t):e[n].call(i);return r?t:void 0}function Sb(i){return typeof i=="symbol"?i:"".concat(i)}function Eb(i,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function Fb(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function kb(i,e,t,r){function n(o){return o instanceof t?o:new t(function(f){f(o)})}return c(n,"adopt"),new(t||(t=Promise))(function(o,f){function m(g){try{a(r.next(g))}catch(y){f(y)}}c(m,"fulfilled");function l(g){try{a(r.throw(g))}catch(y){f(y)}}c(l,"rejected");function a(g){g.done?o(g.value):n(g.value).then(m,l)}c(a,"step"),a((r=r.apply(i,e||[])).next())})}function Rb(i,e){var t={label:0,sent:c(function(){if(o[0]&1)throw o[1];return o[1]},"sent"),trys:[],ops:[]},r,n,o,f=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return f.next=m(0),f.throw=m(1),f.return=m(2),typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(a){return function(g){return l([a,g])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;f&&(f=0,a[0]&&(t=0)),t;)try{if(r=1,n&&(o=a[0]&2?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,n=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){t.label=a[1];break}if(a[0]===6&&t.label<o[1]){t.label=o[1],o=a;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(a);break}o[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(i,t)}catch(g){a=[6,g],n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Tb(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Vl(e,i,t)}function Gl(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:c(function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hd(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),n,o=[],f;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(m){f={error:m}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(f)throw f.error}}return o}function Ob(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(Hd(arguments[e]));return i}function xb(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),n=0,e=0;e<t;e++)for(var o=arguments[e],f=0,m=o.length;f<m;f++,n++)r[n]=o[f];return r}function Ab(i,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return i.concat(o||Array.prototype.slice.call(e))}function ka(i){return this instanceof ka?(this.v=i,this):new ka(i)}function Pb(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),m("next"),m("throw"),m("return",f),n[Symbol.asyncIterator]=function(){return this},n;function f(S){return function(F){return Promise.resolve(F).then(S,y)}}function m(S,F){r[S]&&(n[S]=function(T){return new Promise(function(P,$){o.push([S,T,P,$])>1||l(S,T)})},F&&(n[S]=F(n[S])))}function l(S,F){try{a(r[S](F))}catch(T){b(o[0][3],T)}}function a(S){S.value instanceof ka?Promise.resolve(S.value.v).then(g,y):b(o[0][2],S)}function g(S){l("next",S)}function y(S){l("throw",S)}function b(S,F){S(F),o.shift(),o.length&&l(o[0][0],o[0][1])}}function Db(i){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,o){e[n]=i[n]?function(f){return(t=!t)?{value:ka(i[n](f)),done:!1}:o?o(f):f}:o}}function Nb(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof Gl=="function"?Gl(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=i[o]&&function(f){return new Promise(function(m,l){f=i[o](f),n(m,l,f.done,f.value)})}}function n(o,f,m,l){Promise.resolve(l).then(function(a){o({value:a,done:m})},f)}}function Cb(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function Ib(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t=zd(i),r=0;r<t.length;r++)t[r]!=="default"&&Vl(e,i,t[r]);return hE(e,i),e}function Bb(i){return i&&i.__esModule?i:{default:i}}function jb(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)}function Mb(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t}function $b(i,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?e===i:i.has(e)}function Lb(i,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(n=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");n&&(r=c(function(){try{n.call(this)}catch(o){return Promise.reject(o)}},"dispose")),i.stack.push({value:e,dispose:r,async:t})}else t&&i.stack.push({async:!0});return e}function Ub(i){function e(o){i.error=i.hasError?new uE(o,i.error,"An error was suppressed during disposal."):o,i.hasError=!0}c(e,"fail");var t,r=0;function n(){for(;t=i.stack.pop();)try{if(!t.async&&r===1)return r=0,i.stack.push(t),Promise.resolve().then(n);if(t.dispose){var o=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(o).then(n,function(f){return e(f),n()})}else r|=1}catch(f){e(f)}if(r===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return c(n,"next"),n()}function Wb(i,e){return typeof i=="string"&&/^\.\.?\//.test(i)?i.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,n,o,f){return r?e?".jsx":".js":n&&(!o||!f)?t:n+o+"."+f.toLowerCase()+"js"}):i}var qd,Hl,Vl,hE,zd,uE,dE,Jl=OS(()=>{qd=c(function(i,e){return qd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},qd(i,e)},"extendStatics");c(gb,"__extends");Hl=c(function(){return Hl=Object.assign||c(function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},"__assign"),Hl.apply(this,arguments)},"__assign");c(yb,"__rest");c(wb,"__decorate");c(bb,"__param");c(_b,"__esDecorate");c(vb,"__runInitializers");c(Sb,"__propKey");c(Eb,"__setFunctionName");c(Fb,"__metadata");c(kb,"__awaiter");c(Rb,"__generator");Vl=Object.create?function(i,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:c(function(){return e[t]},"get")}),Object.defineProperty(i,r,n)}:function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]};c(Tb,"__exportStar");c(Gl,"__values");c(Hd,"__read");c(Ob,"__spread");c(xb,"__spreadArrays");c(Ab,"__spreadArray");c(ka,"__await");c(Pb,"__asyncGenerator");c(Db,"__asyncDelegator");c(Nb,"__asyncValues");c(Cb,"__makeTemplateObject");hE=Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e},zd=c(function(i){return zd=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},zd(i)},"ownKeys");c(Ib,"__importStar");c(Bb,"__importDefault");c(jb,"__classPrivateFieldGet");c(Mb,"__classPrivateFieldSet");c($b,"__classPrivateFieldIn");c(Lb,"__addDisposableResource");uE=typeof SuppressedError=="function"?SuppressedError:function(i,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=i,r.suppressed=e,r};c(Ub,"__disposeResources");c(Wb,"__rewriteRelativeImportExtension");dE={__extends:gb,__assign:Hl,__rest:yb,__decorate:wb,__param:bb,__esDecorate:_b,__runInitializers:vb,__propKey:Sb,__setFunctionName:Eb,__metadata:Fb,__awaiter:kb,__generator:Rb,__createBinding:Vl,__exportStar:Tb,__values:Gl,__read:Hd,__spread:Ob,__spreadArrays:xb,__spreadArray:Ab,__await:ka,__asyncGenerator:Pb,__asyncDelegator:Db,__asyncValues:Nb,__makeTemplateObject:Cb,__importStar:Ib,__importDefault:Bb,__classPrivateFieldGet:jb,__classPrivateFieldSet:Mb,__classPrivateFieldIn:$b,__addDisposableResource:Lb,__disposeResources:Ub,__rewriteRelativeImportExtension:Wb}});var zb=Ze(qb=>{"use strict";Object.defineProperty(qb,"__esModule",{value:!0})});var Vd=Ze(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.flattenJSON=void 0;var Hb=Wi(),Gd=Fa(),pE=Gd.posix?Gd.posix.join:Gd.join,mE=c(i=>{let e={};function t(r,n){for(let o in n){let f=n[o],m=pE(r,o);typeof f=="string"||f instanceof Hb.Buffer?e[m]=f:typeof f=="object"&&f!==null&&!(f instanceof Hb.Buffer)&&Object.keys(f).length>0?t(m,f):e[m]=null}}return c(t,"flatten"),t("",i),e},"flattenJSON");Yl.flattenJSON=mE});var Co=Ze(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.FanOut=void 0;var Jd=class Jd{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(t=>t(e))}listen(e){let t=this.listeners;return t.add(e),()=>t.delete(e)}};c(Jd,"FanOut");var Kd=Jd;Xl.FanOut=Kd});var Zl=Ze(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.createProcess=Gb;var gE=c(()=>{if(typeof process<"u")return process;try{return rr("process")}catch{return}},"maybeReturnProcess");function Gb(){let i=gE()||{};return i.cwd||(i.cwd=()=>"/"),i.emitWarning||(i.emitWarning=(e,t)=>{console.warn(`${t}${t?": ":""}${e}`)}),i.env||(i.env={}),i}c(Gb,"createProcess");Ql.default=Gb()});var Qd=Ze(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.Node=void 0;var yE=Co(),Kb=Zl(),zr=Wi(),wE=ii(),{S_IFMT:ki,S_IFDIR:bE,S_IFREG:_E,S_IFLNK:Vb,S_IFCHR:vE}=wE.constants,ec=c(()=>Kb.default.getuid?.()??0,"getuid"),tc=c(()=>Kb.default.getgid?.()??0,"getgid"),Xd=class Xd{constructor(e,t=438){this.changes=new yE.FanOut,this._uid=ec(),this._gid=tc(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=t,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~ki}set perm(e){this.mode=this.mode&ki|e&~ki,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this.buf=(0,zr.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,zr.bufferAllocUnsafe)(0)),(0,zr.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,zr.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&ki)===_E}isDirectory(){return(this.mode&ki)===bE}isSymlink(){return(this.mode&ki)===Vb}isCharacterDevice(){return(this.mode&ki)===vE}makeSymlink(e){this.mode=Vb|438,this.symlink=e}write(e,t=0,r=e.length,n=0){if(this.buf||(this.buf=(0,zr.bufferAllocUnsafe)(0)),n+r>this.buf.length){let o=(0,zr.bufferAllocUnsafe)(n+r);this.buf.copy(o,0,0,this.buf.length),this.buf=o}return e.copy(this.buf,n,t,t+r),this.touch(),r}read(e,t=0,r=e.byteLength,n=0){if(this.atime=new Date,this.buf||(this.buf=(0,zr.bufferAllocUnsafe)(0)),n>=this.buf.length)return 0;let o=r;o>e.byteLength&&(o=e.byteLength),o+n>this.buf.length&&(o=this.buf.length-n);let f=e instanceof zr.Buffer?e:zr.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(f,t,n,n+o),o}truncate(e=0){if(!e)this.buf=(0,zr.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,zr.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let t=(0,zr.bufferAllocUnsafe)(e);this.buf.copy(t),t.fill(0,this.buf.length),this.buf=t}this.touch()}chmod(e){this.mode=this.mode&ki|e&~ki,this.touch()}chown(e,t){this.uid=e,this.gid=t,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=ec(),t=tc()){return!!(this.perm&4||t===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=ec(),t=tc()){return!!(this.perm&2||t===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=ec(),t=tc()){return!!(this.perm&1||t===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};c(Xd,"Node");var Yd=Xd;rc.Node=Yd});var ep=Ze(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.Link=void 0;var SE=ii(),EE=Co(),{S_IFREG:FE}=SE.constants,Io=class Io{get steps(){return this._steps}set steps(e){this._steps=e;for(let[t,r]of this.children.entries())t==="."||t===".."||r?.syncSteps()}constructor(e,t,r){this.changes=new EE.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=t,this.name=r,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,t=this.vol.createNode(FE|438)){let r=new Io(this.vol,this,e);return r.setNode(t),t.isDirectory()&&(r.children.set(".",r),r.getNode().nlink++),this.setChild(e,r),r}setChild(e,t=new Io(this.vol,this,e)){return this.children.set(e,t),t.parent=this,this.length++,t.getNode().isDirectory()&&(t.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",t,this]),t}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};c(Io,"Link");var Zd=Io;ic.Link=Zd});var ip=Ze(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.File=void 0;var kE=ii(),{O_APPEND:RE}=kE.constants,rp=class rp{constructor(e,t,r,n){this.link=e,this.node=t,this.flags=r,this.fd=n,this.position=0,this.flags&RE&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,t=0,r=e.length,n){typeof n!="number"&&(n=this.position);let o=this.node.write(e,t,r,n);return this.position=n+o,o}read(e,t=0,r=e.byteLength,n){typeof n!="number"&&(n=this.position);let o=this.node.read(e,t,r,n);return this.position=n+o,o}chmod(e){this.node.chmod(e)}chown(e,t){this.node.chown(e,t)}};c(rp,"File");var tp=rp;nc.File=tp});var Oa=Ze(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.FLAGS=Ta.ERRSTR=void 0;var TE=ii();Ta.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:Jb,O_WRONLY:sc,O_RDWR:Ra,O_CREAT:zi,O_EXCL:ac,O_TRUNC:oc,O_APPEND:lc,O_SYNC:Yb}=TE.constants,Xb;(function(i){i[i.r=Jb]="r",i[i["r+"]=Ra]="r+",i[i.rs=Jb|Yb]="rs",i[i.sr=i.rs]="sr",i[i["rs+"]=Ra|Yb]="rs+",i[i["sr+"]=i["rs+"]]="sr+",i[i.w=sc|zi|oc]="w",i[i.wx=sc|zi|oc|ac]="wx",i[i.xw=i.wx]="xw",i[i["w+"]=Ra|zi|oc]="w+",i[i["wx+"]=Ra|zi|oc|ac]="wx+",i[i["xw+"]=i["wx+"]]="xw+",i[i.a=sc|lc|zi]="a",i[i.ax=sc|lc|zi|ac]="ax",i[i.xa=i.ax]="xa",i[i["a+"]=Ra|lc|zi]="a+",i[i["ax+"]=Ra|lc|zi|ac]="ax+",i[i["xa+"]=i["ax+"]]="xa+"})(Xb||(Ta.FLAGS=Xb={}))});var sp=Ze(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.default=typeof queueMicrotask=="function"?queueMicrotask:i=>Promise.resolve().then(()=>i()).catch(()=>{})});var uc=Ze(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.filenameToSteps=ar.resolve=ar.unixify=ar.isWin=void 0;ar.isFd=Zb;ar.validateFd=jE;ar.dataToBuffer=ME;var fc=Fa(),cc=Wi(),Qb=Zl(),OE=Do(),xE=Oa();ar.isWin=Qb.default.platform==="win32";var AE=fc.resolve,PE=fc.posix?fc.posix.sep:fc.sep,DE=c((i,e)=>{let t=i[e];return e>0&&(t==="/"||ar.isWin&&t==="\\")},"isSeparator"),NE=c(i=>{let e=i.length-1;if(e<2)return i;for(;DE(i,e);)e--;return i.substr(0,e+1)},"removeTrailingSeparator"),CE=c((i,e)=>{if(typeof i!="string")throw new TypeError("expected a string");return i=i.replace(/[\\\/]+/g,"/"),e!==!1&&(i=NE(i)),i},"normalizePath"),IE=c((i,e=!0)=>ar.isWin?(i=CE(i,e),i.replace(/^([a-zA-Z]+:|\.\/)/,"")):i,"unixify");ar.unixify=IE;var hc=c((i,e=Qb.default.cwd())=>AE(e,i),"resolve");ar.resolve=hc;if(ar.isWin){let i=hc;ar.resolve=hc=c((e,t)=>(0,ar.unixify)(i(e,t)),"resolve")}var BE=c((i,e)=>{let r=hc(i,e).substring(1);return r?r.split(PE):[]},"filenameToSteps");ar.filenameToSteps=BE;function Zb(i){return i>>>0===i}c(Zb,"isFd");function jE(i){if(!Zb(i))throw TypeError(xE.ERRSTR.FD)}c(jE,"validateFd");function ME(i,e=OE.ENCODING_UTF8){return cc.Buffer.isBuffer(i)?i:i instanceof Uint8Array?(0,cc.bufferFrom)(i):e==="buffer"?(0,cc.bufferFrom)(String(i),"utf8"):(0,cc.bufferFrom)(String(i),e)}c(ME,"dataToBuffer")});var Hi=Ze(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getWriteSyncArgs=ir.getWriteArgs=ir.bufToUint8=void 0;ir.promisify=LE;ir.validateCallback=e0;ir.modeToNumber=t0;ir.nullCheck=r0;ir.pathToFilename=qE;ir.createError=s1;ir.genRndStr6=a1;ir.flagsToNumber=o1;ir.streamToBuffer=l1;ir.bufferToEncoding=u1;ir.isReadableStream=d1;var Bo=Oa(),ap=Po(),op=Wi(),$E=sp(),dc=uc();function LE(i,e,t=r=>r){return(...r)=>new Promise((n,o)=>{i[e].bind(i)(...r,(f,m)=>f?o(f):n(t(m)))})}c(LE,"promisify");function e0(i){if(typeof i!="function")throw TypeError(Bo.ERRSTR.CB);return i}c(e0,"validateCallback");function UE(i,e){if(typeof i=="number")return i;if(typeof i=="string")return parseInt(i,8);if(e)return t0(e)}c(UE,"_modeToNumber");function t0(i,e){let t=UE(i,e);if(typeof t!="number"||isNaN(t))throw new TypeError(Bo.ERRSTR.MODE_INT);return t}c(t0,"modeToNumber");function r0(i,e){if((""+i).indexOf("\0")!==-1){let t=new Error("Path must be a string without null bytes");if(t.code="ENOENT",typeof e!="function")throw t;return(0,$E.default)(()=>{e(t)}),!1}return!0}c(r0,"nullCheck");function WE(i){if(i.hostname!=="")throw new ap.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=i.pathname;for(let t=0;t<e.length;t++)if(e[t]==="%"){let r=e.codePointAt(t+2)|32;if(e[t+1]==="2"&&r===102)throw new ap.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}c(WE,"getPathFromURLPosix");function qE(i){if(i instanceof Uint8Array&&(i=(0,op.bufferFrom)(i)),typeof i!="string"&&!op.Buffer.isBuffer(i)){try{if(!(i instanceof rr("url").URL))throw new TypeError(Bo.ERRSTR.PATH_STR)}catch{throw new TypeError(Bo.ERRSTR.PATH_STR)}i=WE(i)}let e=String(i);return r0(e),e}c(qE,"pathToFilename");var zE="ENOENT",HE="EBADF",GE="EINVAL",VE="EPERM",KE="EPROTO",JE="EEXIST",YE="ENOTDIR",XE="EMFILE",QE="EACCES",ZE="EISDIR",e1="ENOTEMPTY",t1="ENOSYS",r1="ERR_FS_EISDIR",i1="ERR_OUT_OF_RANGE";function n1(i,e="",t="",r=""){let n="";switch(t&&(n=` '${t}'`),r&&(n+=` -> '${r}'`),i){case zE:return`ENOENT: no such file or directory, ${e}${n}`;case HE:return`EBADF: bad file descriptor, ${e}${n}`;case GE:return`EINVAL: invalid argument, ${e}${n}`;case VE:return`EPERM: operation not permitted, ${e}${n}`;case KE:return`EPROTO: protocol error, ${e}${n}`;case JE:return`EEXIST: file already exists, ${e}${n}`;case YE:return`ENOTDIR: not a directory, ${e}${n}`;case ZE:return`EISDIR: illegal operation on a directory, ${e}${n}`;case QE:return`EACCES: permission denied, ${e}${n}`;case e1:return`ENOTEMPTY: directory not empty, ${e}${n}`;case XE:return`EMFILE: too many open files, ${e}${n}`;case t1:return`ENOSYS: function not implemented, ${e}${n}`;case r1:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${t}`;case i1:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${i}: error occurred, ${e}${n}`}}c(n1,"formatError");function s1(i,e="",t="",r="",n=Error){let o=new n(n1(i,e,t,r));return o.code=i,t&&(o.path=t),o}c(s1,"createError");function a1(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}c(a1,"genRndStr6");function o1(i){if(typeof i=="number")return i;if(typeof i=="string"){let e=Bo.FLAGS[i];if(typeof e<"u")return e}throw new ap.TypeError("ERR_INVALID_OPT_VALUE","flags",i)}c(o1,"flagsToNumber");function l1(i){let e=[];return new Promise((t,r)=>{i.on("data",n=>e.push(n)),i.on("end",()=>t(op.Buffer.concat(e))),i.on("error",r)})}c(l1,"streamToBuffer");var c1=c(i=>new Uint8Array(i.buffer,i.byteOffset,i.byteLength),"bufToUint8");ir.bufToUint8=c1;var f1=c((i,e,t,r,n,o)=>{(0,dc.validateFd)(i);let f=0,m,l=null,a,g,y=typeof e,b=typeof t,S=typeof r,F=typeof n;y!=="string"?b==="function"?g=t:S==="function"?(f=t|0,g=r):F==="function"?(f=t|0,m=r,g=n):(f=t|0,m=r,l=n,g=o):b==="function"?g=t:S==="function"?(l=t,g=r):F==="function"&&(l=t,a=r,g=n);let T=(0,dc.dataToBuffer)(e,a);y!=="string"?typeof m>"u"&&(m=T.length):(f=0,m=T.length);let P=e0(g);return[i,y==="string",T,f,m,l,P]},"getWriteArgs");ir.getWriteArgs=f1;var h1=c((i,e,t,r,n)=>{(0,dc.validateFd)(i);let o,f,m,l,a=typeof e!="string";a?(f=(t||0)|0,m=r,l=n):(l=t,o=r);let g=(0,dc.dataToBuffer)(e,o);return a?typeof m>"u"&&(m=g.length):(f=0,m=g.length),[i,g,f||0,m,l]},"getWriteSyncArgs");ir.getWriteSyncArgs=h1;function u1(i,e){return!e||e==="buffer"?i:i.toString(e)}c(u1,"bufferToEncoding");function d1(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"&&typeof i.on=="function"&&i.readable===!0}c(d1,"isReadableStream")});var l0=Ze(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.Superblock=void 0;var or=Fa(),p1=Qd(),i0=ep(),m1=ip(),g1=Wi(),n0=Zl(),hi=ii(),s0=Oa(),wt=Hi(),ni=uc(),y1=Vd(),xa=or.posix?or.posix.sep:or.sep,a0=or.posix?or.posix.relative:or.relative,w1=or.posix?or.posix.join:or.join,{O_RDONLY:lp,O_WRONLY:pc,O_RDWR:cp,O_CREAT:o0,O_EXCL:b1,O_TRUNC:_1,O_APPEND:v1,O_DIRECTORY:S1}=hi.constants,Aa=class Aa{static fromJSON(e,t){let r=new Aa;return r.fromJSON(e,t),r}static fromNestedJSON(e,t){let r=new Aa;return r.fromNestedJSON(e,t),r}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(r,n,o,f=!0)=>{let m=this.openFile(r,n,o,f);if(!m)throw(0,wt.createError)("ENOENT","open",r);return m.fd},this.writeFile=(r,n,o,f)=>{let m=typeof r=="number",l;m?l=r:l=this.open((0,wt.pathToFilename)(r),o,f);let a=0,g=n.length,y=o&v1?void 0:0;try{for(;g>0;){let b=this.write(l,n,a,g,y);a+=b,g-=b,y!==void 0&&(y+=b)}}finally{m||this.close(l)}},this.read=(r,n,o,f,m)=>{if(n.byteLength<f)throw(0,wt.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let l=this.getFileByFdOrThrow(r);if(l.node.isSymlink())throw(0,wt.createError)("EPERM","read",l.link.getPath());return l.read(n,Number(o),Number(f),m===-1||typeof m!="number"?void 0:m)},this.readv=(r,n,o)=>{let f=this.getFileByFdOrThrow(r),m=o??void 0;m===-1&&(m=void 0);let l=0;for(let a of n){let g=f.read(a,0,a.byteLength,m);if(m=void 0,l+=g,g<a.byteLength)break}return l},this.link=(r,n)=>{let o;try{o=this.getLinkOrThrow(r,"link")}catch(g){throw g.code&&(g=(0,wt.createError)(g.code,"link",r,n)),g}let f=(0,or.dirname)(n),m;try{m=this.getLinkOrThrow(f,"link")}catch(g){throw g.code&&(g=(0,wt.createError)(g.code,"link",r,n)),g}let l=(0,or.basename)(n);if(m.getChild(l))throw(0,wt.createError)("EEXIST","link",r,n);let a=o.getNode();a.nlink++,m.createChild(l,a)},this.unlink=r=>{let n=this.getLinkOrThrow(r,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let o=n.getNode();o.nlink--,o.nlink<=0&&this.deleteNode(o)},this.symlink=(r,n)=>{let o=(0,ni.filenameToSteps)(n),f;try{f=this.getLinkParentAsDirOrThrow(o)}catch(g){throw g.code&&(g=(0,wt.createError)(g.code,"symlink",r,n)),g}let m=o[o.length-1];if(f.getChild(m))throw(0,wt.createError)("EEXIST","symlink",r,n);let l=f.getNode();if(!l.canExecute()||!l.canWrite())throw(0,wt.createError)("EACCES","symlink",r,n);let a=f.createChild(m);return a.getNode().makeSymlink(r),a},this.rename=(r,n)=>{let o;try{o=this.getResolvedLinkOrThrow(r)}catch(y){throw y.code&&(y=(0,wt.createError)(y.code,"rename",r,n)),y}let f;try{f=this.getLinkParentAsDirOrThrow(n)}catch(y){throw y.code&&(y=(0,wt.createError)(y.code,"rename",r,n)),y}let m=o.parent;if(!m)throw(0,wt.createError)("EINVAL","rename",r,n);let l=m.getNode(),a=f.getNode();if(!l.canExecute()||!l.canWrite()||!a.canExecute()||!a.canWrite())throw(0,wt.createError)("EACCES","rename",r,n);m.deleteChild(o);let g=(0,or.basename)(n);o.name=g,o.steps=[...f.steps,g],f.setChild(o.getName(),o)},this.mkdir=(r,n)=>{let o=(0,ni.filenameToSteps)(r);if(!o.length)throw(0,wt.createError)("EEXIST","mkdir",r);let f=this.getLinkParentAsDirOrThrow(r,"mkdir"),m=o[o.length-1];if(f.getChild(m))throw(0,wt.createError)("EEXIST","mkdir",r);let l=f.getNode();if(!l.canWrite()||!l.canExecute())throw(0,wt.createError)("EACCES","mkdir",r);f.createChild(m,this.createNode(hi.constants.S_IFDIR|n))},this.mkdirp=(r,n)=>{let o=!1,f=(0,ni.filenameToSteps)(r),m=null,l=f.length;for(l=f.length;l>=0&&(m=this.getResolvedLink(f.slice(0,l)),!m);l--);for(m||(m=this.root,l=0),m=this.getResolvedLinkOrThrow(or.sep+f.slice(0,l).join(or.sep),"mkdir"),l;l<f.length;l++){let a=m.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,wt.createError)("EACCES","mkdir",r)}else throw(0,wt.createError)("ENOTDIR","mkdir",r);o=!0,m=m.createChild(f[l],this.createNode(hi.constants.S_IFDIR|n))}return o?r:void 0},this.rmdir=(r,n=!1)=>{let o=this.getLinkAsDirOrThrow(r,"rmdir");if(o.length&&!n)throw(0,wt.createError)("ENOTEMPTY","rmdir",r);this.deleteLink(o)},this.rm=(r,n=!1,o=!1)=>{let f;try{f=this.getResolvedLinkOrThrow(r,"stat")}catch(m){if(m.code==="ENOENT"&&n)return;throw m}if(f.getNode().isDirectory()&&!o)throw(0,wt.createError)("ERR_FS_EISDIR","rm",r);if(!f.parent?.getNode().canWrite())throw(0,wt.createError)("EACCES","rm",r);this.deleteLink(f)},this.close=r=>{(0,ni.validateFd)(r);let n=this.getFileByFdOrThrow(r,"close");this.closeFile(n)};let t=this.createLink();t.setNode(this.createNode(hi.constants.S_IFDIR|511)),t.setChild(".",t),t.getNode().nlink++,t.setChild("..",t),t.getNode().nlink++,this.root=t}createLink(e,t,r=!1,n){if(!e)return new i0.Link(this,void 0,"");if(!t)throw new Error("createLink: name cannot be empty");let o=n??(r?511:438),m=n&&n&hi.constants.S_IFMT?n&hi.constants.S_IFMT:r?hi.constants.S_IFDIR:hi.constants.S_IFREG,l=o&~hi.constants.S_IFMT|m;return e.createChild(t,this.createNode(l))}deleteLink(e){let t=e.parent;return t?(t.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:Aa.fd--}createNode(e){let t=new p1.Node(this.newInoNumber(),e);return this.inodes[t.ino]=t,t}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,t=!1,r=!1,n=!1,o){let f,m;e instanceof i0.Link?(f=e.steps,m=xa+f.join(xa)):typeof e=="string"?(f=(0,ni.filenameToSteps)(e),m=e):(f=e,m=xa+f.join(xa));let l=this.root,a=0;for(;a<f.length;){let g=l.getNode();if(g.isDirectory()){if(n&&!g.canExecute())throw(0,wt.createError)("EACCES",o,m)}else if(a<f.length-1)throw(0,wt.createError)("ENOTDIR",o,m);if(l=l.getChild(f[a])??null,!l){if(r)throw(0,wt.createError)("ENOENT",o,m);return null}if(g=l?.getNode(),g.isSymlink()&&(t||a<f.length-1)){let y=(0,or.isAbsolute)(g.symlink)?g.symlink:w1((0,or.dirname)(l.getPath()),g.symlink);f=(0,ni.filenameToSteps)(y).concat(f.slice(a+1)),l=this.root,a=0;continue}if(r&&!g.isDirectory()&&a<f.length-1){let y=n0.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,wt.createError)(y,o,m)}a++}return l}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,t){return this.walk(e,!1,!0,!0,t)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,t){return this.walk(e,!0,!0,!0,t)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,t){let r=this.getLinkOrThrow(e,t);if(!r.getNode().isDirectory())throw(0,wt.createError)("ENOTDIR",t,e);return r}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,t){let r=(e instanceof Array?e:(0,ni.filenameToSteps)(e)).slice(0,-1),n=xa+r.join(xa),o=this.getLinkOrThrow(n,t);if(!o.getNode().isDirectory())throw(0,wt.createError)("ENOTDIR",t,n);return o}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,t){if(!(0,ni.isFd)(e))throw TypeError(s0.ERRSTR.FD);let r=this.getFileByFd(e);if(!r)throw(0,wt.createError)("EBADF",t);return r}_toJSON(e=this.root,t={},r,n){let o=!0,f=e.children;e.getNode().isFile()&&(f=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let l of f.keys()){if(l==="."||l==="..")continue;o=!1;let a=e.getChild(l);if(!a)throw new Error("_toJSON: unexpected undefined");let g=a.getNode();if(g.isFile()){let y=a.getPath();r&&(y=a0(r,y)),t[y]=n?g.getBuffer():g.getString()}else g.isDirectory()&&this._toJSON(a,t,r,n)}let m=e.getPath();return r&&(m=a0(r,m)),m&&o&&(t[m]=null),t}toJSON(e,t={},r=!1,n=!1){let o=[];if(e){Array.isArray(e)||(e=[e]);for(let f of e){let m=(0,wt.pathToFilename)(f),l=this.getResolvedLink(m);l&&o.push(l)}}else o.push(this.root);if(!o.length)return t;for(let f of o)this._toJSON(f,t,r?f.getPath():"",n);return t}fromJSON(e,t=n0.default.cwd()){for(let r in e){let n=e[r];if(r=(0,ni.resolve)(r,t),typeof n=="string"||n instanceof g1.Buffer){let o=(0,or.dirname)(r);this.mkdirp(o,511);let f=(0,ni.dataToBuffer)(n);this.writeFile(r,f,s0.FLAGS.w,438)}else this.mkdirp(r,511)}}fromNestedJSON(e,t){this.fromJSON((0,y1.flattenJSON)(e),t)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(hi.constants.S_IFDIR|511))}mountSync(e,t){this.fromJSON(t,e)}openLink(e,t,r=!0){if(this.openFiles>=this.maxFiles)throw(0,wt.createError)("EMFILE","open",e.getPath());let n=e;r&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let o=n.getNode();if(o.isDirectory()){if((t&(lp|cp|pc))!==lp)throw(0,wt.createError)("EISDIR","open",e.getPath())}else if(t&S1)throw(0,wt.createError)("ENOTDIR","open",e.getPath());if((t&(lp|cp|pc))!==pc&&!o.canRead()||t&(pc|cp)&&!o.canWrite())throw(0,wt.createError)("EACCES","open",e.getPath());let f=new m1.File(e,o,t,this.newFdNumber());return this.fds[f.fd]=f,this.openFiles++,t&_1&&f.truncate(),f}openFile(e,t,r,n=!0){let o=(0,ni.filenameToSteps)(e),f;try{if(f=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),f&&t&o0&&t&b1)throw(0,wt.createError)("EEXIST","open",e)}catch(m){if(m.code==="ENOENT"&&t&o0){let l=(0,or.dirname)(e),a=this.getResolvedLinkOrThrow(l),g=a.getNode();if(!g.isDirectory())throw(0,wt.createError)("ENOTDIR","open",e);if(!g.canExecute()||!g.canWrite())throw(0,wt.createError)("EACCES","open",e);r??(r=438),f=this.createLink(a,o[o.length-1],!1,r)}else throw m}if(f)return this.openLink(f,t,n);throw(0,wt.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,t,r,n,o){let f=this.getFileByFdOrThrow(e,"write");if(f.node.isSymlink())throw(0,wt.createError)("EBADF","write",f.link.getPath());return f.write(t,r,n,o===-1||typeof o!="number"?void 0:o)}};c(Aa,"Superblock");var mc=Aa;gc.Superblock=mc;mc.fd=2147483647});var f0=Ze(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Superblock=Hr.File=Hr.Link=Hr.Node=void 0;var c0=(Jl(),kd(Kl));c0.__exportStar(zb(),Hr);c0.__exportStar(Vd(),Hr);var E1=Qd();Object.defineProperty(Hr,"Node",{enumerable:!0,get:c(function(){return E1.Node},"get")});var F1=ep();Object.defineProperty(Hr,"Link",{enumerable:!0,get:c(function(){return F1.Link},"get")});var k1=ip();Object.defineProperty(Hr,"File",{enumerable:!0,get:c(function(){return k1.File},"get")});var R1=l0();Object.defineProperty(Hr,"Superblock",{enumerable:!0,get:c(function(){return R1.Superblock},"get")})});var h0=Ze(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.StatFs=void 0;var wc=class wc{static build(e,t=!1){let r=new wc,n=t?g=>BigInt(g):g=>g;r.type=n(2240043254),r.bsize=n(4096);let o=Object.keys(e.inodes).length,f=1e6,m=Math.min(o*2,f),l=f-m;r.blocks=n(f),r.bfree=n(l),r.bavail=n(l);let a=1e6;return r.files=n(a),r.ffree=n(a-o),r}};c(wc,"StatFs");var yc=wc;jo.StatFs=yc;jo.default=yc});var u0=Ze(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});function T1(i,e,t){let r=setTimeout.apply(globalThis,arguments);return r&&typeof r=="object"&&typeof r.unref=="function"&&r.unref(),r}c(T1,"setTimeoutUnref");fp.default=T1});var p0=Ze(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.Writable=Pa.Readable=void 0;var d0=rr("node:stream");Object.defineProperty(Pa,"Readable",{enumerable:!0,get:c(function(){return d0.Readable},"get")});Object.defineProperty(Pa,"Writable",{enumerable:!0,get:c(function(){return d0.Writable},"get")})});var hp=Ze(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.EventEmitter=void 0;var O1=rr("node:events");Object.defineProperty(bc,"EventEmitter",{enumerable:!0,get:c(function(){return O1.EventEmitter},"get")})});var m0=Ze(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.FileHandle=void 0;var gr=Hi(),x1=hp(),dp=class dp extends x1.EventEmitter{constructor(e,t){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=t}getAsyncId(){return this.fd}appendFile(e,t){return(0,gr.promisify)(this.fs,"appendFile")(this.fd,e,t)}chmod(e){return(0,gr.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,t){return(0,gr.promisify)(this.fs,"fchown")(this.fd,e,t)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,gr.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,t)=>{this.closeResolve=e,this.closeReject=t}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,gr.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:t="bytes",autoClose:r=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let o=c(()=>{this.readableWebStreamLocked=!1,this.unref(),r&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:t==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:c(async f=>{try{let m=f.byobRequest?.view;if(!m){let a=new Uint8Array(16384),g=await this.read(a,0,a.length,n);if(g.bytesRead===0){f.close(),o();return}n+=g.bytesRead,f.enqueue(a.slice(0,g.bytesRead));return}let l=await this.read(m,m.byteOffset,m.byteLength,n);if(l.bytesRead===0){f.close(),o();return}n+=l.bytesRead,f.byobRequest.respond(l.bytesRead)}catch(m){f.error(m),o()}},"pull"),cancel:c(async()=>{o()},"cancel")})}async read(e,t,r,n){let o=n??this.position,f=await(0,gr.promisify)(this.fs,"read",m=>({bytesRead:m,buffer:e}))(this.fd,e,t,r,o);return n==null&&(this.position+=f.bytesRead),f}readv(e,t){return(0,gr.promisify)(this.fs,"readv",r=>({bytesRead:r,buffers:e}))(this.fd,e,t)}readFile(e){return(0,gr.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,gr.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,gr.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,gr.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,t){return(0,gr.promisify)(this.fs,"futimes")(this.fd,e,t)}async write(e,t,r,n){let o=typeof n!="number",f=o?this.position:n,m=await(0,gr.promisify)(this.fs,"write",l=>({bytesWritten:l,buffer:e}))(this.fd,e,t,r,f);return o&&(this.position+=m.bytesWritten),m}writev(e,t){return(0,gr.promisify)(this.fs,"writev",r=>({bytesWritten:r,buffers:e}))(this.fd,e,t)}writeFile(e,t){return(0,gr.promisify)(this.fs,"writeFile")(this.fd,e,t)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,gr.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};c(dp,"FileHandle");var up=dp;_c.FileHandle=up});var g0=Ze(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.FsPromises=void 0;var Rt=Hi(),A1=ii(),gp=class gp{constructor(e,t,r={}){if(this.fs=e,this.path=t,this.options=r,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=r.maxQueue||2048,this.overflow=r.overflow||"ignore",this.startWatching(),r.signal){if(r.signal.aborted){this.finish();return}r.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,t)=>{this.enqueueEvent({eventType:e,filename:t})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let t=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(t);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:t}=this.resolveQueue.shift(),r=this.eventQueue.shift();t({value:r,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:t,reject:r}=this.resolveQueue.shift();e?r(e):t({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,t)=>{this.resolveQueue.push({resolve:e,reject:t})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};c(gp,"FSWatchAsyncIterator");var pp=gp,yp=class yp{constructor(e,t){this.fs=e,this.FileHandle=t,this.constants=A1.constants,this.cp=(0,Rt.promisify)(this.fs,"cp"),this.opendir=(0,Rt.promisify)(this.fs,"opendir"),this.statfs=(0,Rt.promisify)(this.fs,"statfs"),this.lutimes=(0,Rt.promisify)(this.fs,"lutimes"),this.glob=(0,Rt.promisify)(this.fs,"glob"),this.access=(0,Rt.promisify)(this.fs,"access"),this.chmod=(0,Rt.promisify)(this.fs,"chmod"),this.chown=(0,Rt.promisify)(this.fs,"chown"),this.copyFile=(0,Rt.promisify)(this.fs,"copyFile"),this.lchmod=(0,Rt.promisify)(this.fs,"lchmod"),this.lchown=(0,Rt.promisify)(this.fs,"lchown"),this.link=(0,Rt.promisify)(this.fs,"link"),this.lstat=(0,Rt.promisify)(this.fs,"lstat"),this.mkdir=(0,Rt.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,Rt.promisify)(this.fs,"mkdtemp"),this.readdir=(0,Rt.promisify)(this.fs,"readdir"),this.readlink=(0,Rt.promisify)(this.fs,"readlink"),this.realpath=(0,Rt.promisify)(this.fs,"realpath"),this.rename=(0,Rt.promisify)(this.fs,"rename"),this.rmdir=(0,Rt.promisify)(this.fs,"rmdir"),this.rm=(0,Rt.promisify)(this.fs,"rm"),this.stat=(0,Rt.promisify)(this.fs,"stat"),this.symlink=(0,Rt.promisify)(this.fs,"symlink"),this.truncate=(0,Rt.promisify)(this.fs,"truncate"),this.unlink=(0,Rt.promisify)(this.fs,"unlink"),this.utimes=(0,Rt.promisify)(this.fs,"utimes"),this.readFile=(r,n)=>(0,Rt.promisify)(this.fs,"readFile")(r instanceof this.FileHandle?r.fd:r,n),this.appendFile=(r,n,o)=>(0,Rt.promisify)(this.fs,"appendFile")(r instanceof this.FileHandle?r.fd:r,n,o),this.open=(r,n="r",o)=>(0,Rt.promisify)(this.fs,"open",f=>new this.FileHandle(this.fs,f))(r,n,o),this.writeFile=(r,n,o)=>((0,Rt.isReadableStream)(n)?(0,Rt.streamToBuffer)(n):Promise.resolve(n)).then(m=>(0,Rt.promisify)(this.fs,"writeFile")(r instanceof this.FileHandle?r.fd:r,m,o)),this.watch=(r,n)=>{let o=typeof n=="string"?{encoding:n}:n||{};return new pp(this.fs,r,o)}}};c(yp,"FsPromises");var mp=yp;vc.FsPromises=mp});var y0=Ze(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.printTree=void 0;var P1=c((i="",e)=>{let t="",r=e.length-1;for(;r>=0&&!e[r];r--);for(let n=0;n<=r;n++){let o=e[n];if(!o)continue;let f=n===r,m=o(i+(f?" ":"\u2502")+" "),l=m?f?"\u2514\u2500":"\u251C\u2500":"\u2502";t+=`
5
+ `+i+l+(m?" "+m:"")}return t},"printTree");Sc.printTree=P1});var w0=Ze(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.printBinary=void 0;var D1=c((i="",e)=>{let t=e[0],r=e[1],n="";return t&&(n+=`
6
+ `+i+"\u2190 "+t(i+" ")),r&&(n+=`
7
+ `+i+"\u2192 "+r(i+" ")),n},"printBinary");Ec.printBinary=D1});var b0=Ze(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.printJson=void 0;var N1=c((i="",e,t=2)=>(JSON.stringify(e,null,t)||"nil").split(`
8
8
  `).join(`
9
- `+t),"printJson");Dl.printJson=hC});var vp=T(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var Sp=(nl(),Od(il));Sp.__exportStar(S_(),ua);Sp.__exportStar(v_(),ua);Sp.__exportStar(E_(),ua)});var F_=T(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.newNotAllowedError=Xe.newTypeMismatchError=Xe.newNotFoundError=Xe.assertCanWrite=Xe.assertName=Xe.basename=Xe.ctx=void 0;var dC=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");Xe.ctx=dC;var pC=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");Xe.basename=pC;var mC=/^(\.{1,2})$|^(.*([\/\\]).*)$/,wC=l((t,e,r)=>{if(!t||mC.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");Xe.assertName=wC;var yC=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");Xe.assertCanWrite=yC;var gC=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");Xe.newNotFoundError=gC;var bC=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");Xe.newTypeMismatchError=bC;var _C=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");Xe.newNotAllowedError=_C});var T_=T(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.toTreeSync=void 0;var SC=vp(),vC=F_(),EC=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,o=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});o=(0,SC.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,ha.toTreeSync)(t,{dir:i+a.name,depth:s-1,tab:u}):a.isSymbolicLink()?""+a.name+" \u2192 "+t.readlinkSync(i+a.name):""+a.name))}return(0,vC.basename)(i,r)+r+o},"toTreeSync");ha.toTreeSync=EC});var O_=T(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getWriteFileOptions=j.writeFileDefaults=j.getRealpathOptsAndCb=j.getRealpathOptions=j.getStatfsOptsAndCb=j.getStatfsOptions=j.getStatOptsAndCb=j.getStatOptions=j.getAppendFileOptsAndCb=j.getAppendFileOpts=j.getOpendirOptsAndCb=j.getOpendirOptions=j.getReaddirOptsAndCb=j.getReaddirOptions=j.getReadFileOptions=j.getRmOptsAndCb=j.getRmdirOptions=j.getDefaultOptsAndCb=j.getDefaultOpts=j.optsDefaults=j.getMkdirOptions=void 0;j.getOptions=R_;j.optsGenerator=xr;j.optsAndCbGenerator=Ii;var Cl=ls(),FC=sa(),Ep=Zr(),k_={mode:511,recursive:!1},TC=l(t=>typeof t=="number"?Object.assign({},k_,{mode:t}):Object.assign({},k_,t),"getMkdirOptions");j.getMkdirOptions=TC;var kC=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function R_(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(kC(i))}}else return t;return r.encoding!=="buffer"&&(0,FC.assertEncoding)(r.encoding),r}l(R_,"getOptions");function xr(t){return e=>R_(t,e)}l(xr,"optsGenerator");function Ii(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Ep.validateCallback)(r)]}l(Ii,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=xr(j.optsDefaults);j.getDefaultOptsAndCb=Ii(j.getDefaultOpts);var RC={recursive:!1},OC=l(t=>Object.assign({},RC,t),"getRmdirOptions");j.getRmdirOptions=OC;var xC=xr(j.optsDefaults);j.getRmOptsAndCb=Ii(xC);var AC={flag:"r"};j.getReadFileOptions=xr(AC);var PC={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=xr(PC);j.getReaddirOptsAndCb=Ii(j.getReaddirOptions);var NC={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=xr(NC);j.getOpendirOptsAndCb=Ii(j.getOpendirOptions);var DC={encoding:"utf8",mode:438,flag:Cl.FLAGS[Cl.FLAGS.a]};j.getAppendFileOpts=xr(DC);j.getAppendFileOptsAndCb=Ii(j.getAppendFileOpts);var CC={bigint:!1},IC=l((t={})=>Object.assign({},CC,t),"getStatOptions");j.getStatOptions=IC;var $C=l((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,Ep.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=$C;var BC={bigint:!1},MC=l((t={})=>Object.assign({},BC,t),"getStatfsOptions");j.getStatfsOptions=MC;var LC=l((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,Ep.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=LC;var jC=j.optsDefaults;j.getRealpathOptions=xr(jC);j.getRealpathOptsAndCb=Ii(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:Cl.FLAGS[Cl.FLAGS.w]};j.getWriteFileOptions=xr(j.writeFileDefaults)});var A_=T(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.Dir=void 0;var x_=Zr(),qC=Qc(),$i=na(),Tp=class Tp{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),qC.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new $i.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,x_.validateCallback)(e),this.closed){process.nextTick(e,new $i.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new $i.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new $i.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,x_.validateCallback)(e),this.closed){process.nextTick(e,new $i.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new $i.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new $i.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l(Tp,"Dir");var Fp=Tp;Il.Dir=Fp});var kp=T(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.toMatcher=Ar.toRegex=void 0;var UC=l(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),WC=l((t,e,r,i)=>{let n=e,s=[],o="",f=1;for(;n<t.length&&f>0;){let u=t[n];if(u==="(")f++,o+=u,n++;else if(u===")")if(f--,f===0){s.push(o),n++;break}else o+=u,n++;else u==="|"&&f===1?(s.push(o),o="",n++):(o+=u,n++)}if(f!==0)return;let c="",a=s.length;for(let u=0;u<a;u++)c+=(c?"|":"")+(0,Ar.toRegex)(s[u],i).source.replace(/^\^/,"").replace(/\$$/,"");switch(r){case"?":return[`(?:${c})?`,n];case"*":return[`(?:${c})*`,n];case"+":return[`(?:${c})+`,n];case"@":return[`(?:${c})`,n];case"!":return[`(?!${c})[^/]*`,n]}},"parseExtGlob"),zC=l((t,e)=>{let r="",i=0,n=l(()=>{i++;let f=[],c="",a=!1;for(;i<t.length;){let h=t[i];if(h==="}"){f.push(c),i++,a=!0;break}if(h===","){f.push(c),c="",i++;continue}c+=h,i++}return a?`(?:${f.map(h=>(0,Ar.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+UC(c)},"parseBraceGroup"),s=!!e?.extglob;for(;i<t.length;){let f=t[i];if(s&&t[i+1]==="("&&(f==="?"||f==="*"||f==="+"||f==="@"||f==="!")){let c=WC(t,i+2,f,e);if(c){r+=c[0],i=c[1];continue}}switch(f){case"*":{if(t[i+1]==="*"){let c=i+2;for(;t[c]==="*";)c++;t[c]==="/"?(r+="(?:.*/)?",i=c+1):(r+=".*",i=c)}else r+="[^/]*",i++;break}case"?":r+="[^/]",i++;break;case"[":{let c="[";for(i++,i<t.length&&t[i]==="!"&&(c+="^",i++),i<t.length&&t[i]==="]"&&(c+="]",i++);i<t.length&&t[i]!=="]";){let a=t[i];c+=a==="\\"?"\\\\":a,i++}if(i<t.length&&t[i]==="]")c+="]",i++;else{r+="\\[";continue}r+=c;break}case"{":{r+=n();break}case"/":r+="/",i++;break;case".":case"^":case"$":case"+":case"(":case")":case"|":case"\\":r+=`\\${f}`,i++;break;default:r+=f,i++;break}}let o=e?.nocase?"i":"";return new RegExp("^"+r+"$",o)},"toRegex");Ar.toRegex=zC;var HC=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,VC=l((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=HC.exec(n);if(s){let[,o,f]=s;r.push(new RegExp(o,f))}else r.push((0,Ar.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");Ar.toMatcher=VC});var D_=T(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.globSync=ZC;var Bi=ss(),GC=kp(),P_=Zr(),JC=Bi.posix.join,KC=Bi.posix.relative,XC=Bi.posix.resolve;function N_(t,e){return(0,GC.toRegex)(e).test(t)}l(N_,"matchesPattern");function YC(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>N_(t,i)):!1}l(YC,"isExcluded");function Rp(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,P_.pathToFilename)(i.cwd):process.cwd();if(n>o)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let a of c){let u=JC(e,a.name.toString()),h=KC(f,u);if(YC(h,i.exclude))continue;if(r.some(p=>N_(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=Rp(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Rp,"walkDirectory");function ZC(t,e,r={}){let i=r.cwd?(0,P_.pathToFilename)(r.cwd):process.cwd(),n=XC(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(Bi.posix.isAbsolute(e)){let f=Bi.posix.dirname(e),c=Bi.posix.basename(e),a=Rp(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>Bi.posix.resolve(f,u)))}else{let f=Rp(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l(ZC,"globSync")});var j_=T(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.FSWatcher=bt.StatWatcher=bt.Volume=void 0;bt.pathToSteps=mI;bt.dataToStr=wI;bt.toUnixTimestamp=gt;var Re=ss(),Np=p_(),xp=Md(),QC=Qc(),eI=m_(),ms=Kr(),jl=cp(),tI=w_(),ql=g_(),rI=Vt(),B_=pp(),Mi=sa(),iI=b_(),M_=jd(),nI=__(),sI=T_(),Bl=ls(),oI=na(),Q=O_(),P=Zr(),aI=A_(),We=Sl(),cI=Re.resolve,{O_SYMLINK:C_,F_OK:Ap,R_OK:lI,W_OK:fI,X_OK:uI,COPYFILE_EXCL:hI,COPYFILE_FICLONE_FORCE:dI}=rI.constants,g9=Re.posix?Re.posix.sep:Re.sep,$l=Re.posix?Re.posix.relative:Re.relative,Pp=Re.posix?Re.posix.join:Re.join,I_=Re.posix?Re.posix.dirname:Re.dirname,$_=Re.posix?Re.posix.normalize:Re.normalize,pI=128;function mI(t){return(0,We.filenameToSteps)((0,P.pathToFilename)(t))}l(mI,"pathToSteps");function wI(t,e=Mi.ENCODING_UTF8){return ms.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,ms.bufferFrom)(t).toString(e):String(t)}l(wI,"dataToStr");function gt(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(gt,"toUnixTimestamp");function ds(t){if(typeof t!="number")throw TypeError(Bl.ERRSTR.UID)}l(ds,"validateUid");function ps(t){if(typeof t!="number")throw TypeError(Bl.ERRSTR.GID)}l(ps,"validateGid");var Dp=class Dp{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Np.Superblock){this._core=e,this.promisesApi=new nI.FsPromises(this,iI.FileHandle),this.openSync=(c,a,u=438)=>{let h=(0,P.modeToNumber)(u),d=(0,P.pathToFilename)(c),p=(0,P.flagsToNumber)(a);return this._core.open(d,p,h,!(p&C_))},this.open=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,P.modeToNumber)(d),w=(0,P.pathToFilename)(c),y=(0,P.flagsToNumber)(a);this.wrapAsync(this._core.open,[w,y,m,!(y&C_)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,We.validateFd)(c);let u=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[u.fd],a)},this.readSync=(c,a,u,h,d)=>((0,We.validateFd)(c),this._core.read(c,a,u,h,d)),this.read=(c,a,u,h,d,p)=>{if((0,P.validateCallback)(p),h===0)return(0,jl.default)(()=>{p&&p(null,0,a)});Promise.resolve().then(()=>{try{let m=this._core.read(c,a,u,h,d);p(null,m,a)}catch(m){p(m)}})},this.readv=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.readvSync=(c,a,u)=>((0,We.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,We.isFd)(c),m;if(p)m=c;else{let w=(0,P.pathToFilename)(c),y=String(c),b=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,P.createError)("EISDIR","open",_.getPath());if(b&&F.isFile())throw(0,P.createError)("ENOTDIR","open",y);m=this.openSync(c,a)}try{h=(0,P.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,a)=>{let u=(0,Q.getReadFileOptions)(a),h=(0,P.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,Q.optsAndCbGenerator)(Q.getReadFileOptions)(a,u),p=(0,P.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,a,u,h,d)=>{let[,p,m,w,y]=(0,P.getWriteSyncArgs)(c,a,u,h,d);return this._write(c,p,m,w,y)},this.write=(c,a,u,h,d,p)=>{let[,m,w,y,b,_,F]=(0,P.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,b,_);m?F(null,E,a):F(null,E,w)}catch(E){F(E)}})},this.writev=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.writevSync=(c,a,u)=>((0,We.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,Q.getWriteFileOptions)(u),d=(0,P.flagsToNumber)(h.flag),p=(0,P.modeToNumber)(h.mode),m=(0,We.dataToBuffer)(a,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[Q.writeFileDefaults,u]);let m=(0,P.validateCallback)(p),w=(0,Q.getWriteFileOptions)(d),y=(0,P.flagsToNumber)(w.flag),b=(0,P.modeToNumber)(w.mode),_=(0,We.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,b],m)},this.copyFileSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(c,a,u,h)=>{let d=(0,P.pathToFilename)(c),p=(0,P.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,P.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,a,u)=>{if(u.filter&&!u.filter(c,a))return;let h=u.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(a)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,P.createError)("EINVAL","cp",c,a);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,P.createError)("EISDIR","cp",c,a);if(!h.isDirectory()&&d.isDirectory())throw(0,P.createError)("ENOTDIR","cp",c,a)}if(h.isDirectory()&&this.isSrcSubdir(c,a))throw(0,P.createError)("EINVAL","cp",c,a);{let p=I_(a);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,P.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,a,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,a,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,c,a,u);else throw(0,P.createError)("EINVAL","cp",c)},this.linkSync=(c,a)=>{let u=(0,P.pathToFilename)(c),h=(0,P.pathToFilename)(a);this._core.link(u,h)},this.link=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=c=>{let a=(0,P.pathToFilename)(c);this._core.unlink(a)},this.unlink=(c,a)=>{let u=(0,P.pathToFilename)(c);this.wrapAsync(this._core.unlink,[u],a)},this.symlinkSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this._core.symlink(h,d)},this.symlink=(c,a,u,h)=>{let d=(0,P.validateCallback)(typeof u=="function"?u:h),p=(0,P.pathToFilename)(c),m=(0,P.pathToFilename)(a);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,a=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return xp.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Q.getStatOptions)(a);return this._lstat((0,P.pathToFilename)(c),h,u)},this.renameSync=(c,a)=>{let u=(0,P.pathToFilename)(c),h=(0,P.pathToFilename)(a);this._core.rename(u,h)},this.rename=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=c=>{try{return this._exists((0,P.pathToFilename)(c))}catch{return!1}},this.exists=(c,a)=>{let u=(0,P.pathToFilename)(c);if(typeof a!="function")throw Error(Bl.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=Ap)=>{let u=(0,P.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=Ap,d;typeof a!="function"?[h,d]=[a|0,(0,P.validateCallback)(u)]:d=a;let p=(0,P.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,a,u)=>{let h=(0,Q.getAppendFileOpts)(u);(!h.flag||(0,We.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,Q.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,We.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,We.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,P.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,P.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(QC.default.build(y,a.encoding)),a.recursive&&y.children.size)){let b={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),b);p.push(..._)}}if(!We.isWin&&a.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),a.withFileTypes)return p;let m=c;return We.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=Pp(w.parentPath,w.name.toString());return We.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Re.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,Q.getReaddirOptions)(a),h=(0,P.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,Q.getReaddirOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,a)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,P.createError)("EINVAL","readlink",c);return(0,Mi.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,Q.getDefaultOpts)(a),h=(0,P.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,Q.getDefaultOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,a)=>{this.wrapAsync(this._fsync,[c],a)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,a)=>{this.wrapAsync(this._fdatasync,[c],a)},this._ftruncate=(c,a)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(a)},this.ftruncateSync=(c,a)=>{this._ftruncate(c,a)},this.ftruncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,P.validateCallback)(typeof a=="number"?u:a);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,a)=>{let u=this.openSync(c,"r+");try{this.ftruncateSync(u,a)}finally{this.closeSync(u)}},this.truncateSync=(c,a)=>{if((0,We.isFd)(c))return this.ftruncateSync(c,a);this._truncate(c,a)},this.truncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,P.validateCallback)(typeof a=="number"?u:a);if((0,We.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,a,u)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(a*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(c,a,u)=>{this._futimes(c,gt(a),gt(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,gt(a),gt(u)],h)},this._utimes=(c,a,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(a*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(c,a,u)=>{this._utimes((0,P.pathToFilename)(c),gt(a),gt(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(c),gt(a),gt(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,P.pathToFilename)(c),gt(a),gt(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(c),gt(a),gt(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,Q.getMkdirOptions)(a),h=(0,P.modeToNumber)(u.mode,511),d=(0,P.pathToFilename)(c);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,a,u)=>{let h=(0,Q.getMkdirOptions)(a),d=(0,P.validateCallback)(typeof a=="function"?a:u),p=(0,P.modeToNumber)(h.mode,511),m=(0,P.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,a,u=5)=>{let h=c+(0,P.genRndStr6)();try{return this._core.mkdir(h,511),(0,Mi.strToEncoding)(h,a)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(c,a,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,a)=>{let{encoding:u}=(0,Q.getDefaultOpts)(a);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,P.nullCheck)(c),this._mkdtemp(c,u)},this.mkdtemp=(c,a,u)=>{let[{encoding:h},d]=(0,Q.getDefaultOptsAndCb)(a,u);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,P.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,a)=>{let u=(0,Q.getRmdirOptions)(a);this._core.rmdir((0,P.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,Q.getRmdirOptions)(a),d=(0,P.validateCallback)(typeof a=="function"?a:u);this.wrapAsync(this._core.rmdir,[(0,P.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,a)=>{this._core.rm((0,P.pathToFilename)(c),a?.force,a?.recursive)},this.rm=(c,a,u)=>{let[h,d]=(0,Q.getRmOptsAndCb)(a,u);this.wrapAsync(this._core.rm,[(0,P.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,a)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(a)},this.fchmodSync=(c,a)=>{this._fchmod(c,(0,P.modeToNumber)(a))},this.fchmod=(c,a,u)=>{this.wrapAsync(this._fchmod,[c,(0,P.modeToNumber)(a)],u)},this._chmod=(c,a,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(a)},this.chmodSync=(c,a)=>{let u=(0,P.modeToNumber)(a),h=(0,P.pathToFilename)(c);this._chmod(h,u,!0)},this.chmod=(c,a,u)=>{let h=(0,P.modeToNumber)(a),d=(0,P.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(c,a)=>{this._chmod(c,a,!1)},this.lchmodSync=(c,a)=>{let u=(0,P.modeToNumber)(a),h=(0,P.pathToFilename)(c);this._lchmod(h,u)},this.lchmod=(c,a,u)=>{let h=(0,P.modeToNumber)(a),d=(0,P.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(c,a,u)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(a,u)},this.fchownSync=(c,a,u)=>{ds(a),ps(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{ds(a),ps(u),this.wrapAsync(this._fchown,[c,a,u],h)},this._chown=(c,a,u)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(a,u)},this.chownSync=(c,a,u)=>{ds(a),ps(u),this._chown((0,P.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{ds(a),ps(u),this.wrapAsync(this._chown,[(0,P.pathToFilename)(c),a,u],h)},this._lchown=(c,a,u)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(a,u)},this.lchownSync=(c,a,u)=>{ds(a),ps(u),this._lchown((0,P.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{ds(a),ps(u),this.wrapAsync(this._lchown,[(0,P.pathToFilename)(c),a,u],h)},this.statWatchers={},this.cpSync=(c,a,u)=>{let h=(0,P.pathToFilename)(c),d=(0,P.pathToFilename)(a),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,a,u,h)=>{let d=(0,P.pathToFilename)(c),p=(0,P.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,P.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(c,a)=>{let u=(0,P.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new oI.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=a?.type||"";return new Blob([p],{type:m})},this.glob=(c,...a)=>{let[u,h]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[c,u||{}],h)},this.globSync=(c,a={})=>this._globSync(c,a),this._globSync=(c,a={})=>{let{globSync:u}=D_();return u(this,c,a)},this._opendir=(c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"scandir");if(!u.getNode().isDirectory())throw(0,P.createError)("ENOTDIR","scandir",c);return new aI.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,Q.getOpendirOptions)(a),h=(0,P.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,Q.getOpendirOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Ml{constructor(){super(r)}};let i=cr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Nt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends Ll{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Mi.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,Q.getRealpathOptsAndCb)(a,u),p=(0,P.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((c,a)=>s((0,P.pathToFilename)(c),(0,Q.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=o,this.realpath.native=o,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,P.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Re.sep}){return(0,sI.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let o=this._core.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,P.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let o=0;for(let f of r){let c=ms.Buffer.from(f.buffer,f.byteOffset,f.byteLength),a=n.write(c,0,c.byteLength,s);if(s=void 0,o+=a,a<c.byteLength)break}return o}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&hI&&this.existsSync(r))throw(0,P.createError)("EEXIST","copyFile",e,r);if(i&dI)throw(0,P.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,Bl.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=$_(e.startsWith("/")?e:"/"+e),n=$_(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=$l(i,n);return s===""||!s.startsWith("..")&&!(0,Re.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,P.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let o=this.readdirSync(i);for(let f of o){let c=Pp(i,String(f)),a=Pp(n,String(f));s.filter&&!s.filter(c,a)||this._cp(c,a,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Re.isAbsolute)(s)&&(s=cI(I_(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,P.pathToFilename)(e),s,n],o)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return xp.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Q.getStatOptions)(r);return this._stat((0,P.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},o]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,P.pathToFilename)(e),n,s],o)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,P.createError)("EBADF","fstat");return xp.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Q.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==Ap&&(r&lI&&!n.canRead()||r&fI&&!n.canWrite()||r&uI&&!n.canExecute()))throw(0,P.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,P.pathToFilename)(e),s=r,o=i;if(typeof s=="function"&&(o=r,s=null),typeof o!="function")throw Error('"watchFile()" requires a listener function');let f=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,c,f),this.statWatchers[n]=a),a.addListener("change",o),a}unwatchFile(e,r){let i=(0,P.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,P.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:o,recursive:f,encoding:c}=(0,Q.getDefaultOpts)(s);o===void 0&&(o=!0),f===void 0&&(f=!1);let a=new this.FSWatcher;return a.start(n,o,f,c),i&&a.addListener("change",i),a}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),eI.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Q.getStatfsOptions)(r);return this._statfs((0,P.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Q.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,P.pathToFilename)(e),n],s)}};l(Dp,"Volume");var Li=Dp;bt.Volume=Li;Li.fromJSON=(t,e)=>new Li(Np.Superblock.fromJSON(t,e));Li.fromNestedJSON=(t,e)=>new Li(Np.Superblock.fromNestedJSON(t,e));function yI(t){t.emit("stop")}l(yI,"emitStop");var Cp=class Cp extends B_.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,P.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):tI.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,jl.default)(()=>{yI.call(this,this)})}};l(Cp,"StatWatcher");var Ml=Cp;bt.StatWatcher=Ml;var Pt;function gI(t){Pt=(0,ms.bufferAllocUnsafe)(t),Pt.used=0}l(gI,"allocNewPool");(0,M_.inherits)(cr,ql.Readable);bt.ReadStream=cr;function cr(t,e,r){if(!(this instanceof cr))return new cr(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),ql.Readable.call(this,r),this.path=(0,P.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(cr,"FsReadStream");cr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};cr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Pt||Pt.length-Pt.used<pI)&&gI(this._readableState.highWaterMark);var e=Pt,r=Math.min(Pt.length-Pt.used,t),i=Pt.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,Pt,Pt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Pt.used+=r;function s(o,f){if(o)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",o);else{var c=null;f>0&&(n.bytesRead+=f,c=e.slice(i,i+f)),n.push(c)}}l(s,"onread")};cr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};cr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",L_);return}return(0,jl.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function L_(t){this.close()}l(L_,"closeOnOpen");(0,M_.inherits)(Nt,ql.Writable);bt.WriteStream=Nt;function Nt(t,e,r){if(!(this instanceof Nt))return new Nt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),ql.Writable.call(this,r),this.path=(0,P.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Nt,"FsWriteStream");Nt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Nt.prototype._write=function(t,e,r){if(!(t instanceof ms.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Nt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,o=0;o<i;o++){var f=t[o].chunk;n[o]=f,s+=f.length}let c=ms.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(a,u)=>{if(a)return r.destroy&&r.destroy(),e(a);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Nt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",L_);return}return(0,jl.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Nt.prototype._destroy=cr.prototype._destroy;Nt.prototype.destroySoon=Nt.prototype.end;var Ip=class Ip extends B_.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Mi.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=Mi.ENCODING_UTF8){this._filename=(0,P.pathToFilename)(e),this._steps=(0,We.filenameToSteps)(this._filename),this._filenameEncoded=(0,Mi.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let a=new Error(`watch ${this._filename} ${c.code}`);throw a.code=c.code,a.errno=c.code,a}let s=l(c=>{let a=c.getPath(),u=c.getNode(),h=l(()=>{let m=$l(this._filename,a);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),o=l(c=>{let a=c.getNode(),u=l(m=>{this.emit("change","rename",$l(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let b=y.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(b));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",$l(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&o(w)},"watchLinkChildrenChanged");s(this._link),o(this._link);let f=this._link.parent;f&&f.changes.listen(([c,a])=>{c==="child:del"&&this._onParentChild(a)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(Ip,"FSWatcher");var Ll=Ip;bt.FSWatcher=Ll});var q_=T(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.fsSynchronousApiList=void 0;Ul.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var U_=T(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.fsCallbackApiList=void 0;Wl.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var ws=T((_t,zl)=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.memfs=_t.fs=_t.vol=_t.Volume=void 0;_t.createFsFromVolume=$p;var bI=Md(),_I=Qc(),Hl=j_();Object.defineProperty(_t,"Volume",{enumerable:!0,get:l(function(){return Hl.Volume},"get")});var W_=Vt(),SI=q_(),vI=U_(),{F_OK:EI,R_OK:FI,W_OK:TI,X_OK:kI}=W_.constants;_t.vol=new Hl.Volume;function $p(t){let e={F_OK:EI,R_OK:FI,W_OK:TI,X_OK:kI,constants:W_.constants,Stats:bI.default,Dirent:_I.default};for(let r of SI.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of vI.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=Hl.toUnixTimestamp,e.__vol=t,e}l($p,"createFsFromVolume");_t.fs=$p(_t.vol);var RI=l((t={},e="/")=>{let r=Hl.Volume.fromNestedJSON(t,e);return{fs:$p(r),vol:r}},"memfs");_t.memfs=RI;zl.exports={...zl.exports,..._t.fs};zl.exports.semantic=!0});var Vp=T((O9,Jl)=>{function V_(t){return Array.isArray(t)?t:[t]}l(V_,"makeArray");var OI=void 0,Mp="",z_=" ",Bp="\\",xI=/^\s+$/,AI=/(?:[^\\]|^)\\$/,PI=/^\\!/,NI=/^\\#/,DI=/\r?\n/g,CI=/^\.{0,2}\/|^\.{1,2}$/,II=/\/$/,ys="/",G_="node-ignore";typeof Symbol<"u"&&(G_=Symbol.for("node-ignore"));var J_=G_,gs=l((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),$I=/([0-z])-([0-z])/g,K_=l(()=>!1,"RETURN_FALSE"),BI=l(t=>t.replace($I,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Mp),"sanitizeRange"),MI=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),LI=[[/^\uFEFF/,()=>Mp],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?z_:Mp)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+z_}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Bp],[/\\\\/g,()=>Bp],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Bp?`\\[${r}${MI(i)}${n}`:n==="]"&&i.length%2===0?`[${BI(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],jI=/(^|\\\/)?\\\*$/,da="regex",Vl="checkRegex",H_="_",qI={[da](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Vl](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},UI=l(t=>LI.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),Gl=l(t=>typeof t=="string","isString"),WI=l(t=>t&&Gl(t)&&!xI.test(t)&&!AI.test(t)&&t.indexOf("#")!==0,"checkPattern"),zI=l(t=>t.split(DI).filter(Boolean),"splitPattern"),Wp=class Wp{constructor(e,r,i,n,s,o){this.pattern=e,this.mark=r,this.negative=s,gs(this,"body",i),gs(this,"ignoreCase",n),gs(this,"regexPrefix",o)}get regex(){let e=H_+da;return this[e]?this[e]:this._make(da,e)}get checkRegex(){let e=H_+Vl;return this[e]?this[e]:this._make(Vl,e)}_make(e,r){let i=this.regexPrefix.replace(jI,qI[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return gs(this,r,n)}};l(Wp,"IgnoreRule");var Lp=Wp,HI=l(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(PI,"!").replace(NI,"#");let s=UI(n);return new Lp(t,e,n,r,i,s)},"createRule"),zp=class zp{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[J_]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Gl(e)&&(e={pattern:e}),WI(e.pattern)){let r=HI(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,V_(Gl(e)?zI(e):e).forEach(this._add,this),this._added}test(e,r,i){let n=!1,s=!1,o;this._rules.forEach(c=>{let{negative:a}=c;s===a&&n!==s||a&&!n&&!s&&!r||!c[i].test(e)||(n=!a,s=a,o=a?OI:c)});let f={ignored:n,unignored:s};return o&&(f.rule=o),f}};l(zp,"RuleManager");var jp=zp,VI=l((t,e)=>{throw new e(t)},"throwError"),Pr=l((t,e,r)=>Gl(t)?t?Pr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),X_=l(t=>CI.test(t),"isNotRelative");Pr.isNotRelative=X_;Pr.convert=t=>t;var Hp=class Hp{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){gs(this,J_,!0),this._rules=new jp(r),this._strictPathCheck=!i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,i,n){let s=e&&Pr.convert(e);return Pr(s,e,this._strictPathCheck?VI:K_),this._t(s,r,i,n)}checkIgnore(e){if(!II.test(e))return this.test(e);let r=e.split(ys).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(ys)+ys,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,Vl)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(ys).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,da);let s=this._t(n.join(ys)+ys,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,da)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return V_(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(Hp,"Ignore");var qp=Hp,Up=l(t=>new qp(t),"factory"),GI=l(t=>Pr(t&&Pr.convert(t),t,K_),"isPathValid"),Y_=l(()=>{let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");Pr.convert=t;let e=/^[a-z]:\//i;Pr.isNotRelative=r=>e.test(r)||X_(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&Y_();Jl.exports=Up;Up.default=Up;Jl.exports.isPathValid=GI;gs(Jl.exports,Symbol.for("setupWindows"),Y_)});var Q_=T((A9,Z_)=>{"use strict";var St=l(function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||St.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||St.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||St.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=St.DEFAULT_MAX_PENDING},"AsyncLock");St.DEFAULT_TIMEOUT=0;St.DEFAULT_MAX_OCCUPATION_TIME=0;St.DEFAULT_MAX_EXECUTION_TIME=0;St.DEFAULT_MAX_PENDING=1e3;St.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,o=null;typeof r!="function"&&(i=r,r=null,o=new this.Promise(function(_,F){n=_,s=F})),i=i||{};var f=!1,c=null,a=null,u=null,h=this,d=l(function(_,F,E){a&&(clearTimeout(a),a=null),u&&(clearTimeout(u),u=null),_&&(h.queues[t]&&h.queues[t].length===0&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),f||(o?F?s(F):n(E):typeof r=="function"&&r(F,E),f=!0),_&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},"done"),p=l(function(_){if(f)return d(_);c&&(clearTimeout(c),c=null),h.domainReentrant&&_&&(h.domains[t]=process.domain);var F=i.maxExecutionTime||h.maxExecutionTime;if(F&&(u=setTimeout(function(){h.queues[t]&&d(_,new Error("Maximum execution time is exceeded "+t))},F)),e.length===1){var E=!1;try{e(function(R,D){E||(E=!0,d(_,R,D))})}catch(R){E||(E=!0,d(_,R))}}else h._promiseTry(function(){return e()}).then(function(R){d(_,void 0,R)},function(R){d(_,R)})},"exec");h.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=i.maxPending||h.maxPending;if(!h.queues[t])h.queues[t]=[],p(!0);else if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])p(!1);else if(h.queues[t].length>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var w=l(function(){p(!0)},"taskFn");i.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var y=i.timeout||h.timeout;y&&(c=setTimeout(function(){c=null,d(!1,new Error("async-lock timed out in queue "+t))},y))}var b=i.maxOccupationTime||h.maxOccupationTime;if(b&&(a=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},b)),o)return o};St.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=l(function(f,c){return function(a){n.acquire(f,c,a,i)}},"getFn"),o=t.reduceRight(function(f,c){return s(c,f)},e);if(typeof r=="function")o(r);else return new this.Promise(function(f,c){o.length===1?o(function(a,u){a?c(a):f(u)}):f(o())})};St.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};St.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};Z_.exports=St});var tS=T((N9,eS)=>{"use strict";eS.exports=Q_()});var rS=T((D9,Gp)=>{typeof Object.create=="function"?Gp.exports=l(function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):Gp.exports=l(function(e,r){if(r){e.super_=r;var i=l(function(){},"TempCtor");i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}},"inherits")});var iS=T((I9,Kp)=>{try{if(Jp=ie("util"),typeof Jp.inherits!="function")throw"";Kp.exports=Jp.inherits}catch{Kp.exports=rS()}var Jp});var pa=T((Xp,sS)=>{var Kl=ie("buffer"),lr=Kl.Buffer;function nS(t,e){for(var r in t)e[r]=t[r]}l(nS,"copyProps");lr.from&&lr.alloc&&lr.allocUnsafe&&lr.allocUnsafeSlow?sS.exports=Kl:(nS(Kl,Xp),Xp.Buffer=ji);function ji(t,e,r){return lr(t,e,r)}l(ji,"SafeBuffer");ji.prototype=Object.create(lr.prototype);nS(lr,ji);ji.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return lr(t,e,r)};ji.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=lr(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};ji.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return lr(t)};ji.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Kl.SlowBuffer(t)}});var aS=T((B9,oS)=>{var JI={}.toString;oS.exports=Array.isArray||function(t){return JI.call(t)=="[object Array]"}});var bs=T((M9,cS)=>{"use strict";cS.exports=TypeError});var Yp=T((L9,lS)=>{"use strict";lS.exports=Object});var uS=T((j9,fS)=>{"use strict";fS.exports=Error});var dS=T((q9,hS)=>{"use strict";hS.exports=EvalError});var mS=T((U9,pS)=>{"use strict";pS.exports=RangeError});var yS=T((W9,wS)=>{"use strict";wS.exports=ReferenceError});var Zp=T((z9,gS)=>{"use strict";gS.exports=SyntaxError});var _S=T((H9,bS)=>{"use strict";bS.exports=URIError});var vS=T((V9,SS)=>{"use strict";SS.exports=Math.abs});var FS=T((G9,ES)=>{"use strict";ES.exports=Math.floor});var kS=T((J9,TS)=>{"use strict";TS.exports=Math.max});var OS=T((K9,RS)=>{"use strict";RS.exports=Math.min});var AS=T((X9,xS)=>{"use strict";xS.exports=Math.pow});var NS=T((Y9,PS)=>{"use strict";PS.exports=Math.round});var CS=T((Z9,DS)=>{"use strict";DS.exports=Number.isNaN||l(function(e){return e!==e},"isNaN")});var $S=T((eJ,IS)=>{"use strict";var KI=CS();IS.exports=l(function(e){return KI(e)||e===0?e:e<0?-1:1},"sign")});var MS=T((rJ,BS)=>{"use strict";BS.exports=Object.getOwnPropertyDescriptor});var _s=T((iJ,LS)=>{"use strict";var Xl=MS();if(Xl)try{Xl([],"length")}catch{Xl=null}LS.exports=Xl});var ma=T((nJ,jS)=>{"use strict";var Yl=Object.defineProperty||!1;if(Yl)try{Yl({},"a",{value:1})}catch{Yl=!1}jS.exports=Yl});var Qp=T((sJ,qS)=>{"use strict";qS.exports=l(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0},"hasSymbols")});var zS=T((aJ,WS)=>{"use strict";var US=typeof Symbol<"u"&&Symbol,XI=Qp();WS.exports=l(function(){return typeof US!="function"||typeof Symbol!="function"||typeof US("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XI()},"hasNativeSymbols")});var em=T((lJ,HS)=>{"use strict";HS.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var tm=T((fJ,VS)=>{"use strict";var YI=Yp();VS.exports=YI.getPrototypeOf||null});var KS=T((uJ,JS)=>{"use strict";var ZI="Function.prototype.bind called on incompatible ",QI=Object.prototype.toString,e$=Math.max,t$="[object Function]",GS=l(function(e,r){for(var i=[],n=0;n<e.length;n+=1)i[n]=e[n];for(var s=0;s<r.length;s+=1)i[s+e.length]=r[s];return i},"concatty"),r$=l(function(e,r){for(var i=[],n=r||0,s=0;n<e.length;n+=1,s+=1)i[s]=e[n];return i},"slicy"),i$=l(function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},"joiny");JS.exports=l(function(e){var r=this;if(typeof r!="function"||QI.apply(r)!==t$)throw new TypeError(ZI+r);for(var i=r$(arguments,1),n,s=l(function(){if(this instanceof n){var u=r.apply(this,GS(i,arguments));return Object(u)===u?u:this}return r.apply(e,GS(i,arguments))},"binder"),o=e$(0,r.length-i.length),f=[],c=0;c<o;c++)f[c]="$"+c;if(n=Function("binder","return function ("+i$(f,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var a=l(function(){},"Empty");a.prototype=r.prototype,n.prototype=new a,a.prototype=null}return n},"bind")});var Ss=T((dJ,XS)=>{"use strict";var n$=KS();XS.exports=Function.prototype.bind||n$});var Zl=T((pJ,YS)=>{"use strict";YS.exports=Function.prototype.call});var Ql=T((mJ,ZS)=>{"use strict";ZS.exports=Function.prototype.apply});var ev=T((wJ,QS)=>{"use strict";QS.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var rm=T((yJ,tv)=>{"use strict";var s$=Ss(),o$=Ql(),a$=Zl(),c$=ev();tv.exports=c$||s$.call(a$,o$)});var ef=T((gJ,rv)=>{"use strict";var l$=Ss(),f$=bs(),u$=Zl(),h$=rm();rv.exports=l(function(e){if(e.length<1||typeof e[0]!="function")throw new f$("a function is required");return h$(l$,u$,e)},"callBindBasic")});var cv=T((_J,av)=>{"use strict";var d$=ef(),iv=_s(),sv;try{sv=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var im=!!sv&&iv&&iv(Object.prototype,"__proto__"),ov=Object,nv=ov.getPrototypeOf;av.exports=im&&typeof im.get=="function"?d$([im.get]):typeof nv=="function"?l(function(e){return nv(e==null?e:ov(e))},"getDunder"):!1});var nm=T((vJ,hv)=>{"use strict";var lv=em(),fv=tm(),uv=cv();hv.exports=lv?l(function(e){return lv(e)},"getProto"):fv?l(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return fv(e)},"getProto"):uv?l(function(e){return uv(e)},"getProto"):null});var pv=T((FJ,dv)=>{"use strict";var p$=Function.prototype.call,m$=Object.prototype.hasOwnProperty,w$=Ss();dv.exports=w$.call(p$,m$)});var am=T((TJ,_v)=>{"use strict";var K,y$=Yp(),g$=uS(),b$=dS(),_$=mS(),S$=yS(),Ts=Zp(),Fs=bs(),v$=_S(),E$=vS(),F$=FS(),T$=kS(),k$=OS(),R$=AS(),O$=NS(),x$=$S(),gv=Function,sm=l(function(t){try{return gv('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),wa=_s(),A$=ma(),om=l(function(){throw new Fs},"throwTypeError"),P$=wa?function(){try{return arguments.callee,om}catch{try{return wa(arguments,"callee").get}catch{return om}}}():om,vs=zS()(),Le=nm(),N$=tm(),D$=em(),bv=Ql(),ya=Zl(),Es={},C$=typeof Uint8Array>"u"||!Le?K:Le(Uint8Array),qi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?K:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?K:ArrayBuffer,"%ArrayIteratorPrototype%":vs&&Le?Le([][Symbol.iterator]()):K,"%AsyncFromSyncIteratorPrototype%":K,"%AsyncFunction%":Es,"%AsyncGenerator%":Es,"%AsyncGeneratorFunction%":Es,"%AsyncIteratorPrototype%":Es,"%Atomics%":typeof Atomics>"u"?K:Atomics,"%BigInt%":typeof BigInt>"u"?K:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?K:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?K:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?K:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":g$,"%eval%":eval,"%EvalError%":b$,"%Float16Array%":typeof Float16Array>"u"?K:Float16Array,"%Float32Array%":typeof Float32Array>"u"?K:Float32Array,"%Float64Array%":typeof Float64Array>"u"?K:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?K:FinalizationRegistry,"%Function%":gv,"%GeneratorFunction%":Es,"%Int8Array%":typeof Int8Array>"u"?K:Int8Array,"%Int16Array%":typeof Int16Array>"u"?K:Int16Array,"%Int32Array%":typeof Int32Array>"u"?K:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vs&&Le?Le(Le([][Symbol.iterator]())):K,"%JSON%":typeof JSON=="object"?JSON:K,"%Map%":typeof Map>"u"?K:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vs||!Le?K:Le(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":y$,"%Object.getOwnPropertyDescriptor%":wa,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?K:Promise,"%Proxy%":typeof Proxy>"u"?K:Proxy,"%RangeError%":_$,"%ReferenceError%":S$,"%Reflect%":typeof Reflect>"u"?K:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?K:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vs||!Le?K:Le(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?K:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vs&&Le?Le(""[Symbol.iterator]()):K,"%Symbol%":vs?Symbol:K,"%SyntaxError%":Ts,"%ThrowTypeError%":P$,"%TypedArray%":C$,"%TypeError%":Fs,"%Uint8Array%":typeof Uint8Array>"u"?K:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?K:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?K:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?K:Uint32Array,"%URIError%":v$,"%WeakMap%":typeof WeakMap>"u"?K:WeakMap,"%WeakRef%":typeof WeakRef>"u"?K:WeakRef,"%WeakSet%":typeof WeakSet>"u"?K:WeakSet,"%Function.prototype.call%":ya,"%Function.prototype.apply%":bv,"%Object.defineProperty%":A$,"%Object.getPrototypeOf%":N$,"%Math.abs%":E$,"%Math.floor%":F$,"%Math.max%":T$,"%Math.min%":k$,"%Math.pow%":R$,"%Math.round%":O$,"%Math.sign%":x$,"%Reflect.getPrototypeOf%":D$};if(Le)try{null.error}catch(t){mv=Le(Le(t)),qi["%Error.prototype%"]=mv}var mv,I$=l(function t(e){var r;if(e==="%AsyncFunction%")r=sm("async function () {}");else if(e==="%GeneratorFunction%")r=sm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=sm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Le&&(r=Le(n.prototype))}return qi[e]=r,r},"doEval"),wv={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ga=Ss(),tf=pv(),$$=ga.call(ya,Array.prototype.concat),B$=ga.call(bv,Array.prototype.splice),yv=ga.call(ya,String.prototype.replace),rf=ga.call(ya,String.prototype.slice),M$=ga.call(ya,RegExp.prototype.exec),L$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,j$=/\\(\\)?/g,q$=l(function(e){var r=rf(e,0,1),i=rf(e,-1);if(r==="%"&&i!=="%")throw new Ts("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ts("invalid intrinsic syntax, expected opening `%`");var n=[];return yv(e,L$,function(s,o,f,c){n[n.length]=f?yv(c,j$,"$1"):o||s}),n},"stringToPath"),U$=l(function(e,r){var i=e,n;if(tf(wv,i)&&(n=wv[i],i="%"+n[0]+"%"),tf(qi,i)){var s=qi[i];if(s===Es&&(s=I$(i)),typeof s>"u"&&!r)throw new Fs("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Ts("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");_v.exports=l(function(e,r){if(typeof e!="string"||e.length===0)throw new Fs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Fs('"allowMissing" argument must be a boolean');if(M$(/^%?[^%]*%?$/,e)===null)throw new Ts("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=q$(e),n=i.length>0?i[0]:"",s=U$("%"+n+"%",r),o=s.name,f=s.value,c=!1,a=s.alias;a&&(n=a[0],B$(i,$$([0,1],a)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],p=rf(d,0,1),m=rf(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Ts("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(c=!0),n+="."+d,o="%"+n+"%",tf(qi,o))f=qi[o];else if(f!=null){if(!(d in f)){if(!r)throw new Fs("base intrinsic for "+e+" exists, but the property is not available.");return}if(wa&&u+1>=i.length){var w=wa(f,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?f=w.get:f=f[d]}else h=tf(f,d),f=f[d];h&&!c&&(qi[o]=f)}}return f},"GetIntrinsic")});var cm=T((RJ,Ev)=>{"use strict";var Sv=am(),vv=ef(),W$=vv([Sv("%String.prototype.indexOf%")]);Ev.exports=l(function(e,r){var i=Sv(e,!!r);return typeof i=="function"&&W$(e,".prototype.")>-1?vv([i]):i},"callBoundIntrinsic")});var Rv=T((xJ,kv)=>{"use strict";var Tv=Function.prototype.toString,ks=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,fm,nf;if(typeof ks=="function"&&typeof Object.defineProperty=="function")try{fm=Object.defineProperty({},"length",{get:l(function(){throw nf},"get")}),nf={},ks(function(){throw 42},null,fm)}catch(t){t!==nf&&(ks=null)}else ks=null;var z$=/^\s*class\b/,um=l(function(e){try{var r=Tv.call(e);return z$.test(r)}catch{return!1}},"isES6ClassFunction"),lm=l(function(e){try{return um(e)?!1:(Tv.call(e),!0)}catch{return!1}},"tryFunctionToStr"),sf=Object.prototype.toString,H$="[object Object]",V$="[object Function]",G$="[object GeneratorFunction]",J$="[object HTMLAllCollection]",K$="[object HTML document.all class]",X$="[object HTMLCollection]",Y$=typeof Symbol=="function"&&!!Symbol.toStringTag,Z$=!(0 in[,]),hm=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Fv=document.all,sf.call(Fv)===sf.call(document.all)&&(hm=l(function(e){if((Z$||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=sf.call(e);return(r===J$||r===K$||r===X$||r===H$)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Fv;kv.exports=l(ks?function(e){if(hm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ks(e,null,fm)}catch(r){if(r!==nf)return!1}return!um(e)&&lm(e)}:function(e){if(hm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Y$)return lm(e);if(um(e))return!1;var r=sf.call(e);return r!==V$&&r!==G$&&!/^\[object HTML/.test(r)?!1:lm(e)},"isCallable")});var Av=T((PJ,xv)=>{"use strict";var Q$=Rv(),e2=Object.prototype.toString,Ov=Object.prototype.hasOwnProperty,t2=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)Ov.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),r2=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)i==null?r(e.charAt(n),n,e):r.call(i,e.charAt(n),n,e)},"forEachString"),i2=l(function(e,r,i){for(var n in e)Ov.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function n2(t){return e2.call(t)==="[object Array]"}l(n2,"isArray");xv.exports=l(function(e,r,i){if(!Q$(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),n2(e)?t2(e,r,n):typeof e=="string"?r2(e,r,n):i2(e,r,n)},"forEach")});var Nv=T((DJ,Pv)=>{"use strict";Pv.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Cv=T((CJ,Dv)=>{"use strict";var dm=Nv(),s2=globalThis;Dv.exports=l(function(){for(var e=[],r=0;r<dm.length;r++)typeof s2[dm[r]]=="function"&&(e[e.length]=dm[r]);return e},"availableTypedArrays")});var Mv=T(($J,Bv)=>{"use strict";var Iv=ma(),o2=Zp(),Rs=bs(),$v=_s();Bv.exports=l(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Rs("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Rs("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Rs("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Rs("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Rs("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Rs("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,c=!!$v&&$v(e,r);if(Iv)Iv(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:n===null&&c?c.enumerable:!n,value:i,writable:s===null&&c?c.writable:!s});else if(f||!n&&!s&&!o)e[r]=i;else throw new o2("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var qv=T((MJ,jv)=>{"use strict";var pm=ma(),Lv=l(function(){return!!pm},"hasPropertyDescriptors");Lv.hasArrayLengthDefineBug=l(function(){if(!pm)return null;try{return pm([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");jv.exports=Lv});var Vv=T((jJ,Hv)=>{"use strict";var a2=am(),Uv=Mv(),c2=qv()(),Wv=_s(),zv=bs(),l2=a2("%Math.floor%");Hv.exports=l(function(e,r){if(typeof e!="function")throw new zv("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||l2(r)!==r)throw new zv("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&Wv){var o=Wv(e,"length");o&&!o.configurable&&(n=!1),o&&!o.writable&&(s=!1)}return(n||s||!i)&&(c2?Uv(e,"length",r,!0,!0):Uv(e,"length",r)),e},"setFunctionLength")});var Jv=T((UJ,Gv)=>{"use strict";var f2=Ss(),u2=Ql(),h2=rm();Gv.exports=l(function(){return h2(f2,u2,arguments)},"applyBind")});var Yv=T((zJ,of)=>{"use strict";var d2=Vv(),Kv=ma(),p2=ef(),Xv=Jv();of.exports=l(function(e){var r=p2(arguments),i=e.length-(arguments.length-1);return d2(r,1+(i>0?i:0),!0)},"callBind");Kv?Kv(of.exports,"apply",{value:Xv}):of.exports.apply=Xv});var Qv=T((VJ,Zv)=>{"use strict";var m2=Qp();Zv.exports=l(function(){return m2()&&!!Symbol.toStringTag},"hasToStringTagShams")});var nE=T((JJ,iE)=>{"use strict";var lf=Av(),w2=Cv(),eE=Yv(),wm=cm(),cf=_s(),af=nm(),y2=wm("Object.prototype.toString"),rE=Qv()(),tE=globalThis,mm=w2(),ym=wm("String.prototype.slice"),g2=wm("Array.prototype.indexOf",!0)||l(function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},"indexOf"),ff={__proto__:null};rE&&cf&&af?lf(mm,function(t){var e=new tE[t];if(Symbol.toStringTag in e&&af){var r=af(e),i=cf(r,Symbol.toStringTag);if(!i&&r){var n=af(r);i=cf(n,Symbol.toStringTag)}ff["$"+t]=eE(i.get)}}):lf(mm,function(t){var e=new tE[t],r=e.slice||e.set;r&&(ff["$"+t]=eE(r))});var b2=l(function(e){var r=!1;return lf(ff,function(i,n){if(!r)try{"$"+i(e)===n&&(r=ym(n,1))}catch{}}),r},"tryAllTypedArrays"),_2=l(function(e){var r=!1;return lf(ff,function(i,n){if(!r)try{i(e),r=ym(n,1)}catch{}}),r},"tryAllSlices");iE.exports=l(function(e){if(!e||typeof e!="object")return!1;if(!rE){var r=ym(y2(e),8,-1);return g2(mm,r)>-1?r:r!=="Object"?!1:_2(e)}return cf?b2(e):null},"whichTypedArray")});var oE=T((XJ,sE)=>{"use strict";var S2=nE();sE.exports=l(function(e){return!!S2(e)},"isTypedArray")});var cE=T((ZJ,aE)=>{"use strict";var v2=bs(),E2=cm(),F2=E2("TypedArray.prototype.buffer",!0),T2=oE();aE.exports=F2||l(function(e){if(!T2(e))throw new v2("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var uE=T((eK,fE)=>{"use strict";var Jt=pa().Buffer,k2=aS(),R2=cE(),O2=ArrayBuffer.isView||l(function(e){try{return R2(e),!0}catch{return!1}},"isView"),x2=typeof Uint8Array<"u",lE=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",A2=lE&&(Jt.prototype instanceof Uint8Array||Jt.TYPED_ARRAY_SUPPORT);fE.exports=l(function(e,r){if(Jt.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Jt.from(e):e;if(typeof e=="string")return Jt.from(e,r);if(lE&&O2(e)){if(e.byteLength===0)return Jt.alloc(0);if(A2){var i=Jt.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Jt.from(n);if(s.length===e.byteLength)return s}if(x2&&e instanceof Uint8Array)return Jt.from(e);var o=k2(e);if(o)for(var f=0;f<e.length;f+=1){var c=e[f];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||Jt.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Jt.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")});var dE=T((rK,hE)=>{"use strict";var P2=pa().Buffer,N2=uE();function uf(t,e){this._block=P2.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}l(uf,"Hash");uf.prototype.update=function(t,e){t=N2(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,o=0;o<n;){for(var f=s%i,c=Math.min(n-o,i-f),a=0;a<c;a++)r[f+a]=t[o+a];s+=c,o+=c,s%i===0&&this._update(r)}return this._len+=n,this};uf.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};uf.prototype._update=function(){throw new Error("_update must be implemented by subclass")};hE.exports=uf});var wE=T((nK,mE)=>{"use strict";var D2=iS(),pE=dE(),C2=pa().Buffer,I2=[1518500249,1859775393,-1894007588,-899497514],$2=new Array(80);function ba(){this.init(),this._w=$2,pE.call(this,64,56)}l(ba,"Sha1");D2(ba,pE);ba.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function B2(t){return t<<1|t>>>31}l(B2,"rotl1");function M2(t){return t<<5|t>>>27}l(M2,"rotl5");function L2(t){return t<<30|t>>>2}l(L2,"rotl30");function j2(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}l(j2,"ft");ba.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,o=this._e|0,f=0;f<16;++f)e[f]=t.readInt32BE(f*4);for(;f<80;++f)e[f]=B2(e[f-3]^e[f-8]^e[f-14]^e[f-16]);for(var c=0;c<80;++c){var a=~~(c/20),u=M2(r)+j2(a,i,n,s)+o+e[c]+I2[a]|0;o=s,s=n,n=L2(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};ba.prototype._hash=function(){var t=C2.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};mE.exports=ba});var gE=T(gm=>{var yE;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof gm=="object"?t(gm):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(yE={}):t(yE={})})(function(t){t.version="1.2.2";function e(){for(var S=0,O=new Array(256),v=0;v!=256;++v)S=v,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,O[v]=S;return typeof Int32Array<"u"?new Int32Array(O):O}l(e,"signed_crc_table");var r=e();function i(S){var O=0,v=0,A=0,x=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(A=0;A!=256;++A)x[A]=S[A];for(A=0;A!=256;++A)for(v=S[A],O=256+A;O<4096;O+=256)v=x[O]=v>>>8^S[v&255];var I=[];for(A=1;A!=16;++A)I[A-1]=typeof Int32Array<"u"?x.subarray(A*256,A*256+256):x.slice(A*256,A*256+256);return I}l(i,"slice_by_16_tables");var n=i(r),s=n[0],o=n[1],f=n[2],c=n[3],a=n[4],u=n[5],h=n[6],d=n[7],p=n[8],m=n[9],w=n[10],y=n[11],b=n[12],_=n[13],F=n[14];function E(S,O){for(var v=O^-1,A=0,x=S.length;A<x;)v=v>>>8^r[(v^S.charCodeAt(A++))&255];return~v}l(E,"crc32_bstr");function R(S,O){for(var v=O^-1,A=S.length-15,x=0;x<A;)v=F[S[x++]^v&255]^_[S[x++]^v>>8&255]^b[S[x++]^v>>16&255]^y[S[x++]^v>>>24]^w[S[x++]]^m[S[x++]]^p[S[x++]]^d[S[x++]]^h[S[x++]]^u[S[x++]]^a[S[x++]]^c[S[x++]]^f[S[x++]]^o[S[x++]]^s[S[x++]]^r[S[x++]];for(A+=15;x<A;)v=v>>>8^r[(v^S[x++])&255];return~v}l(R,"crc32_buf");function D(S,O){for(var v=O^-1,A=0,x=S.length,I=0,M=0;A<x;)I=S.charCodeAt(A++),I<128?v=v>>>8^r[(v^I)&255]:I<2048?(v=v>>>8^r[(v^(192|I>>6&31))&255],v=v>>>8^r[(v^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,M=S.charCodeAt(A++)&1023,v=v>>>8^r[(v^(240|I>>8&7))&255],v=v>>>8^r[(v^(128|I>>2&63))&255],v=v>>>8^r[(v^(128|M>>6&15|(I&3)<<4))&255],v=v>>>8^r[(v^(128|M&63))&255]):(v=v>>>8^r[(v^(224|I>>12&15))&255],v=v>>>8^r[(v^(128|I>>6&63))&255],v=v>>>8^r[(v^(128|I&63))&255]);return~v}l(D,"crc32_str"),t.table=r,t.bstr=E,t.buf=R,t.str=D})});var Nr=T(nt=>{"use strict";var q2=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function U2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}l(U2,"_has");nt.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)U2(r,i)&&(t[i]=r[i])}}return t};nt.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var W2={arraySet:l(function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){var e,r,i,n,s,o;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(o=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,n),n+=s.length;return o},"flattenChunks")},z2={arraySet:l(function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){return[].concat.apply([],t)},"flattenChunks")};nt.setTyped=function(t){t?(nt.Buf8=Uint8Array,nt.Buf16=Uint16Array,nt.Buf32=Int32Array,nt.assign(nt,W2)):(nt.Buf8=Array,nt.Buf16=Array,nt.Buf32=Array,nt.assign(nt,z2))};nt.setTyped(q2)});var qE=T(As=>{"use strict";var H2=Nr(),V2=4,bE=0,_E=1,G2=2;function xs(t){for(var e=t.length;--e>=0;)t[e]=0}l(xs,"zero");var J2=0,kE=1,K2=2,X2=3,Y2=258,Tm=29,Ta=256,Sa=Ta+1+Tm,Os=30,km=19,RE=2*Sa+1,Ui=15,bm=16,Z2=7,Rm=256,OE=16,xE=17,AE=18,Em=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],hf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Q2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],PE=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],eB=512,Dr=new Array((Sa+2)*2);xs(Dr);var _a=new Array(Os*2);xs(_a);var va=new Array(eB);xs(va);var Ea=new Array(Y2-X2+1);xs(Ea);var Om=new Array(Tm);xs(Om);var df=new Array(Os);xs(df);function _m(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}l(_m,"StaticTreeDesc");var NE,DE,CE;function Sm(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}l(Sm,"TreeDesc");function IE(t){return t<256?va[t]:va[256+(t>>>7)]}l(IE,"d_code");function Fa(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}l(Fa,"put_short");function ut(t,e,r){t.bi_valid>bm-r?(t.bi_buf|=e<<t.bi_valid&65535,Fa(t,t.bi_buf),t.bi_buf=e>>bm-t.bi_valid,t.bi_valid+=r-bm):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}l(ut,"send_bits");function fr(t,e,r){ut(t,r[e*2],r[e*2+1])}l(fr,"send_code");function $E(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}l($E,"bi_reverse");function tB(t){t.bi_valid===16?(Fa(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}l(tB,"bi_flush");function rB(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,a,u,h,d,p,m,w=0;for(d=0;d<=Ui;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,a=t.heap_max+1;a<RE;a++)u=t.heap[a],d=r[r[u*2+1]*2+1]+1,d>c&&(d=c,w++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,p=0,u>=f&&(p=o[u-f]),m=r[u*2],t.opt_len+=m*(d+p),s&&(t.static_len+=m*(n[u*2+1]+p)));if(w!==0){do{for(d=c-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[c]--,w-=2}while(w>0);for(d=c;d!==0;d--)for(u=t.bl_count[d];u!==0;)h=t.heap[--a],!(h>i)&&(r[h*2+1]!==d&&(t.opt_len+=(d-r[h*2+1])*r[h*2],r[h*2+1]=d),u--)}}l(rB,"gen_bitlen");function BE(t,e,r){var i=new Array(Ui+1),n=0,s,o;for(s=1;s<=Ui;s++)i[s]=n=n+r[s-1]<<1;for(o=0;o<=e;o++){var f=t[o*2+1];f!==0&&(t[o*2]=$E(i[f]++,f))}}l(BE,"gen_codes");function iB(){var t,e,r,i,n,s=new Array(Ui+1);for(r=0,i=0;i<Tm-1;i++)for(Om[i]=r,t=0;t<1<<Em[i];t++)Ea[r++]=i;for(Ea[r-1]=i,n=0,i=0;i<16;i++)for(df[i]=n,t=0;t<1<<hf[i];t++)va[n++]=i;for(n>>=7;i<Os;i++)for(df[i]=n<<7,t=0;t<1<<hf[i]-7;t++)va[256+n++]=i;for(e=0;e<=Ui;e++)s[e]=0;for(t=0;t<=143;)Dr[t*2+1]=8,t++,s[8]++;for(;t<=255;)Dr[t*2+1]=9,t++,s[9]++;for(;t<=279;)Dr[t*2+1]=7,t++,s[7]++;for(;t<=287;)Dr[t*2+1]=8,t++,s[8]++;for(BE(Dr,Sa+1,s),t=0;t<Os;t++)_a[t*2+1]=5,_a[t*2]=$E(t,5);NE=new _m(Dr,Em,Ta+1,Sa,Ui),DE=new _m(_a,hf,0,Os,Ui),CE=new _m(new Array(0),Q2,0,km,Z2)}l(iB,"tr_static_init");function ME(t){var e;for(e=0;e<Sa;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Os;e++)t.dyn_dtree[e*2]=0;for(e=0;e<km;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Rm*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}l(ME,"init_block");function LE(t){t.bi_valid>8?Fa(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}l(LE,"bi_windup");function nB(t,e,r,i){LE(t),i&&(Fa(t,r),Fa(t,~r)),H2.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}l(nB,"copy_block");function SE(t,e,r,i){var n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}l(SE,"smaller");function vm(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&SE(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!SE(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}l(vm,"pqdownheap");function vE(t,e,r){var i,n,s=0,o,f;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],n=t.pending_buf[t.l_buf+s],s++,i===0?fr(t,n,e):(o=Ea[n],fr(t,o+Ta+1,e),f=Em[o],f!==0&&(n-=Om[o],ut(t,n,f)),i--,o=IE(i),fr(t,o,r),f=hf[o],f!==0&&(i-=df[o],ut(t,i,f)));while(s<t.last_lit);fr(t,Rm,e)}l(vE,"compress_block");function Fm(t,e){var r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,o,f,c=-1,a;for(t.heap_len=0,t.heap_max=RE,o=0;o<s;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)a=t.heap[++t.heap_len]=c<2?++c:0,r[a*2]=1,t.depth[a]=0,t.opt_len--,n&&(t.static_len-=i[a*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)vm(t,r,o);a=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],vm(t,r,1),f=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=f,r[a*2]=r[o*2]+r[f*2],t.depth[a]=(t.depth[o]>=t.depth[f]?t.depth[o]:t.depth[f])+1,r[o*2+1]=r[f*2+1]=a,t.heap[1]=a++,vm(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],rB(t,e),BE(r,c,t.bl_count)}l(Fm,"build_tree");function EE(t,e,r){var i,n=-1,s,o=e[0*2+1],f=0,c=7,a=4;for(o===0&&(c=138,a=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=o,o=e[(i+1)*2+1],!(++f<c&&s===o)&&(f<a?t.bl_tree[s*2]+=f:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[OE*2]++):f<=10?t.bl_tree[xE*2]++:t.bl_tree[AE*2]++,f=0,n=s,o===0?(c=138,a=3):s===o?(c=6,a=3):(c=7,a=4))}l(EE,"scan_tree");function FE(t,e,r){var i,n=-1,s,o=e[0*2+1],f=0,c=7,a=4;for(o===0&&(c=138,a=3),i=0;i<=r;i++)if(s=o,o=e[(i+1)*2+1],!(++f<c&&s===o)){if(f<a)do fr(t,s,t.bl_tree);while(--f!==0);else s!==0?(s!==n&&(fr(t,s,t.bl_tree),f--),fr(t,OE,t.bl_tree),ut(t,f-3,2)):f<=10?(fr(t,xE,t.bl_tree),ut(t,f-3,3)):(fr(t,AE,t.bl_tree),ut(t,f-11,7));f=0,n=s,o===0?(c=138,a=3):s===o?(c=6,a=3):(c=7,a=4)}}l(FE,"send_tree");function sB(t){var e;for(EE(t,t.dyn_ltree,t.l_desc.max_code),EE(t,t.dyn_dtree,t.d_desc.max_code),Fm(t,t.bl_desc),e=km-1;e>=3&&t.bl_tree[PE[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}l(sB,"build_bl_tree");function oB(t,e,r,i){var n;for(ut(t,e-257,5),ut(t,r-1,5),ut(t,i-4,4),n=0;n<i;n++)ut(t,t.bl_tree[PE[n]*2+1],3);FE(t,t.dyn_ltree,e-1),FE(t,t.dyn_dtree,r-1)}l(oB,"send_all_trees");function aB(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return bE;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return _E;for(r=32;r<Ta;r++)if(t.dyn_ltree[r*2]!==0)return _E;return bE}l(aB,"detect_data_type");var TE=!1;function cB(t){TE||(iB(),TE=!0),t.l_desc=new Sm(t.dyn_ltree,NE),t.d_desc=new Sm(t.dyn_dtree,DE),t.bl_desc=new Sm(t.bl_tree,CE),t.bi_buf=0,t.bi_valid=0,ME(t)}l(cB,"_tr_init");function jE(t,e,r,i){ut(t,(J2<<1)+(i?1:0),3),nB(t,e,r,!0)}l(jE,"_tr_stored_block");function lB(t){ut(t,kE<<1,3),fr(t,Rm,Dr),tB(t)}l(lB,"_tr_align");function fB(t,e,r,i){var n,s,o=0;t.level>0?(t.strm.data_type===G2&&(t.strm.data_type=aB(t)),Fm(t,t.l_desc),Fm(t,t.d_desc),o=sB(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?jE(t,e,r,i):t.strategy===V2||s===n?(ut(t,(kE<<1)+(i?1:0),3),vE(t,Dr,_a)):(ut(t,(K2<<1)+(i?1:0),3),oB(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),vE(t,t.dyn_ltree,t.dyn_dtree)),ME(t),i&&LE(t)}l(fB,"_tr_flush_block");function uB(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Ea[r]+Ta+1)*2]++,t.dyn_dtree[IE(e)*2]++),t.last_lit===t.lit_bufsize-1}l(uB,"_tr_tally");As._tr_init=cB;As._tr_stored_block=jE;As._tr_flush_block=fB;As._tr_tally=uB;As._tr_align=lB});var xm=T((hK,UE)=>{"use strict";function hB(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+e[i++]|0,s=s+n|0;while(--o);n%=65521,s%=65521}return n|s<<16|0}l(hB,"adler32");UE.exports=hB});var Am=T((pK,WE)=>{"use strict";function dB(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}l(dB,"makeTable");var pB=dB();function mB(t,e,r,i){var n=pB,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[(t^e[o])&255];return t^-1}l(mB,"crc32");WE.exports=mB});var pf=T((wK,zE)=>{"use strict";zE.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var QE=T(dr=>{"use strict";var st=Nr(),Dt=qE(),JE=xm(),Qr=Am(),wB=pf(),Vi=0,yB=1,gB=3,ni=4,HE=5,hr=0,VE=1,Ct=-2,bB=-3,Pm=-5,_B=-1,SB=1,mf=2,vB=3,EB=4,FB=0,TB=2,bf=8,kB=9,RB=15,OB=8,xB=29,AB=256,Dm=AB+1+xB,PB=30,NB=19,DB=2*Dm+1,CB=15,Z=3,ri=258,Kt=ri+Z+1,IB=32,_f=42,Cm=69,wf=73,yf=91,gf=103,Wi=113,Ra=666,De=1,Oa=2,zi=3,Ds=4,$B=3;function ii(t,e){return t.msg=wB[e],e}l(ii,"err");function GE(t){return(t<<1)-(t>4?9:0)}l(GE,"rank");function ti(t){for(var e=t.length;--e>=0;)t[e]=0}l(ti,"zero");function ei(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(st.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}l(ei,"flush_pending");function ze(t,e){Dt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ei(t.strm)}l(ze,"flush_block_only");function se(t,e){t.pending_buf[t.pending++]=e}l(se,"put_byte");function ka(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}l(ka,"putShortMSB");function BB(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,st.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=JE(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Qr(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}l(BB,"read_buf");function KE(t,e){var r=t.max_chain_length,i=t.strstart,n,s,o=t.prev_length,f=t.nice_match,c=t.strstart>t.w_size-Kt?t.strstart-(t.w_size-Kt):0,a=t.window,u=t.w_mask,h=t.prev,d=t.strstart+ri,p=a[i+o-1],m=a[i+o];t.prev_length>=t.good_match&&(r>>=2),f>t.lookahead&&(f=t.lookahead);do if(n=e,!(a[n+o]!==m||a[n+o-1]!==p||a[n]!==a[i]||a[++n]!==a[i+1])){i+=2,n++;do;while(a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&a[++i]===a[++n]&&i<d);if(s=ri-(d-i),i=d-ri,s>o){if(t.match_start=e,o=s,s>=f)break;p=a[i+o-1],m=a[i+o]}}while((e=h[e&u])>c&&--r!==0);return o<=t.lookahead?o:t.lookahead}l(KE,"longest_match");function Hi(t){var e=t.w_size,r,i,n,s,o;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Kt)){st.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=BB(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Z)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+Z-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<Z)););}while(t.lookahead<Kt&&t.strm.avail_in!==0)}l(Hi,"fill_window");function MB(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Hi(t),t.lookahead===0&&e===Vi)return De;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,ze(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Kt&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):(t.strstart>t.block_start&&(ze(t,!1),t.strm.avail_out===0),De)}l(MB,"deflate_stored");function Nm(t,e){for(var r,i;;){if(t.lookahead<Kt){if(Hi(t),t.lookahead<Kt&&e===Vi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-Kt&&(t.match_length=KE(t,r)),t.match_length>=Z)if(i=Dt._tr_tally(t,t.strstart-t.match_start,t.match_length-Z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Z){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=t.strstart<Z-1?t.strstart:Z-1,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(Nm,"deflate_fast");function Ps(t,e){for(var r,i,n;;){if(t.lookahead<Kt){if(Hi(t),t.lookahead<Kt&&e===Vi)return De;if(t.lookahead===0)break}if(r=0,t.lookahead>=Z&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Z-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Kt&&(t.match_length=KE(t,r),t.match_length<=5&&(t.strategy===SB||t.match_length===Z&&t.strstart-t.match_start>4096)&&(t.match_length=Z-1)),t.prev_length>=Z&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Z,i=Dt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Z),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Z-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Z-1,t.strstart++,i&&(ze(t,!1),t.strm.avail_out===0))return De}else if(t.match_available){if(i=Dt._tr_tally(t,0,t.window[t.strstart-1]),i&&ze(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return De}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Dt._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Z-1?t.strstart:Z-1,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(Ps,"deflate_slow");function LB(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=ri){if(Hi(t),t.lookahead<=ri&&e===Vi)return De;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Z&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){s=t.strstart+ri;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<s);t.match_length=ri-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Z?(r=Dt._tr_tally(t,1,t.match_length-Z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(LB,"deflate_rle");function jB(t,e){for(var r;;){if(t.lookahead===0&&(Hi(t),t.lookahead===0)){if(e===Vi)return De;break}if(t.match_length=0,r=Dt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(ze(t,!1),t.strm.avail_out===0))return De}return t.insert=0,e===ni?(ze(t,!0),t.strm.avail_out===0?zi:Ds):t.last_lit&&(ze(t,!1),t.strm.avail_out===0)?De:Oa}l(jB,"deflate_huff");function ur(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}l(ur,"Config");var Ns;Ns=[new ur(0,0,0,0,MB),new ur(4,4,8,4,Nm),new ur(4,5,16,8,Nm),new ur(4,6,32,32,Nm),new ur(4,4,16,16,Ps),new ur(8,16,32,32,Ps),new ur(8,16,128,128,Ps),new ur(8,32,128,256,Ps),new ur(32,128,258,1024,Ps),new ur(32,258,258,4096,Ps)];function qB(t){t.window_size=2*t.w_size,ti(t.head),t.max_lazy_match=Ns[t.level].max_lazy,t.good_match=Ns[t.level].good_length,t.nice_match=Ns[t.level].nice_length,t.max_chain_length=Ns[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Z-1,t.match_available=0,t.ins_h=0}l(qB,"lm_init");function UB(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bf,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new st.Buf16(DB*2),this.dyn_dtree=new st.Buf16((2*PB+1)*2),this.bl_tree=new st.Buf16((2*NB+1)*2),ti(this.dyn_ltree),ti(this.dyn_dtree),ti(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new st.Buf16(CB+1),this.heap=new st.Buf16(2*Dm+1),ti(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new st.Buf16(2*Dm+1),ti(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}l(UB,"DeflateState");function XE(t){var e;return!t||!t.state?ii(t,Ct):(t.total_in=t.total_out=0,t.data_type=TB,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?_f:Wi,t.adler=e.wrap===2?0:1,e.last_flush=Vi,Dt._tr_init(e),hr)}l(XE,"deflateResetKeep");function YE(t){var e=XE(t);return e===hr&&qB(t.state),e}l(YE,"deflateReset");function WB(t,e){return!t||!t.state||t.state.wrap!==2?Ct:(t.state.gzhead=e,hr)}l(WB,"deflateSetHeader");function ZE(t,e,r,i,n,s){if(!t)return Ct;var o=1;if(e===_B&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>kB||r!==bf||i<8||i>15||e<0||e>9||s<0||s>EB)return ii(t,Ct);i===8&&(i=9);var f=new UB;return t.state=f,f.strm=t,f.wrap=o,f.gzhead=null,f.w_bits=i,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=n+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+Z-1)/Z),f.window=new st.Buf8(f.w_size*2),f.head=new st.Buf16(f.hash_size),f.prev=new st.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new st.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=e,f.strategy=s,f.method=r,YE(t)}l(ZE,"deflateInit2");function zB(t,e){return ZE(t,e,bf,RB,OB,FB)}l(zB,"deflateInit");function HB(t,e){var r,i,n,s;if(!t||!t.state||e>HE||e<0)return t?ii(t,Ct):Ct;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Ra&&e!==ni)return ii(t,t.avail_out===0?Pm:Ct);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===_f)if(i.wrap===2)t.adler=0,se(i,31),se(i,139),se(i,8),i.gzhead?(se(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),se(i,i.gzhead.time&255),se(i,i.gzhead.time>>8&255),se(i,i.gzhead.time>>16&255),se(i,i.gzhead.time>>24&255),se(i,i.level===9?2:i.strategy>=mf||i.level<2?4:0),se(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(se(i,i.gzhead.extra.length&255),se(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Qr(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Cm):(se(i,0),se(i,0),se(i,0),se(i,0),se(i,0),se(i,i.level===9?2:i.strategy>=mf||i.level<2?4:0),se(i,$B),i.status=Wi);else{var o=bf+(i.w_bits-8<<4)<<8,f=-1;i.strategy>=mf||i.level<2?f=0:i.level<6?f=1:i.level===6?f=2:f=3,o|=f<<6,i.strstart!==0&&(o|=IB),o+=31-o%31,i.status=Wi,ka(i,o),i.strstart!==0&&(ka(i,t.adler>>>16),ka(i,t.adler&65535)),t.adler=1}if(i.status===Cm)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(t),n=i.pending,i.pending===i.pending_buf_size));)se(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=wf)}else i.status=wf;if(i.status===wf)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.name.length?s=i.gzhead.name.charCodeAt(i.gzindex++)&255:s=0,se(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=yf)}else i.status=yf;if(i.status===yf)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),ei(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.comment.length?s=i.gzhead.comment.charCodeAt(i.gzindex++)&255:s=0,se(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Qr(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=gf)}else i.status=gf;if(i.status===gf&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ei(t),i.pending+2<=i.pending_buf_size&&(se(i,t.adler&255),se(i,t.adler>>8&255),t.adler=0,i.status=Wi)):i.status=Wi),i.pending!==0){if(ei(t),t.avail_out===0)return i.last_flush=-1,hr}else if(t.avail_in===0&&GE(e)<=GE(r)&&e!==ni)return ii(t,Pm);if(i.status===Ra&&t.avail_in!==0)return ii(t,Pm);if(t.avail_in!==0||i.lookahead!==0||e!==Vi&&i.status!==Ra){var c=i.strategy===mf?jB(i,e):i.strategy===vB?LB(i,e):Ns[i.level].func(i,e);if((c===zi||c===Ds)&&(i.status=Ra),c===De||c===zi)return t.avail_out===0&&(i.last_flush=-1),hr;if(c===Oa&&(e===yB?Dt._tr_align(i):e!==HE&&(Dt._tr_stored_block(i,0,0,!1),e===gB&&(ti(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),ei(t),t.avail_out===0))return i.last_flush=-1,hr}return e!==ni?hr:i.wrap<=0?VE:(i.wrap===2?(se(i,t.adler&255),se(i,t.adler>>8&255),se(i,t.adler>>16&255),se(i,t.adler>>24&255),se(i,t.total_in&255),se(i,t.total_in>>8&255),se(i,t.total_in>>16&255),se(i,t.total_in>>24&255)):(ka(i,t.adler>>>16),ka(i,t.adler&65535)),ei(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?hr:VE)}l(HB,"deflate");function VB(t){var e;return!t||!t.state?Ct:(e=t.state.status,e!==_f&&e!==Cm&&e!==wf&&e!==yf&&e!==gf&&e!==Wi&&e!==Ra?ii(t,Ct):(t.state=null,e===Wi?ii(t,bB):hr))}l(VB,"deflateEnd");function GB(t,e){var r=e.length,i,n,s,o,f,c,a,u;if(!t||!t.state||(i=t.state,o=i.wrap,o===2||o===1&&i.status!==_f||i.lookahead))return Ct;for(o===1&&(t.adler=JE(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(o===0&&(ti(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new st.Buf8(i.w_size),st.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),f=t.avail_in,c=t.next_in,a=t.input,t.avail_in=r,t.next_in=0,t.input=e,Hi(i);i.lookahead>=Z;){n=i.strstart,s=i.lookahead-(Z-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Z-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=Z-1,Hi(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Z-1,i.match_available=0,t.next_in=c,t.input=a,t.avail_in=f,i.wrap=o,hr}l(GB,"deflateSetDictionary");dr.deflateInit=zB;dr.deflateInit2=ZE;dr.deflateReset=YE;dr.deflateResetKeep=XE;dr.deflateSetHeader=WB;dr.deflate=HB;dr.deflateEnd=VB;dr.deflateSetDictionary=GB;dr.deflateInfo="pako deflate (from Nodeca project)"});var Im=T(Cs=>{"use strict";var Sf=Nr(),eF=!0,tF=!0;try{String.fromCharCode.apply(null,[0])}catch{eF=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{tF=!1}var xa=new Sf.Buf8(256);for(Cr=0;Cr<256;Cr++)xa[Cr]=Cr>=252?6:Cr>=248?5:Cr>=240?4:Cr>=224?3:Cr>=192?2:1;var Cr;xa[254]=xa[254]=1;Cs.string2buf=function(t){var e,r,i,n,s,o=t.length,f=0;for(n=0;n<o;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Sf.Buf8(f),s=0,n=0;s<f;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function rF(t,e){if(e<65534&&(t.subarray&&tF||!t.subarray&&eF))return String.fromCharCode.apply(null,Sf.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}l(rF,"buf2binstring");Cs.buf2binstring=function(t){return rF(t,t.length)};Cs.binstring2buf=function(t){for(var e=new Sf.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Cs.buf2string=function(t,e){var r,i,n,s,o=e||t.length,f=new Array(o*2);for(i=0,r=0;r<o;){if(n=t[r++],n<128){f[i++]=n;continue}if(s=xa[n],s>4){f[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r<o;)n=n<<6|t[r++]&63,s--;if(s>1){f[i++]=65533;continue}n<65536?f[i++]=n:(n-=65536,f[i++]=55296|n>>10&1023,f[i++]=56320|n&1023)}return rF(f,i)};Cs.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+xa[t[r]]>e?r:e}});var $m=T((SK,iF)=>{"use strict";function JB(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}l(JB,"ZStream");iF.exports=JB});var aF=T(Na=>{"use strict";var Aa=QE(),Pa=Nr(),Mm=Im(),Lm=pf(),KB=$m(),oF=Object.prototype.toString,XB=0,Bm=4,Is=0,nF=1,sF=2,YB=-1,ZB=0,QB=8;function Gi(t){if(!(this instanceof Gi))return new Gi(t);this.options=Pa.assign({level:YB,method:QB,chunkSize:16384,windowBits:15,memLevel:8,strategy:ZB,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KB,this.strm.avail_out=0;var r=Aa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Is)throw new Error(Lm[r]);if(e.header&&Aa.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Mm.string2buf(e.dictionary):oF.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Aa.deflateSetDictionary(this.strm,i),r!==Is)throw new Error(Lm[r]);this._dict_set=!0}}l(Gi,"Deflate");Gi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Bm:XB,typeof t=="string"?r.input=Mm.string2buf(t):oF.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Pa.Buf8(i),r.next_out=0,r.avail_out=i),n=Aa.deflate(r,s),n!==nF&&n!==Is)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Bm||s===sF))&&(this.options.to==="string"?this.onData(Mm.buf2binstring(Pa.shrinkBuf(r.output,r.next_out))):this.onData(Pa.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==nF);return s===Bm?(n=Aa.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Is):(s===sF&&(this.onEnd(Is),r.avail_out=0),!0)};Gi.prototype.onData=function(t){this.chunks.push(t)};Gi.prototype.onEnd=function(t){t===Is&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pa.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function jm(t,e){var r=new Gi(e);if(r.push(t,!0),r.err)throw r.msg||Lm[r.err];return r.result}l(jm,"deflate");function eM(t,e){return e=e||{},e.raw=!0,jm(t,e)}l(eM,"deflateRaw");function tM(t,e){return e=e||{},e.gzip=!0,jm(t,e)}l(tM,"gzip");Na.Deflate=Gi;Na.deflate=jm;Na.deflateRaw=eM;Na.gzip=tM});var lF=T((TK,cF)=>{"use strict";var vf=30,rM=12;cF.exports=l(function(e,r){var i,n,s,o,f,c,a,u,h,d,p,m,w,y,b,_,F,E,R,D,S,O,v,A,x;i=e.state,n=e.next_in,A=e.input,s=n+(e.avail_in-5),o=e.next_out,x=e.output,f=o-(r-e.avail_out),c=o+(e.avail_out-257),a=i.dmax,u=i.wsize,h=i.whave,d=i.wnext,p=i.window,m=i.hold,w=i.bits,y=i.lencode,b=i.distcode,_=(1<<i.lenbits)-1,F=(1<<i.distbits)-1;e:do{w<15&&(m+=A[n++]<<w,w+=8,m+=A[n++]<<w,w+=8),E=y[m&_];t:for(;;){if(R=E>>>24,m>>>=R,w-=R,R=E>>>16&255,R===0)x[o++]=E&65535;else if(R&16){D=E&65535,R&=15,R&&(w<R&&(m+=A[n++]<<w,w+=8),D+=m&(1<<R)-1,m>>>=R,w-=R),w<15&&(m+=A[n++]<<w,w+=8,m+=A[n++]<<w,w+=8),E=b[m&F];r:for(;;){if(R=E>>>24,m>>>=R,w-=R,R=E>>>16&255,R&16){if(S=E&65535,R&=15,w<R&&(m+=A[n++]<<w,w+=8,w<R&&(m+=A[n++]<<w,w+=8)),S+=m&(1<<R)-1,S>a){e.msg="invalid distance too far back",i.mode=vf;break e}if(m>>>=R,w-=R,R=o-f,S>R){if(R=S-R,R>h&&i.sane){e.msg="invalid distance too far back",i.mode=vf;break e}if(O=0,v=p,d===0){if(O+=u-R,R<D){D-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}}else if(d<R){if(O+=u+d-R,R-=d,R<D){D-=R;do x[o++]=p[O++];while(--R);if(O=0,d<D){R=d,D-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}}}else if(O+=d-R,R<D){D-=R;do x[o++]=p[O++];while(--R);O=o-S,v=x}for(;D>2;)x[o++]=v[O++],x[o++]=v[O++],x[o++]=v[O++],D-=3;D&&(x[o++]=v[O++],D>1&&(x[o++]=v[O++]))}else{O=o-S;do x[o++]=x[O++],x[o++]=x[O++],x[o++]=x[O++],D-=3;while(D>2);D&&(x[o++]=x[O++],D>1&&(x[o++]=x[O++]))}}else if(R&64){e.msg="invalid distance code",i.mode=vf;break e}else{E=b[(E&65535)+(m&(1<<R)-1)];continue r}break}}else if(R&64)if(R&32){i.mode=rM;break e}else{e.msg="invalid literal/length code",i.mode=vf;break e}else{E=y[(E&65535)+(m&(1<<R)-1)];continue t}break}}while(n<s&&o<c);D=w>>3,n-=D,w-=D<<3,m&=(1<<w)-1,e.next_in=n,e.next_out=o,e.avail_in=n<s?5+(s-n):5-(n-s),e.avail_out=o<c?257+(c-o):257-(o-c),i.hold=m,i.bits=w},"inflate_fast")});var wF=T((RK,mF)=>{"use strict";var fF=Nr(),$s=15,uF=852,hF=592,dF=0,qm=1,pF=2,iM=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],nM=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],sM=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],oM=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];mF.exports=l(function(e,r,i,n,s,o,f,c){var a=c.bits,u=0,h=0,d=0,p=0,m=0,w=0,y=0,b=0,_=0,F=0,E,R,D,S,O,v=null,A=0,x,I=new fF.Buf16($s+1),M=new fF.Buf16($s+1),H=null,Te=0,ft,zt,Ht;for(u=0;u<=$s;u++)I[u]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=a,p=$s;p>=1&&I[p]===0;p--);if(m>p&&(m=p),p===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,c.bits=1,0;for(d=1;d<p&&I[d]===0;d++);for(m<d&&(m=d),b=1,u=1;u<=$s;u++)if(b<<=1,b-=I[u],b<0)return-1;if(b>0&&(e===dF||p!==1))return-1;for(M[1]=0,u=1;u<$s;u++)M[u+1]=M[u]+I[u];for(h=0;h<n;h++)r[i+h]!==0&&(f[M[r[i+h]]++]=h);if(e===dF?(v=H=f,x=19):e===qm?(v=iM,A-=257,H=nM,Te-=257,x=256):(v=sM,H=oM,x=-1),F=0,h=0,u=d,O=o,w=m,y=0,D=-1,_=1<<m,S=_-1,e===qm&&_>uF||e===pF&&_>hF)return 1;for(;;){ft=u-y,f[h]<x?(zt=0,Ht=f[h]):f[h]>x?(zt=H[Te+f[h]],Ht=v[A+f[h]]):(zt=96,Ht=0),E=1<<u-y,R=1<<w,d=R;do R-=E,s[O+(F>>y)+R]=ft<<24|zt<<16|Ht|0;while(R!==0);for(E=1<<u-1;F&E;)E>>=1;if(E!==0?(F&=E-1,F+=E):F=0,h++,--I[u]===0){if(u===p)break;u=r[i+f[h]]}if(u>m&&(F&S)!==D){for(y===0&&(y=m),O+=d,w=u-y,b=1<<w;w+y<p&&(b-=I[w+y],!(b<=0));)w++,b<<=1;if(_+=1<<w,e===qm&&_>uF||e===pF&&_>hF)return 1;D=F&S,s[D]=m<<24|w<<16|O-o|0}}return F!==0&&(s[O+F]=u-y<<24|64<<16|0),c.bits=m,0},"inflate_table")});var YF=T(Xt=>{"use strict";var vt=Nr(),Gm=xm(),pr=Am(),aM=lF(),Da=wF(),cM=0,UF=1,WF=2,yF=4,lM=5,Ef=6,Ji=0,fM=1,uM=2,It=-2,zF=-3,Jm=-4,hM=-5,gF=8,HF=1,bF=2,_F=3,SF=4,vF=5,EF=6,FF=7,TF=8,kF=9,RF=10,kf=11,Ir=12,Um=13,OF=14,Wm=15,xF=16,AF=17,PF=18,NF=19,Ff=20,Tf=21,DF=22,CF=23,IF=24,$F=25,BF=26,zm=27,MF=28,LF=29,we=30,Km=31,dM=32,pM=852,mM=592,wM=15,yM=wM;function jF(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}l(jF,"zswap32");function gM(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new vt.Buf16(320),this.work=new vt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}l(gM,"InflateState");function VF(t){var e;return!t||!t.state?It:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=HF,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new vt.Buf32(pM),e.distcode=e.distdyn=new vt.Buf32(mM),e.sane=1,e.back=-1,Ji)}l(VF,"inflateResetKeep");function GF(t){var e;return!t||!t.state?It:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,VF(t))}l(GF,"inflateReset");function JF(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?It:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,GF(t))}l(JF,"inflateReset2");function KF(t,e){var r,i;return t?(i=new gM,t.state=i,i.window=null,r=JF(t,e),r!==Ji&&(t.state=null),r):It}l(KF,"inflateInit2");function bM(t){return KF(t,yM)}l(bM,"inflateInit");var qF=!0,Hm,Vm;function _M(t){if(qF){var e;for(Hm=new vt.Buf32(512),Vm=new vt.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Da(UF,t.lens,0,288,Hm,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Da(WF,t.lens,0,32,Vm,0,t.work,{bits:5}),qF=!1}t.lencode=Hm,t.lenbits=9,t.distcode=Vm,t.distbits=5}l(_M,"fixedtables");function XF(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new vt.Buf8(s.wsize)),i>=s.wsize?(vt.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),vt.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(vt.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}l(XF,"updatewindow");function SM(t,e){var r,i,n,s,o,f,c,a,u,h,d,p,m,w,y=0,b,_,F,E,R,D,S,O,v=new vt.Buf8(4),A,x,I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return It;r=t.state,r.mode===Ir&&(r.mode=Um),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,a=r.hold,u=r.bits,h=f,d=c,O=Ji;e:for(;;)switch(r.mode){case HF:if(r.wrap===0){r.mode=Um;break}for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.wrap&2&&a===35615){r.check=0,v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0),a=0,u=0,r.mode=bF;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((a&255)<<8)+(a>>8))%31){t.msg="incorrect header check",r.mode=we;break}if((a&15)!==gF){t.msg="unknown compression method",r.mode=we;break}if(a>>>=4,u-=4,S=(a&15)+8,r.wbits===0)r.wbits=S;else if(S>r.wbits){t.msg="invalid window size",r.mode=we;break}r.dmax=1<<S,t.adler=r.check=1,r.mode=a&512?RF:Ir,a=0,u=0;break;case bF:for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.flags=a,(r.flags&255)!==gF){t.msg="unknown compression method",r.mode=we;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=we;break}r.head&&(r.head.text=a>>8&1),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0,r.mode=_F;case _F:for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.head&&(r.head.time=a),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,v[2]=a>>>16&255,v[3]=a>>>24&255,r.check=pr(r.check,v,4,0)),a=0,u=0,r.mode=SF;case SF:for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.head&&(r.head.xflags=a&255,r.head.os=a>>8),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0,r.mode=vF;case vF:if(r.flags&1024){for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.length=a,r.head&&(r.head.extra_len=a),r.flags&512&&(v[0]=a&255,v[1]=a>>>8&255,r.check=pr(r.check,v,2,0)),a=0,u=0}else r.head&&(r.head.extra=null);r.mode=EF;case EF:if(r.flags&1024&&(p=r.length,p>f&&(p=f),p&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),vt.arraySet(r.head.extra,i,s,p,S)),r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=FF;case FF:if(r.flags&2048){if(f===0)break e;p=0;do S=i[s+p++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S));while(S&&p<f);if(r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,S)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=TF;case TF:if(r.flags&4096){if(f===0)break e;p=0;do S=i[s+p++],r.head&&S&&r.length<65536&&(r.head.comment+=String.fromCharCode(S));while(S&&p<f);if(r.flags&512&&(r.check=pr(r.check,i,p,s)),f-=p,s+=p,S)break e}else r.head&&(r.head.comment=null);r.mode=kF;case kF:if(r.flags&512){for(;u<16;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a!==(r.check&65535)){t.msg="header crc mismatch",r.mode=we;break}a=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Ir;break;case RF:for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}t.adler=r.check=jF(a),a=0,u=0,r.mode=kf;case kf:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,uM;t.adler=r.check=1,r.mode=Ir;case Ir:if(e===lM||e===Ef)break e;case Um:if(r.last){a>>>=u&7,u-=u&7,r.mode=zm;break}for(;u<3;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}switch(r.last=a&1,a>>>=1,u-=1,a&3){case 0:r.mode=OF;break;case 1:if(_M(r),r.mode=Ff,e===Ef){a>>>=2,u-=2;break e}break;case 2:r.mode=AF;break;case 3:t.msg="invalid block type",r.mode=we}a>>>=2,u-=2;break;case OF:for(a>>>=u&7,u-=u&7;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if((a&65535)!==(a>>>16^65535)){t.msg="invalid stored block lengths",r.mode=we;break}if(r.length=a&65535,a=0,u=0,r.mode=Wm,e===Ef)break e;case Wm:r.mode=xF;case xF:if(p=r.length,p){if(p>f&&(p=f),p>c&&(p=c),p===0)break e;vt.arraySet(n,i,s,p,o),f-=p,s+=p,c-=p,o+=p,r.length-=p;break}r.mode=Ir;break;case AF:for(;u<14;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(r.nlen=(a&31)+257,a>>>=5,u-=5,r.ndist=(a&31)+1,a>>>=5,u-=5,r.ncode=(a&15)+4,a>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=we;break}r.have=0,r.mode=PF;case PF:for(;r.have<r.ncode;){for(;u<3;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.lens[I[r.have++]]=a&7,a>>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},O=Da(cM,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid code lengths set",r.mode=we;break}r.have=0,r.mode=NF;case NF:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[a&(1<<r.lenbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(F<16)a>>>=b,u-=b,r.lens[r.have++]=F;else{if(F===16){for(x=b+2;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a>>>=b,u-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=we;break}S=r.lens[r.have-1],p=3+(a&3),a>>>=2,u-=2}else if(F===17){for(x=b+3;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=b,u-=b,S=0,p=3+(a&7),a>>>=3,u-=3}else{for(x=b+7;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=b,u-=b,S=0,p=11+(a&127),a>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=we;break}for(;p--;)r.lens[r.have++]=S}}if(r.mode===we)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=we;break}if(r.lenbits=9,A={bits:r.lenbits},O=Da(UF,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,O){t.msg="invalid literal/lengths set",r.mode=we;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},O=Da(WF,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,O){t.msg="invalid distances set",r.mode=we;break}if(r.mode=Ff,e===Ef)break e;case Ff:r.mode=Tf;case Tf:if(f>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,aM(t,d),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,a=r.hold,u=r.bits,r.mode===Ir&&(r.back=-1);break}for(r.back=0;y=r.lencode[a&(1<<r.lenbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(_&&!(_&240)){for(E=b,R=_,D=F;y=r.lencode[D+((a&(1<<E+R)-1)>>E)],b=y>>>24,_=y>>>16&255,F=y&65535,!(E+b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=b,u-=b,r.back+=b,r.length=F,_===0){r.mode=BF;break}if(_&32){r.back=-1,r.mode=Ir;break}if(_&64){t.msg="invalid literal/length code",r.mode=we;break}r.extra=_&15,r.mode=DF;case DF:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.length+=a&(1<<r.extra)-1,a>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=CF;case CF:for(;y=r.distcode[a&(1<<r.distbits)-1],b=y>>>24,_=y>>>16&255,F=y&65535,!(b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(!(_&240)){for(E=b,R=_,D=F;y=r.distcode[D+((a&(1<<E+R)-1)>>E)],b=y>>>24,_=y>>>16&255,F=y&65535,!(E+b<=u);){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}a>>>=E,u-=E,r.back+=E}if(a>>>=b,u-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=we;break}r.offset=F,r.extra=_&15,r.mode=IF;case IF:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}r.offset+=a&(1<<r.extra)-1,a>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=we;break}r.mode=$F;case $F:if(c===0)break e;if(p=d-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=we;break}p>r.wnext?(p-=r.wnext,m=r.wsize-p):m=r.wnext-p,p>r.length&&(p=r.length),w=r.window}else w=n,m=o-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[o++]=w[m++];while(--p);r.length===0&&(r.mode=Tf);break;case BF:if(c===0)break e;n[o++]=r.length,c--,r.mode=Tf;break;case zm:if(r.wrap){for(;u<32;){if(f===0)break e;f--,a|=i[s++]<<u,u+=8}if(d-=c,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?pr(r.check,n,d,o-d):Gm(r.check,n,d,o-d)),d=c,(r.flags?a:jF(a))!==r.check){t.msg="incorrect data check",r.mode=we;break}a=0,u=0}r.mode=MF;case MF:if(r.wrap&&r.flags){for(;u<32;){if(f===0)break e;f--,a+=i[s++]<<u,u+=8}if(a!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=we;break}a=0,u=0}r.mode=LF;case LF:O=fM;break e;case we:O=zF;break e;case Km:return Jm;case dM:default:return It}return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=f,r.hold=a,r.bits=u,(r.wsize||d!==t.avail_out&&r.mode<we&&(r.mode<zm||e!==yF))&&XF(t,t.output,t.next_out,d-t.avail_out)?(r.mode=Km,Jm):(h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?pr(r.check,n,d,t.next_out-d):Gm(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Ir?128:0)+(r.mode===Ff||r.mode===Wm?256:0),(h===0&&d===0||e===yF)&&O===Ji&&(O=hM),O)}l(SM,"inflate");function vM(t){if(!t||!t.state)return It;var e=t.state;return e.window&&(e.window=null),t.state=null,Ji}l(vM,"inflateEnd");function EM(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?It:(r.head=e,e.done=!1,Ji)}l(EM,"inflateGetHeader");function FM(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==kf)?It:i.mode===kf&&(n=1,n=Gm(n,e,r,0),n!==i.check)?zF:(s=XF(t,e,r,r),s?(i.mode=Km,Jm):(i.havedict=1,Ji))}l(FM,"inflateSetDictionary");Xt.inflateReset=GF;Xt.inflateReset2=JF;Xt.inflateResetKeep=VF;Xt.inflateInit=bM;Xt.inflateInit2=KF;Xt.inflate=SM;Xt.inflateEnd=vM;Xt.inflateGetHeader=EM;Xt.inflateSetDictionary=FM;Xt.inflateInfo="pako inflate (from Nodeca project)"});var Xm=T((PK,ZF)=>{"use strict";ZF.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var eT=T((NK,QF)=>{"use strict";function TM(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}l(TM,"GZheader");QF.exports=TM});var rT=T(Ia=>{"use strict";var Bs=YF(),Ca=Nr(),Rf=Im(),ve=Xm(),Ym=pf(),kM=$m(),RM=eT(),tT=Object.prototype.toString;function Ki(t){if(!(this instanceof Ki))return new Ki(t);this.options=Ca.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kM,this.strm.avail_out=0;var r=Bs.inflateInit2(this.strm,e.windowBits);if(r!==ve.Z_OK)throw new Error(Ym[r]);if(this.header=new RM,Bs.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Rf.string2buf(e.dictionary):tT.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Bs.inflateSetDictionary(this.strm,e.dictionary),r!==ve.Z_OK)))throw new Error(Ym[r])}l(Ki,"Inflate");Ki.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,o,f,c,a,u=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?ve.Z_FINISH:ve.Z_NO_FLUSH,typeof t=="string"?r.input=Rf.binstring2buf(t):tT.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Ca.Buf8(i),r.next_out=0,r.avail_out=i),s=Bs.inflate(r,ve.Z_NO_FLUSH),s===ve.Z_NEED_DICT&&n&&(s=Bs.inflateSetDictionary(this.strm,n)),s===ve.Z_BUF_ERROR&&u===!0&&(s=ve.Z_OK,u=!1),s!==ve.Z_STREAM_END&&s!==ve.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===ve.Z_STREAM_END||r.avail_in===0&&(o===ve.Z_FINISH||o===ve.Z_SYNC_FLUSH))&&(this.options.to==="string"?(f=Rf.utf8border(r.output,r.next_out),c=r.next_out-f,a=Rf.buf2string(r.output,f),r.next_out=c,r.avail_out=i-c,c&&Ca.arraySet(r.output,r.output,f,c,0),this.onData(a)):this.onData(Ca.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==ve.Z_STREAM_END);return s===ve.Z_STREAM_END&&(o=ve.Z_FINISH),o===ve.Z_FINISH?(s=Bs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ve.Z_OK):(o===ve.Z_SYNC_FLUSH&&(this.onEnd(ve.Z_OK),r.avail_out=0),!0)};Ki.prototype.onData=function(t){this.chunks.push(t)};Ki.prototype.onEnd=function(t){t===ve.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ca.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Zm(t,e){var r=new Ki(e);if(r.push(t,!0),r.err)throw r.msg||Ym[r.err];return r.result}l(Zm,"inflate");function OM(t,e){return e=e||{},e.raw=!0,Zm(t,e)}l(OM,"inflateRaw");Ia.Inflate=Ki;Ia.inflate=Zm;Ia.inflateRaw=OM;Ia.ungzip=Zm});var sT=T(($K,nT)=>{"use strict";var xM=Nr().assign,AM=aF(),PM=rT(),NM=Xm(),iT={};xM(iT,AM,PM,NM);nT.exports=iT});var cT=T((BK,aT)=>{"use strict";var oT=l((t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...o)=>{e.errorFirst?o[0]?s(o):(o.shift(),n(o)):n(o)}):e.errorFirst?r.push((o,f)=>{o?s(o):n(f)}):r.push(n),t.apply(this,r)})},"processFn");aT.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=l(s=>{let o=l(f=>typeof f=="string"?s===f:f.test(s),"match");return e.include?e.include.some(o):!e.exclude.some(o)},"filter"),n;r==="function"?n=l(function(...s){return e.excludeMain?t(...s):oT(t,e).apply(this,s)},"ret"):n=Object.create(Object.getPrototypeOf(t));for(let s in t){let o=t[s];n[s]=typeof o=="function"&&i(s)?oT(o,e):o}return n}});var yT=T((LK,wT)=>{function lT(t){return Array.isArray(t)?t:[t]}l(lT,"makeArray");var tw="",fT=" ",Qm="\\",DM=/^\s+$/,CM=/(?:[^\\]|^)\\$/,IM=/^\\!/,$M=/^\\#/,BM=/\r?\n/g,MM=/^\.*\/|^\.+$/,ew="/",dT="node-ignore";typeof Symbol<"u"&&(dT=Symbol.for("node-ignore"));var uT=dT,LM=l((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),jM=/([0-z])-([0-z])/g,pT=l(()=>!1,"RETURN_FALSE"),qM=l(t=>t.replace(jM,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:tw),"sanitizeRange"),UM=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),WM=[[/^\uFEFF/,()=>tw],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?fT:tw)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+fT}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Qm],[/\\\\/g,()=>Qm],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Qm?`\\[${r}${UM(i)}${n}`:n==="]"&&i.length%2===0?`[${qM(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],hT=Object.create(null),zM=l((t,e)=>{let r=hT[t];return r||(r=WM.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),hT[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),nw=l(t=>typeof t=="string","isString"),HM=l(t=>t&&nw(t)&&!DM.test(t)&&!CM.test(t)&&t.indexOf("#")!==0,"checkPattern"),VM=l(t=>t.split(BM),"splitPattern"),sw=class sw{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};l(sw,"IgnoreRule");var rw=sw,GM=l((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(IM,"!").replace($M,"#");let n=zM(t,e);return new rw(r,t,i,n)},"createRule"),JM=l((t,e)=>{throw new e(t)},"throwError"),$r=l((t,e,r)=>nw(t)?t?$r.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),mT=l(t=>MM.test(t),"isNotRelative");$r.isNotRelative=mT;$r.convert=t=>t;var ow=class ow{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){LM(this,uT,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[uT]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(HM(e)){let r=GM(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,lT(nw(e)?VM(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(n===o&&i!==n||o&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!o,n=o)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&$r.convert(e);return $r(s,e,this._allowRelativePaths?pT:JM),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(ew)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(ew)+ew,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return lT(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(ow,"Ignore");var iw=ow,Of=l(t=>new iw(t),"factory"),KM=l(t=>$r(t&&$r.convert(t),t,pT),"isPathValid");Of.isPathValid=KM;Of.default=Of;wT.exports=Of;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");$r.convert=t;let e=/^[a-z]:\//i;$r.isNotRelative=r=>e.test(r)||mT(r)}});var bT=T((qK,gT)=>{"use strict";function XM(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(XM,"escapeRegExp");function mr(t,e,r){return e=e instanceof RegExp?e:new RegExp(XM(e),"g"),t.replace(e,r)}l(mr,"replaceAll");var YM={clean:l(function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=mr(e,"./","/"),e=mr(e,"..","."),e=mr(e," ","-"),e=mr(e,/^[~^:?*\\\-]/g,""),e=mr(e,/[~^:?*\\]/g,"-"),e=mr(e,/[~^:?*\\\-]$/g,""),e=mr(e,"@{","-"),e=mr(e,/\.$/g,""),e=mr(e,/\/$/g,""),e=mr(e,/\.lock$/g,""),e},"clean")};gT.exports=YM});var ST=T((WK,_T)=>{_T.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,o=!1,f=null,c=n+1,a=[],u=[],h=[],d="",p=-1,m=0,w=1,y,b,_=l(function(){n>=s&&(y=r,b=n,r=i,i=y,n=s,s=b,o=!0,c=n+1)},"init"),F=l(function(S,O,v){return{x:S,y:O,k:v}},"P"),E=l(function(S,O){return{elem:S,t:O}},"seselem"),R=l(function(S,O,v){var A,x,I;for(O>v?A=a[S-1+c]:A=a[S+1+c],I=Math.max(O,v),x=I-S;x<n&&I<s&&r[x]===i[I];)++x,++I;return a[S+c]=u.length,u[u.length]=new F(x,I,A),I},"snake"),D=l(function(S){var O,v,A,x,I;for(O=v=1,A=x=0,I=S.length-1;I>=0;--I)for(;A<S[I].x||x<S[I].y;)S[I].y-S[I].x>x-A?(o?h[h.length]=new E(i[x],p):h[h.length]=new E(i[x],w),++v,++x):S[I].y-S[I].x<x-A?(o?h[h.length]=new E(r[A],w):h[h.length]=new E(r[A],p),++O,++A):(h[h.length]=new E(r[A],m),d+=r[A],++O,++v,++A,++x)},"recordseq");return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:l(function(){return f},"editdistance"),getlcs:l(function(){return d},"getlcs"),getses:l(function(){return h},"getses"),compose:l(function(){var S,O,v,A,x,I,M,H;for(S=s-n,O=n+s+3,v={},M=0;M<O;++M)v[M]=-1,a[M]=-1;A=-1;do{for(++A,H=-A;H<=S-1;++H)v[H+c]=R(H,v[H-1+c]+1,v[H+1+c]);for(H=S+A;H>=S+1;--H)v[H+c]=R(H,v[H-1+c]+1,v[H+1+c]);v[S+c]=R(S,v[S-1+c]+1,v[S+1+c])}while(v[S+c]!==s);for(f=S+2*A,x=a[S+c],I=[];x!==-1;)I[I.length]=new F(u[x].x,u[x].y,null),x=u[x].k;D(I)},"compose")}}});var FT=T((HK,ET)=>{var ZM=ST();function QM(t,e){var r=new ZM(t,e);r.compose();for(var i=r.getses(),n,s,o=t.length-1,f=e.length-1,c=i.length-1;c>=0;--c)i[c].t===r.SES_COMMON?(s?(s.chain={file1index:o,file2index:f,chain:null},s=s.chain):(n={file1index:o,file2index:f,chain:null},s=n),o--,f--):i[c].t===r.SES_DELETE?o--:i[c].t===r.SES_ADD&&f--;var a={file1index:-1,file2index:-1,chain:null};return s?(s.chain=a,n):a}l(QM,"longestCommonSubsequence");function vT(t,e){for(var r=[],i=t.length,n=e.length,s=QM(t,e);s!==null;s=s.chain){var o=i-s.file1index-1,f=n-s.file2index-1;i=s.file1index,n=s.file2index,(o||f)&&r.push({file1:[i+1,o],file2:[n+1,f]})}return r.reverse(),r}l(vT,"diffIndices");function eL(t,e,r){var i,n=vT(e,t),s=vT(e,r),o=[];function f(M,H){o.push([M.file1[0],H,M.file1[1],M.file2[0],M.file2[1]])}for(l(f,"addHunk"),i=0;i<n.length;i++)f(n[i],0);for(i=0;i<s.length;i++)f(s[i],2);o.sort(function(M,H){return M[0]-H[0]});var c=[],a=0;function u(M){M>a&&(c.push([1,a,M-a]),a=M)}l(u,"copyCommon");for(var h=0;h<o.length;h++){for(var d=h,p=o[h],m=p[0],w=m+p[2];h<o.length-1;){var y=o[h+1],b=y[0];if(b>w)break;w=Math.max(w,b+y[2]),h++}if(u(m),d==h)p[4]>0&&c.push([p[1],p[3],p[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=h;i++){p=o[i];var F=p[1],E=_[F],R=p[0],D=R+p[2],S=p[3],O=S+p[4];E[0]=Math.min(S,E[0]),E[1]=Math.max(O,E[1]),E[2]=Math.min(R,E[2]),E[3]=Math.max(D,E[3])}var v=_[0][0]+(m-_[0][2]),A=_[0][1]+(w-_[0][3]),x=_[2][0]+(m-_[2][2]),I=_[2][1]+(w-_[2][3]);c.push([-1,v,A-v,m,w-m,x,I-x])}a=w}return u(e.length),c}l(eL,"diff3MergeIndices");function tL(t,e,r){var i=[],n=[t,e,r],s=eL(t,e,r),o=[];function f(){o.length&&i.push({ok:o}),o=[]}l(f,"flushOk");function c(p){for(var m=0;m<p.length;m++)o.push(p[m])}l(c,"pushOk");function a(p){if(p[2]!=p[6])return!0;for(var m=p[1],w=p[5],y=0;y<p[2];y++)if(t[y+m]!=r[y+w])return!0;return!1}l(a,"isTrueConflict");for(var u=0;u<s.length;u++){var h=s[u],d=h[0];d==-1?a(h)?(f(),i.push({conflict:{a:t.slice(h[1],h[1]+h[2]),aIndex:h[1],o:e.slice(h[3],h[3]+h[4]),oIndex:h[3],b:r.slice(h[5],h[5]+h[6]),bIndex:h[5]}})):c(n[0].slice(h[1],h[1]+h[2])):c(n[d].slice(h[1],h[1]+h[2]))}return f(),i}l(tL,"diff3Merge");ET.exports=tL});var Fe=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});function pi(t){return t&&typeof t=="object"&&"default"in t?t.default:t}l(pi,"_interopDefault");var Ma=pi(tS()),GT=pi(wE()),rL=pi(gE()),Nw=pi(sT()),aw=pi(cT()),iL=pi(yT()),La=pi(bT()),nL=pi(FT()),qf=class qf extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new qf(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}};l(qf,"BaseError");var ee=qf,Uf=class Uf extends ee{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=Uf.code,this.data={filepaths:e}}};l(Uf,"UnmergedPathsError");var ja=Uf;ja.code="UnmergedPathsError";var Wf=class Wf extends ee{constructor(e){super(`An internal error caused this command to fail.
9
+ `+i),"printJson");Fc.printJson=N1});var bp=Ze(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});var wp=(Jl(),kd(Kl));wp.__exportStar(y0(),Mo);wp.__exportStar(w0(),Mo);wp.__exportStar(b0(),Mo)});var _0=Ze(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.newNotAllowedError=yr.newTypeMismatchError=yr.newNotFoundError=yr.assertCanWrite=yr.assertName=yr.basename=yr.ctx=void 0;var C1=c((i={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...i}),"ctx");yr.ctx=C1;var I1=c((i,e)=>{i[i.length-1]===e&&(i=i.slice(0,-1));let t=i.lastIndexOf(e);return t===-1?i:i.slice(t+1)},"basename");yr.basename=I1;var B1=/^(\.{1,2})$|^(.*([\/\\]).*)$/,j1=c((i,e,t)=>{if(!i||B1.test(i))throw new TypeError(`Failed to execute '${e}' on '${t}': Name is not allowed.`)},"assertName");yr.assertName=j1;var M1=c(i=>{if(i!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");yr.assertCanWrite=M1;var $1=c(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");yr.newNotFoundError=$1;var L1=c(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");yr.newTypeMismatchError=L1;var U1=c(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");yr.newNotAllowedError=U1});var v0=Ze($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.toTreeSync=void 0;var W1=bp(),q1=_0(),z1=c((i,e={})=>{let t=e.separator||"/",r=e.dir||t;r[r.length-1]!==t&&(r+=t);let n=e.tab||"",o=e.depth??10,f=" (...)";if(o>0){let l=i.readdirSync(r,{withFileTypes:!0});f=(0,W1.printTree)(n,l.map(a=>g=>a.isDirectory()?(0,$o.toTreeSync)(i,{dir:r+a.name,depth:o-1,tab:g}):a.isSymbolicLink()?""+a.name+" \u2192 "+i.readlinkSync(r+a.name):""+a.name))}return(0,q1.basename)(r,t)+t+f},"toTreeSync");$o.toTreeSync=z1});var F0=Ze(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.getWriteFileOptions=ft.writeFileDefaults=ft.getRealpathOptsAndCb=ft.getRealpathOptions=ft.getStatfsOptsAndCb=ft.getStatfsOptions=ft.getStatOptsAndCb=ft.getStatOptions=ft.getAppendFileOptsAndCb=ft.getAppendFileOpts=ft.getOpendirOptsAndCb=ft.getOpendirOptions=ft.getReaddirOptsAndCb=ft.getReaddirOptions=ft.getReadFileOptions=ft.getRmOptsAndCb=ft.getRmdirOptions=ft.getDefaultOptsAndCb=ft.getDefaultOpts=ft.optsDefaults=ft.getMkdirOptions=void 0;ft.getOptions=E0;ft.optsGenerator=Ri;ft.optsAndCbGenerator=es;var kc=Oa(),H1=Do(),_p=Hi(),S0={mode:511,recursive:!1},G1=c(i=>typeof i=="number"?Object.assign({},S0,{mode:i}):Object.assign({},S0,i),"getMkdirOptions");ft.getMkdirOptions=G1;var V1=c(i=>`Expected options to be either an object or a string, but got ${i} instead`,"ERRSTR_OPTS");function E0(i,e){let t;if(e){let r=typeof e;switch(r){case"string":t=Object.assign({},i,{encoding:e});break;case"object":t=Object.assign({},i,e);break;default:throw TypeError(V1(r))}}else return i;return t.encoding!=="buffer"&&(0,H1.assertEncoding)(t.encoding),t}c(E0,"getOptions");function Ri(i){return e=>E0(i,e)}c(Ri,"optsGenerator");function es(i){return(e,t)=>typeof e=="function"?[i(),e]:[i(e),(0,_p.validateCallback)(t)]}c(es,"optsAndCbGenerator");ft.optsDefaults={encoding:"utf8"};ft.getDefaultOpts=Ri(ft.optsDefaults);ft.getDefaultOptsAndCb=es(ft.getDefaultOpts);var K1={recursive:!1},J1=c(i=>Object.assign({},K1,i),"getRmdirOptions");ft.getRmdirOptions=J1;var Y1=Ri(ft.optsDefaults);ft.getRmOptsAndCb=es(Y1);var X1={flag:"r"};ft.getReadFileOptions=Ri(X1);var Q1={encoding:"utf8",recursive:!1,withFileTypes:!1};ft.getReaddirOptions=Ri(Q1);ft.getReaddirOptsAndCb=es(ft.getReaddirOptions);var Z1={encoding:"utf8",bufferSize:32,recursive:!1};ft.getOpendirOptions=Ri(Z1);ft.getOpendirOptsAndCb=es(ft.getOpendirOptions);var eF={encoding:"utf8",mode:438,flag:kc.FLAGS[kc.FLAGS.a]};ft.getAppendFileOpts=Ri(eF);ft.getAppendFileOptsAndCb=es(ft.getAppendFileOpts);var tF={bigint:!1},rF=c((i={})=>Object.assign({},tF,i),"getStatOptions");ft.getStatOptions=rF;var iF=c((i,e)=>typeof i=="function"?[(0,ft.getStatOptions)(),i]:[(0,ft.getStatOptions)(i),(0,_p.validateCallback)(e)],"getStatOptsAndCb");ft.getStatOptsAndCb=iF;var nF={bigint:!1},sF=c((i={})=>Object.assign({},nF,i),"getStatfsOptions");ft.getStatfsOptions=sF;var aF=c((i,e)=>typeof i=="function"?[(0,ft.getStatfsOptions)(),i]:[(0,ft.getStatfsOptions)(i),(0,_p.validateCallback)(e)],"getStatfsOptsAndCb");ft.getStatfsOptsAndCb=aF;var oF=ft.optsDefaults;ft.getRealpathOptions=Ri(oF);ft.getRealpathOptsAndCb=es(ft.getRealpathOptions);ft.writeFileDefaults={encoding:"utf8",mode:438,flag:kc.FLAGS[kc.FLAGS.w]};ft.getWriteFileOptions=Ri(ft.writeFileDefaults)});var R0=Ze(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.Dir=void 0;var k0=Hi(),lF=zl(),ts=Po(),Sp=class Sp{constructor(e,t){this.link=e,this.options=t,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let t,r,n,o;do{do if({done:t,value:r}=e[e.length-1].next(),!t)[n,o]=r;else break;while(n==="."||n==="..");if(t){if(e.pop(),e.length===0)break;t=!1}else return this.options.recursive&&o.children.size&&e.push(o.children[Symbol.iterator]()),lF.default.build(o,this.options.encoding)}while(!t);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new ts.Error("ERR_DIR_CLOSED")):new Promise((t,r)=>{this.close(n=>{n?r(n):t()})});if((0,k0.validateCallback)(e),this.closed){process.nextTick(e,new ts.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(t){process.nextTick(e,t)}}closeSync(){if(this.closed)throw new ts.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new ts.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((t,r)=>{this.read((n,o)=>{n?r(n):t(o??null)})});if((0,k0.validateCallback)(e),this.closed){process.nextTick(e,new ts.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let t=this.readBase(this.iteratorInfo);process.nextTick(()=>{let r=this.operationQueue;this.operationQueue=null;for(let n of r)n();e(null,t)})}catch(t){process.nextTick(()=>{let r=this.operationQueue;this.operationQueue=null;for(let n of r)n();e(t)})}}readSync(){if(this.closed)throw new ts.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new ts.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:c(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};c(Sp,"Dir");var vp=Sp;Rc.Dir=vp});var Ep=Ze(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.toMatcher=Ti.toRegex=void 0;var cF=c(i=>/[.^$+{}()|\\]/.test(i)?`\\${i}`:i,"escapeRe"),fF=c((i,e,t,r)=>{let n=e,o=[],f="",m=1;for(;n<i.length&&m>0;){let g=i[n];if(g==="(")m++,f+=g,n++;else if(g===")")if(m--,m===0){o.push(f),n++;break}else f+=g,n++;else g==="|"&&m===1?(o.push(f),f="",n++):(f+=g,n++)}if(m!==0)return;let l="",a=o.length;for(let g=0;g<a;g++)l+=(l?"|":"")+(0,Ti.toRegex)(o[g],r).source.replace(/^\^/,"").replace(/\$$/,"");switch(t){case"?":return[`(?:${l})?`,n];case"*":return[`(?:${l})*`,n];case"+":return[`(?:${l})+`,n];case"@":return[`(?:${l})`,n];case"!":return[`(?!${l})[^/]*`,n]}},"parseExtGlob"),hF=c((i,e)=>{let t="",r=0,n=c(()=>{r++;let m=[],l="",a=!1;for(;r<i.length;){let y=i[r];if(y==="}"){m.push(l),r++,a=!0;break}if(y===","){m.push(l),l="",r++;continue}l+=y,r++}return a?`(?:${m.map(y=>(0,Ti.toRegex)(y,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+cF(l)},"parseBraceGroup"),o=!!e?.extglob;for(;r<i.length;){let m=i[r];if(o&&i[r+1]==="("&&(m==="?"||m==="*"||m==="+"||m==="@"||m==="!")){let l=fF(i,r+2,m,e);if(l){t+=l[0],r=l[1];continue}}switch(m){case"*":{if(i[r+1]==="*"){let l=r+2;for(;i[l]==="*";)l++;i[l]==="/"?(t+="(?:.*/)?",r=l+1):(t+=".*",r=l)}else t+="[^/]*",r++;break}case"?":t+="[^/]",r++;break;case"[":{let l="[";for(r++,r<i.length&&i[r]==="!"&&(l+="^",r++),r<i.length&&i[r]==="]"&&(l+="]",r++);r<i.length&&i[r]!=="]";){let a=i[r];l+=a==="\\"?"\\\\":a,r++}if(r<i.length&&i[r]==="]")l+="]",r++;else{t+="\\[";continue}t+=l;break}case"{":{t+=n();break}case"/":t+="/",r++;break;case".":case"^":case"$":case"+":case"(":case")":case"|":case"\\":t+=`\\${m}`,r++;break;default:t+=m,r++;break}}let f=e?.nocase?"i":"";return new RegExp("^"+t+"$",f)},"toRegex");Ti.toRegex=hF;var uF=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,dF=c((i,e)=>{let t=[],r=Array.isArray(i)?i:[i];for(let n of r)if(typeof n=="string"){let o=uF.exec(n);if(o){let[,f,m]=o;t.push(new RegExp(f,m))}else t.push((0,Ti.toRegex)(n,e))}else t.push(n);return t.length?new Function("p","return "+t.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");Ti.toMatcher=dF});var x0=Ze(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.globSync=bF;var rs=Fa(),pF=Ep(),T0=Hi(),mF=rs.posix.join,gF=rs.posix.relative,yF=rs.posix.resolve;function O0(i,e){return(0,pF.toRegex)(e).test(i)}c(O0,"matchesPattern");function wF(i,e){return e?typeof e=="function"?e(i):(Array.isArray(e)?e:[e]).some(r=>O0(i,r)):!1}c(wF,"isExcluded");function Fp(i,e,t,r,n=0){let o=[],f=r.maxdepth??1/0,m=r.cwd?(0,T0.pathToFilename)(r.cwd):process.cwd();if(n>f)return o;try{let l=i.readdirSync(e,{withFileTypes:!0});for(let a of l){let g=mF(e,a.name.toString()),y=gF(m,g);if(wF(y,r.exclude))continue;if(t.some(S=>O0(y,S))&&o.push(y),a.isDirectory()&&n<f){let S=Fp(i,g,t,r,n+1);o.push(...S)}}}catch{}return o}c(Fp,"walkDirectory");function bF(i,e,t={}){let r=t.cwd?(0,T0.pathToFilename)(t.cwd):process.cwd(),n=yF(r),o={cwd:n,exclude:t.exclude,maxdepth:t.maxdepth,withFileTypes:t.withFileTypes||!1},f=[];if(rs.posix.isAbsolute(e)){let m=rs.posix.dirname(e),l=rs.posix.basename(e),a=Fp(i,m,[l],{...o,cwd:m});f.push(...a.map(g=>rs.posix.resolve(m,g)))}else{let m=Fp(i,n,[e],o);f.push(...m)}return f=[...new Set(f)].sort(),f}c(bF,"globSync")});var B0=Ze(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.FSWatcher=Nr.StatWatcher=Nr.Volume=void 0;Nr.pathToSteps=BF;Nr.dataToStr=jF;Nr.toUnixTimestamp=Dr;var Kt=Fa(),xp=f0(),Rp=Id(),_F=zl(),vF=h0(),Ca=Wi(),Pc=sp(),SF=u0(),Dc=p0(),EF=ii(),N0=hp(),is=Do(),FF=m0(),C0=jd(),kF=g0(),RF=v0(),Oc=Oa(),TF=Po(),Et=F0(),Se=Hi(),OF=R0(),dr=uc(),xF=Kt.resolve,{O_SYMLINK:A0,F_OK:Tp,R_OK:AF,W_OK:PF,X_OK:DF,COPYFILE_EXCL:NF,COPYFILE_FICLONE_FORCE:CF}=EF.constants,aC=Kt.posix?Kt.posix.sep:Kt.sep,Tc=Kt.posix?Kt.posix.relative:Kt.relative,Op=Kt.posix?Kt.posix.join:Kt.join,P0=Kt.posix?Kt.posix.dirname:Kt.dirname,D0=Kt.posix?Kt.posix.normalize:Kt.normalize,IF=128;function BF(i){return(0,dr.filenameToSteps)((0,Se.pathToFilename)(i))}c(BF,"pathToSteps");function jF(i,e=is.ENCODING_UTF8){return Ca.Buffer.isBuffer(i)?i.toString(e):i instanceof Uint8Array?(0,Ca.bufferFrom)(i).toString(e):String(i)}c(jF,"dataToStr");function Dr(i){if(typeof i=="string"&&+i==i)return+i;if(i instanceof Date)return i.getTime()/1e3;if(isFinite(i))return i<0?Date.now()/1e3:i;throw new Error("Cannot parse time: "+i)}c(Dr,"toUnixTimestamp");function Da(i){if(typeof i!="number")throw TypeError(Oc.ERRSTR.UID)}c(Da,"validateUid");function Na(i){if(typeof i!="number")throw TypeError(Oc.ERRSTR.GID)}c(Na,"validateGid");var Ap=class Ap{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new xp.Superblock){this._core=e,this.promisesApi=new kF.FsPromises(this,FF.FileHandle),this.openSync=(l,a,g=438)=>{let y=(0,Se.modeToNumber)(g),b=(0,Se.pathToFilename)(l),S=(0,Se.flagsToNumber)(a);return this._core.open(b,S,y,!(S&A0))},this.open=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&(b=438,S=g),b=b||438;let F=(0,Se.modeToNumber)(b),T=(0,Se.pathToFilename)(l),P=(0,Se.flagsToNumber)(a);this.wrapAsync(this._core.open,[T,P,F,!(P&A0)],S)},this.closeSync=l=>{this._core.close(l)},this.close=(l,a)=>{(0,dr.validateFd)(l);let g=this._core.getFileByFdOrThrow(l,"close");this.wrapAsync(this._core.close,[g.fd],a)},this.readSync=(l,a,g,y,b)=>((0,dr.validateFd)(l),this._core.read(l,a,g,y,b)),this.read=(l,a,g,y,b,S)=>{if((0,Se.validateCallback)(S),y===0)return(0,Pc.default)(()=>{S&&S(null,0,a)});Promise.resolve().then(()=>{try{let F=this._core.read(l,a,g,y,b);S(null,F,a)}catch(F){S(F)}})},this.readv=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[null,g]),(0,Se.validateCallback)(S),Promise.resolve().then(()=>{try{let F=this._core.readv(l,a,b);S(null,F,a)}catch(F){S(F)}})},this.readvSync=(l,a,g)=>((0,dr.validateFd)(l),this._core.readv(l,a,g??null)),this._readfile=(l,a,g)=>{let y,S=typeof l=="number"&&(0,dr.isFd)(l),F;if(S)F=l;else{let T=(0,Se.pathToFilename)(l),P=String(l),$=P.length>1&&P.endsWith("/"),R=this._core.getResolvedLinkOrThrow(T,"open"),M=R.getNode();if(M.isDirectory())throw(0,Se.createError)("EISDIR","open",R.getPath());if($&&M.isFile())throw(0,Se.createError)("ENOTDIR","open",P);F=this.openSync(l,a)}try{y=(0,Se.bufferToEncoding)(this._core.getFileByFdOrThrow(F).getBuffer(),g)}finally{S||this.closeSync(F)}return y},this.readFileSync=(l,a)=>{let g=(0,Et.getReadFileOptions)(a),y=(0,Se.flagsToNumber)(g.flag);return this._readfile(l,y,g.encoding)},this.readFile=(l,a,g)=>{let[y,b]=(0,Et.optsAndCbGenerator)(Et.getReadFileOptions)(a,g),S=(0,Se.flagsToNumber)(y.flag);this.wrapAsync(this._readfile,[l,S,y.encoding],b)},this.writeSync=(l,a,g,y,b)=>{let[,S,F,T,P]=(0,Se.getWriteSyncArgs)(l,a,g,y,b);return this._write(l,S,F,T,P)},this.write=(l,a,g,y,b,S)=>{let[,F,T,P,$,R,M]=(0,Se.getWriteArgs)(l,a,g,y,b,S);Promise.resolve().then(()=>{try{let C=this._write(l,T,P,$,R);F?M(null,C,a):M(null,C,T)}catch(C){M(C)}})},this.writev=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[null,g]),(0,Se.validateCallback)(S),Promise.resolve().then(()=>{try{let F=this.writevBase(l,a,b);S(null,F,a)}catch(F){S(F)}})},this.writevSync=(l,a,g)=>((0,dr.validateFd)(l),this.writevBase(l,a,g??null)),this.writeFileSync=(l,a,g)=>{let y=(0,Et.getWriteFileOptions)(g),b=(0,Se.flagsToNumber)(y.flag),S=(0,Se.modeToNumber)(y.mode),F=(0,dr.dataToBuffer)(a,y.encoding);this._core.writeFile(l,F,b,S)},this.writeFile=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[Et.writeFileDefaults,g]);let F=(0,Se.validateCallback)(S),T=(0,Et.getWriteFileOptions)(b),P=(0,Se.flagsToNumber)(T.flag),$=(0,Se.modeToNumber)(T.mode),R=(0,dr.dataToBuffer)(a,T.encoding);this.wrapAsync(this._core.writeFile,[l,R,P,$],F)},this.copyFileSync=(l,a,g)=>{let y=(0,Se.pathToFilename)(l),b=(0,Se.pathToFilename)(a);return this._copyFile(y,b,(g||0)|0)},this.copyFile=(l,a,g,y)=>{let b=(0,Se.pathToFilename)(l),S=(0,Se.pathToFilename)(a),F,T;typeof g=="function"?[F,T]=[0,g]:[F,T]=[g,y],(0,Se.validateCallback)(T),this.wrapAsync(this._copyFile,[b,S,F],T)},this._cp=(l,a,g)=>{if(g.filter&&!g.filter(l,a))return;let y=g.dereference?this.statSync(l):this.lstatSync(l),b=null;try{b=this.lstatSync(a)}catch(S){if(S.code!=="ENOENT")throw S}if(b&&y.ino===b.ino&&y.dev===b.dev)throw(0,Se.createError)("EINVAL","cp",l,a);if(b){if(y.isDirectory()&&!b.isDirectory())throw(0,Se.createError)("EISDIR","cp",l,a);if(!y.isDirectory()&&b.isDirectory())throw(0,Se.createError)("ENOTDIR","cp",l,a)}if(y.isDirectory()&&this.isSrcSubdir(l,a))throw(0,Se.createError)("EINVAL","cp",l,a);{let S=P0(a);this.existsSync(S)||this.mkdirSync(S,{recursive:!0})}if(y.isDirectory()){if(!g.recursive)throw(0,Se.createError)("EISDIR","cp",l);this.cpDirSync(y,b,l,a,g)}else if(y.isFile()||y.isCharacterDevice()||y.isBlockDevice())this.cpFileSync(y,b,l,a,g);else if(y.isSymbolicLink()&&!g.dereference)this.cpSymlinkSync(b,l,a,g);else throw(0,Se.createError)("EINVAL","cp",l)},this.linkSync=(l,a)=>{let g=(0,Se.pathToFilename)(l),y=(0,Se.pathToFilename)(a);this._core.link(g,y)},this.link=(l,a,g)=>{let y=(0,Se.pathToFilename)(l),b=(0,Se.pathToFilename)(a);this.wrapAsync(this._core.link,[y,b],g)},this.unlinkSync=l=>{let a=(0,Se.pathToFilename)(l);this._core.unlink(a)},this.unlink=(l,a)=>{let g=(0,Se.pathToFilename)(l);this.wrapAsync(this._core.unlink,[g],a)},this.symlinkSync=(l,a,g)=>{let y=(0,Se.pathToFilename)(l),b=(0,Se.pathToFilename)(a);this._core.symlink(y,b)},this.symlink=(l,a,g,y)=>{let b=(0,Se.validateCallback)(typeof g=="function"?g:y),S=(0,Se.pathToFilename)(l),F=(0,Se.pathToFilename)(a);this.wrapAsync(this._core.symlink,[S,F],b)},this._lstat=(l,a=!1,g=!1)=>{let y;try{y=this._core.getLinkOrThrow(l,"lstat")}catch(b){if(b.code==="ENOENT"&&!g)return;throw b}return Rp.default.build(y.getNode(),a)},this.lstatSync=(l,a)=>{let{throwIfNoEntry:g=!0,bigint:y=!1}=(0,Et.getStatOptions)(a);return this._lstat((0,Se.pathToFilename)(l),y,g)},this.renameSync=(l,a)=>{let g=(0,Se.pathToFilename)(l),y=(0,Se.pathToFilename)(a);this._core.rename(g,y)},this.rename=(l,a,g)=>{let y=(0,Se.pathToFilename)(l),b=(0,Se.pathToFilename)(a);this.wrapAsync(this._core.rename,[y,b],g)},this.existsSync=l=>{try{return this._exists((0,Se.pathToFilename)(l))}catch{return!1}},this.exists=(l,a)=>{let g=(0,Se.pathToFilename)(l);if(typeof a!="function")throw Error(Oc.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(g))}catch{a(!1)}})},this.accessSync=(l,a=Tp)=>{let g=(0,Se.pathToFilename)(l);a=a|0,this._access(g,a)},this.access=(l,a,g)=>{let y=Tp,b;typeof a!="function"?[y,b]=[a|0,(0,Se.validateCallback)(g)]:b=a;let S=(0,Se.pathToFilename)(l);this.wrapAsync(this._access,[S,y],b)},this.appendFileSync=(l,a,g)=>{let y=(0,Et.getAppendFileOpts)(g);(!y.flag||(0,dr.isFd)(l))&&(y.flag="a"),this.writeFileSync(l,a,y)},this.appendFile=(l,a,g,y)=>{let[b,S]=(0,Et.getAppendFileOptsAndCb)(g,y);(!b.flag||(0,dr.isFd)(l))&&(b.flag="a"),this.writeFile(l,a,b,S)},this._readdir=(l,a)=>{let g=(0,dr.filenameToSteps)(l),y=this._core.getResolvedLinkOrThrow(l,"scandir"),b=y.getNode();if(!b.isDirectory())throw(0,Se.createError)("ENOTDIR","scandir",l);if(!b.canRead())throw(0,Se.createError)("EACCES","scandir",l);let S=[];for(let T of y.children.keys()){let P=y.getChild(T);if(!(!P||T==="."||T==="..")&&(S.push(_F.default.build(P,a.encoding)),a.recursive&&P.children.size)){let $={...a,recursive:!0,withFileTypes:!0},R=this._readdir(P.getPath(),$);S.push(...R)}}if(!dr.isWin&&a.encoding!=="buffer"&&S.sort((T,P)=>T.name<P.name?-1:T.name>P.name?1:0),a.withFileTypes)return S;let F=l;return dr.isWin&&(F=F.replace(/\\/g,"/")),S.map(T=>{if(a.recursive){let P=Op(T.parentPath,T.name.toString());return dr.isWin&&(P=P.replace(/\\/g,"/")),P.replace(F+Kt.posix.sep,"")}return T.name})},this.readdirSync=(l,a)=>{let g=(0,Et.getReaddirOptions)(a),y=(0,Se.pathToFilename)(l);return this._readdir(y,g)},this.readdir=(l,a,g)=>{let[y,b]=(0,Et.getReaddirOptsAndCb)(a,g),S=(0,Se.pathToFilename)(l);this.wrapAsync(this._readdir,[S,y],b)},this._readlink=(l,a)=>{let y=this._core.getLinkOrThrow(l,"readlink").getNode();if(!y.isSymlink())throw(0,Se.createError)("EINVAL","readlink",l);return(0,is.strToEncoding)(y.symlink,a)},this.readlinkSync=(l,a)=>{let g=(0,Et.getDefaultOpts)(a),y=(0,Se.pathToFilename)(l);return this._readlink(y,g.encoding)},this.readlink=(l,a,g)=>{let[y,b]=(0,Et.getDefaultOptsAndCb)(a,g),S=(0,Se.pathToFilename)(l);this.wrapAsync(this._readlink,[S,y.encoding],b)},this._fsync=l=>{this._core.getFileByFdOrThrow(l,"fsync")},this.fsyncSync=l=>{this._fsync(l)},this.fsync=(l,a)=>{this.wrapAsync(this._fsync,[l],a)},this._fdatasync=l=>{this._core.getFileByFdOrThrow(l,"fdatasync")},this.fdatasyncSync=l=>{this._fdatasync(l)},this.fdatasync=(l,a)=>{this.wrapAsync(this._fdatasync,[l],a)},this._ftruncate=(l,a)=>{this._core.getFileByFdOrThrow(l,"ftruncate").truncate(a)},this.ftruncateSync=(l,a)=>{this._ftruncate(l,a)},this.ftruncate=(l,a,g)=>{let y=typeof a=="number"?a:0,b=(0,Se.validateCallback)(typeof a=="number"?g:a);this.wrapAsync(this._ftruncate,[l,y],b)},this._truncate=(l,a)=>{let g=this.openSync(l,"r+");try{this.ftruncateSync(g,a)}finally{this.closeSync(g)}},this.truncateSync=(l,a)=>{if((0,dr.isFd)(l))return this.ftruncateSync(l,a);this._truncate(l,a)},this.truncate=(l,a,g)=>{let y=typeof a=="number"?a:0,b=(0,Se.validateCallback)(typeof a=="number"?g:a);if((0,dr.isFd)(l))return this.ftruncate(l,y,b);this.wrapAsync(this._truncate,[l,y],b)},this._futimes=(l,a,g)=>{let b=this._core.getFileByFdOrThrow(l,"futimes").node;b.atime=new Date(a*1e3),b.mtime=new Date(g*1e3)},this.futimesSync=(l,a,g)=>{this._futimes(l,Dr(a),Dr(g))},this.futimes=(l,a,g,y)=>{this.wrapAsync(this._futimes,[l,Dr(a),Dr(g)],y)},this._utimes=(l,a,g,y=!0)=>{let b=this._core,F=(y?b.getResolvedLinkOrThrow(l,"utimes"):b.getLinkOrThrow(l,"lutimes")).getNode();F.atime=new Date(a*1e3),F.mtime=new Date(g*1e3)},this.utimesSync=(l,a,g)=>{this._utimes((0,Se.pathToFilename)(l),Dr(a),Dr(g),!0)},this.utimes=(l,a,g,y)=>{this.wrapAsync(this._utimes,[(0,Se.pathToFilename)(l),Dr(a),Dr(g),!0],y)},this.lutimesSync=(l,a,g)=>{this._utimes((0,Se.pathToFilename)(l),Dr(a),Dr(g),!1)},this.lutimes=(l,a,g,y)=>{this.wrapAsync(this._utimes,[(0,Se.pathToFilename)(l),Dr(a),Dr(g),!1],y)},this.mkdirSync=(l,a)=>{let g=(0,Et.getMkdirOptions)(a),y=(0,Se.modeToNumber)(g.mode,511),b=(0,Se.pathToFilename)(l);if(g.recursive)return this._core.mkdirp(b,y);this._core.mkdir(b,y)},this.mkdir=(l,a,g)=>{let y=(0,Et.getMkdirOptions)(a),b=(0,Se.validateCallback)(typeof a=="function"?a:g),S=(0,Se.modeToNumber)(y.mode,511),F=(0,Se.pathToFilename)(l);y.recursive?this.wrapAsync(this._core.mkdirp,[F,S],b):this.wrapAsync(this._core.mkdir,[F,S],b)},this._mkdtemp=(l,a,g=5)=>{let y=l+(0,Se.genRndStr6)();try{return this._core.mkdir(y,511),(0,is.strToEncoding)(y,a)}catch(b){if(b.code==="EEXIST"){if(g>1)return this._mkdtemp(l,a,g-1);throw Error("Could not create temp dir.")}else throw b}},this.mkdtempSync=(l,a)=>{let{encoding:g}=(0,Et.getDefaultOpts)(a);if(!l||typeof l!="string")throw new TypeError("filename prefix is required");return(0,Se.nullCheck)(l),this._mkdtemp(l,g)},this.mkdtemp=(l,a,g)=>{let[{encoding:y},b]=(0,Et.getDefaultOptsAndCb)(a,g);if(!l||typeof l!="string")throw new TypeError("filename prefix is required");(0,Se.nullCheck)(l)&&this.wrapAsync(this._mkdtemp,[l,y],b)},this.rmdirSync=(l,a)=>{let g=(0,Et.getRmdirOptions)(a);this._core.rmdir((0,Se.pathToFilename)(l),g.recursive)},this.rmdir=(l,a,g)=>{let y=(0,Et.getRmdirOptions)(a),b=(0,Se.validateCallback)(typeof a=="function"?a:g);this.wrapAsync(this._core.rmdir,[(0,Se.pathToFilename)(l),y.recursive],b)},this.rmSync=(l,a)=>{this._core.rm((0,Se.pathToFilename)(l),a?.force,a?.recursive)},this.rm=(l,a,g)=>{let[y,b]=(0,Et.getRmOptsAndCb)(a,g);this.wrapAsync(this._core.rm,[(0,Se.pathToFilename)(l),y?.force,y?.recursive],b)},this._fchmod=(l,a)=>{this._core.getFileByFdOrThrow(l,"fchmod").chmod(a)},this.fchmodSync=(l,a)=>{this._fchmod(l,(0,Se.modeToNumber)(a))},this.fchmod=(l,a,g)=>{this.wrapAsync(this._fchmod,[l,(0,Se.modeToNumber)(a)],g)},this._chmod=(l,a,g=!0)=>{(g?this._core.getResolvedLinkOrThrow(l,"chmod"):this._core.getLinkOrThrow(l,"chmod")).getNode().chmod(a)},this.chmodSync=(l,a)=>{let g=(0,Se.modeToNumber)(a),y=(0,Se.pathToFilename)(l);this._chmod(y,g,!0)},this.chmod=(l,a,g)=>{let y=(0,Se.modeToNumber)(a),b=(0,Se.pathToFilename)(l);this.wrapAsync(this._chmod,[b,y],g)},this._lchmod=(l,a)=>{this._chmod(l,a,!1)},this.lchmodSync=(l,a)=>{let g=(0,Se.modeToNumber)(a),y=(0,Se.pathToFilename)(l);this._lchmod(y,g)},this.lchmod=(l,a,g)=>{let y=(0,Se.modeToNumber)(a),b=(0,Se.pathToFilename)(l);this.wrapAsync(this._lchmod,[b,y],g)},this._fchown=(l,a,g)=>{this._core.getFileByFdOrThrow(l,"fchown").chown(a,g)},this.fchownSync=(l,a,g)=>{Da(a),Na(g),this._fchown(l,a,g)},this.fchown=(l,a,g,y)=>{Da(a),Na(g),this.wrapAsync(this._fchown,[l,a,g],y)},this._chown=(l,a,g)=>{this._core.getResolvedLinkOrThrow(l,"chown").getNode().chown(a,g)},this.chownSync=(l,a,g)=>{Da(a),Na(g),this._chown((0,Se.pathToFilename)(l),a,g)},this.chown=(l,a,g,y)=>{Da(a),Na(g),this.wrapAsync(this._chown,[(0,Se.pathToFilename)(l),a,g],y)},this._lchown=(l,a,g)=>{this._core.getLinkOrThrow(l,"lchown").getNode().chown(a,g)},this.lchownSync=(l,a,g)=>{Da(a),Na(g),this._lchown((0,Se.pathToFilename)(l),a,g)},this.lchown=(l,a,g,y)=>{Da(a),Na(g),this.wrapAsync(this._lchown,[(0,Se.pathToFilename)(l),a,g],y)},this.statWatchers={},this.cpSync=(l,a,g)=>{let y=(0,Se.pathToFilename)(l),b=(0,Se.pathToFilename)(a),S={dereference:g?.dereference??!1,errorOnExist:g?.errorOnExist??!1,filter:g?.filter,force:g?.force??!0,mode:g?.mode??0,preserveTimestamps:g?.preserveTimestamps??!1,recursive:g?.recursive??!1,verbatimSymlinks:g?.verbatimSymlinks??!1};return this._cp(y,b,S)},this.cp=(l,a,g,y)=>{let b=(0,Se.pathToFilename)(l),S=(0,Se.pathToFilename)(a),F,T;typeof g=="function"?[F,T]=[{},g]:[F,T]=[g||{},y],(0,Se.validateCallback)(T);let P={dereference:F?.dereference??!1,errorOnExist:F?.errorOnExist??!1,filter:F?.filter,force:F?.force??!0,mode:F?.mode??0,preserveTimestamps:F?.preserveTimestamps??!1,recursive:F?.recursive??!1,verbatimSymlinks:F?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[b,S,P],T)},this.openAsBlob=async(l,a)=>{let g=(0,Se.pathToFilename)(l),y;try{y=this._core.getResolvedLinkOrThrow(g,"open")}catch(T){throw T&&typeof T=="object"&&T.code==="ENOENT"?new TF.TypeError("ERR_INVALID_ARG_VALUE"):T}let S=y.getNode().getBuffer(),F=a?.type||"";return new Blob([S],{type:F})},this.glob=(l,...a)=>{let[g,y]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[l,g||{}],y)},this.globSync=(l,a={})=>this._globSync(l,a),this._globSync=(l,a={})=>{let{globSync:g}=x0();return g(this,l,a)},this._opendir=(l,a)=>{let g=this._core.getResolvedLinkOrThrow(l,"scandir");if(!g.getNode().isDirectory())throw(0,Se.createError)("ENOTDIR","scandir",l);return new OF.Dir(g,a)},this.opendirSync=(l,a)=>{let g=(0,Et.getOpendirOptions)(a),y=(0,Se.pathToFilename)(l);return this._opendir(y,g)},this.opendir=(l,a,g)=>{let[y,b]=(0,Et.getOpendirOptsAndCb)(a,g),S=(0,Se.pathToFilename)(l);this.wrapAsync(this._opendir,[S,y],b)};let t=this;this.StatWatcher=class extends xc{constructor(){super(t)}};let r=ui;this.ReadStream=class extends r{constructor(...l){super(t,...l)}};let n=Vr;this.WriteStream=class extends n{constructor(...l){super(t,...l)}},this.FSWatcher=class extends Ac{constructor(){super(t)}};let o=c((l,a)=>{let g=this._core.getResolvedLinkOrThrow(l,"realpath");return(0,is.strToEncoding)(g.getPath()||"/",a)},"_realpath"),f=c((l,a,g)=>{let[y,b]=(0,Et.getRealpathOptsAndCb)(a,g),S=(0,Se.pathToFilename)(l);t.wrapAsync(o,[S,y.encoding],b)},"realpathImpl"),m=c((l,a)=>o((0,Se.pathToFilename)(l),(0,Et.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=f,this.realpath.native=f,this.realpathSync=m,this.realpathSync.native=m}wrapAsync(e,t,r){(0,Se.validateCallback)(r),Promise.resolve().then(()=>{let n;try{n=e.apply(this,t)}catch(o){r(o);return}r(null,n)})}toTree(e={separator:Kt.sep}){return(0,RF.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,t={},r=!1,n=!1){return this._core.toJSON(e,t,r,n)}fromJSON(e,t){return this._core.fromJSON(e,t)}fromNestedJSON(e,t){return this._core.fromNestedJSON(e,t)}mountSync(e,t){this._core.fromJSON(t,e)}_write(e,t,r,n,o){let f=this._core.getFileByFdOrThrow(e,"write");if(f.node.isSymlink())throw(0,Se.createError)("EBADF","write",f.link.getPath());return f.write(t,r,n,o===-1||typeof o!="number"?void 0:o)}writevBase(e,t,r){let n=this._core.getFileByFdOrThrow(e),o=r??void 0;o===-1&&(o=void 0);let f=0;for(let m of t){let l=Ca.Buffer.from(m.buffer,m.byteOffset,m.byteLength),a=n.write(l,0,l.byteLength,o);if(o=void 0,f+=a,a<l.byteLength)break}return f}_copyFile(e,t,r){let n=this.readFileSync(e);if(r&NF&&this.existsSync(t))throw(0,Se.createError)("EEXIST","copyFile",e,t);if(r&CF)throw(0,Se.createError)("ENOSYS","copyFile",e,t);this._core.writeFile(t,n,Oc.FLAGS.w,438)}isSrcSubdir(e,t){try{let r=D0(e.startsWith("/")?e:"/"+e),n=D0(t.startsWith("/")?t:"/"+t);if(r===n)return!0;let o=Tc(r,n);return o===""||!o.startsWith("..")&&!(0,Kt.isAbsolute)(o)}catch{return!1}}cpFileSync(e,t,r,n,o){if(t){if(o.errorOnExist)throw(0,Se.createError)("EEXIST","cp",n);if(!o.force)return;this.unlinkSync(n)}this.copyFileSync(r,n,o.mode),o.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,t,r,n,o){t||this.mkdirSync(n);let f=this.readdirSync(r);for(let m of f){let l=Op(r,String(m)),a=Op(n,String(m));o.filter&&!o.filter(l,a)||this._cp(l,a,o)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,t,r,n){let o=String(this.readlinkSync(t));!n.verbatimSymlinks&&!(0,Kt.isAbsolute)(o)&&(o=xF(P0(t),o)),e&&this.unlinkSync(r),this.symlinkSync(o,r)}lstat(e,t,r){let[{throwIfNoEntry:n=!0,bigint:o=!1},f]=(0,Et.getStatOptsAndCb)(t,r);this.wrapAsync(this._lstat,[(0,Se.pathToFilename)(e),o,n],f)}_stat(e,t=!1,r=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(o){if(o.code==="ENOENT"&&!r)return;throw o}return Rp.default.build(n.getNode(),t)}statSync(e,t){let{bigint:r=!0,throwIfNoEntry:n=!0}=(0,Et.getStatOptions)(t);return this._stat((0,Se.pathToFilename)(e),r,n)}stat(e,t,r){let[{bigint:n=!1,throwIfNoEntry:o=!0},f]=(0,Et.getStatOptsAndCb)(t,r);this.wrapAsync(this._stat,[(0,Se.pathToFilename)(e),n,o],f)}fstatBase(e,t=!1){let r=this._core.getFileByFd(e);if(!r)throw(0,Se.createError)("EBADF","fstat");return Rp.default.build(r.node,t)}fstatSync(e,t){return this.fstatBase(e,(0,Et.getStatOptions)(t).bigint)}fstat(e,t,r){let[n,o]=(0,Et.getStatOptsAndCb)(t,r);this.wrapAsync(this.fstatBase,[e,n.bigint],o)}_exists(e){return!!this._stat(e)}_access(e,t){let n=this._core.getLinkOrThrow(e,"access").getNode();if(t!==Tp&&(t&AF&&!n.canRead()||t&PF&&!n.canWrite()||t&DF&&!n.canExecute()))throw(0,Se.createError)("EACCES","access",e)}watchFile(e,t,r){let n=(0,Se.pathToFilename)(e),o=t,f=r;if(typeof o=="function"&&(f=t,o=null),typeof f!="function")throw Error('"watchFile()" requires a listener function');let m=5007,l=!0;o&&typeof o=="object"&&(typeof o.interval=="number"&&(m=o.interval),typeof o.persistent=="boolean"&&(l=o.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,l,m),this.statWatchers[n]=a),a.addListener("change",f),a}unwatchFile(e,t){let r=(0,Se.pathToFilename)(e),n=this.statWatchers[r];n&&(typeof t=="function"?n.removeListener("change",t):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[r]))}createReadStream(e,t){return new this.ReadStream(e,t)}createWriteStream(e,t){return new this.WriteStream(e,t)}watch(e,t,r){let n=(0,Se.pathToFilename)(e),o=t;typeof t=="function"&&(r=t,o=null);let{persistent:f,recursive:m,encoding:l}=(0,Et.getDefaultOpts)(o);f===void 0&&(f=!0),m===void 0&&(m=!1);let a=new this.FSWatcher;return a.start(n,f,m,l),r&&a.addListener("change",r),a}_statfs(e,t=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),vF.default.build(this._core,t)}statfsSync(e,t){let{bigint:r=!1}=(0,Et.getStatfsOptions)(t);return this._statfs((0,Se.pathToFilename)(e),r)}statfs(e,t,r){let[{bigint:n=!1},o]=(0,Et.getStatfsOptsAndCb)(t,r);this.wrapAsync(this._statfs,[(0,Se.pathToFilename)(e),n],o)}};c(Ap,"Volume");var ns=Ap;Nr.Volume=ns;ns.fromJSON=(i,e)=>new ns(xp.Superblock.fromJSON(i,e));ns.fromNestedJSON=(i,e)=>new ns(xp.Superblock.fromNestedJSON(i,e));function MF(i){i.emit("stop")}c(MF,"emitStop");var Pp=class Pp extends N0.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let t=this.vol.statSync(this.filename);this.hasChanged(t)&&(this.emit("change",t,this.prev),this.prev=t)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,t=!0,r=5007){this.filename=(0,Se.pathToFilename)(e),this.setTimeout=t?setTimeout.bind(globalThis):SF.default,this.interval=r,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Pc.default)(()=>{MF.call(this,this)})}};c(Pp,"StatWatcher");var xc=Pp;Nr.StatWatcher=xc;var Gr;function $F(i){Gr=(0,Ca.bufferAllocUnsafe)(i),Gr.used=0}c($F,"allocNewPool");(0,C0.inherits)(ui,Dc.Readable);Nr.ReadStream=ui;function ui(i,e,t){if(!(this instanceof ui))return new ui(i,e,t);if(this._vol=i,t=Object.assign({},(0,Et.getOptions)(t,{})),t.highWaterMark===void 0&&(t.highWaterMark=64*1024),Dc.Readable.call(this,t),this.path=(0,Se.pathToFilename)(e),this.fd=t.fd===void 0?null:typeof t.fd!="number"?t.fd.fd:t.fd,this.flags=t.flags===void 0?"r":t.flags,this.mode=t.mode===void 0?438:t.mode,this.start=t.start,this.end=t.end,this.autoClose=t.autoClose===void 0?!0:t.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}c(ui,"FsReadStream");ui.prototype.open=function(){var i=this;this._vol.open(this.path,this.flags,this.mode,(e,t)=>{if(e){i.autoClose&&i.destroy&&i.destroy(),i.emit("error",e);return}i.fd=t,i.emit("open",t),i.read()})};ui.prototype._read=function(i){if(typeof this.fd!="number")return this.once("open",function(){this._read(i)});if(this.destroyed)return;(!Gr||Gr.length-Gr.used<IF)&&$F(this._readableState.highWaterMark);var e=Gr,t=Math.min(Gr.length-Gr.used,i),r=Gr.used;if(this.pos!==void 0&&(t=Math.min(this.end-this.pos+1,t)),t<=0)return this.push(null);var n=this;this._vol.read(this.fd,Gr,Gr.used,t,this.pos,o),this.pos!==void 0&&(this.pos+=t),Gr.used+=t;function o(f,m){if(f)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",f);else{var l=null;m>0&&(n.bytesRead+=m,l=e.slice(r,r+m)),n.push(l)}}c(o,"onread")};ui.prototype._destroy=function(i,e){this.close(t=>{e(i||t)})};ui.prototype.close=function(i){if(i&&this.once("close",i),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",I0);return}return(0,Pc.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function I0(i){this.close()}c(I0,"closeOnOpen");(0,C0.inherits)(Vr,Dc.Writable);Nr.WriteStream=Vr;function Vr(i,e,t){if(!(this instanceof Vr))return new Vr(i,e,t);if(this._vol=i,t=Object.assign({},(0,Et.getOptions)(t,{})),Dc.Writable.call(this,t),this.path=(0,Se.pathToFilename)(e),this.fd=t.fd===void 0?null:typeof t.fd!="number"?t.fd.fd:t.fd,this.flags=t.flags===void 0?"w":t.flags,this.mode=t.mode===void 0?438:t.mode,this.start=t.start,this.autoClose=t.autoClose===void 0?!0:!!t.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}t.encoding&&this.setDefaultEncoding(t.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}c(Vr,"FsWriteStream");Vr.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(i,e){if(i){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",i);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Vr.prototype._write=function(i,e,t){if(!(i instanceof Ca.Buffer||i instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(i,e,t)});var r=this;this._vol.write(this.fd,i,0,i.length,this.pos,(n,o)=>{if(n)return r.autoClose&&r.destroy&&r.destroy(),t(n);r.bytesWritten+=o,t()}),this.pos!==void 0&&(this.pos+=i.length)};Vr.prototype._writev=function(i,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(i,e)});let t=this,r=i.length,n=new Array(r);for(var o=0,f=0;f<r;f++){var m=i[f].chunk;n[f]=m,o+=m.length}let l=Ca.Buffer.concat(n);this._vol.write(this.fd,l,0,l.length,this.pos,(a,g)=>{if(a)return t.destroy&&t.destroy(),e(a);t.bytesWritten+=g,e()}),this.pos!==void 0&&(this.pos+=o)};Vr.prototype.close=function(i){if(i&&this.once("close",i),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",I0);return}return(0,Pc.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Vr.prototype._destroy=ui.prototype._destroy;Vr.prototype.destroySoon=Vr.prototype.end;var Dp=class Dp extends N0.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=is.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=t=>{t.getName()===this._getName()&&this._emit("rename")},this._emit=t=>{this.emit("change",t,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,t=!0,r=!1,n=is.ENCODING_UTF8){this._filename=(0,Se.pathToFilename)(e),this._steps=(0,dr.filenameToSteps)(this._filename),this._filenameEncoded=(0,is.strToEncoding)(this._filename),this._recursive=r,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(l){let a=new Error(`watch ${this._filename} ${l.code}`);throw a.code=l.code,a.errno=l.code,a}let o=c(l=>{let a=l.getPath(),g=l.getNode(),y=c(()=>{let F=Tc(this._filename,a);return F||(F=this._getName()),this.emit("change","change",F)},"onNodeChange"),b=g.changes.listen(([F])=>{F==="modify"&&y()}),S=this._listenerRemovers.get(g.ino)??[];S.push(()=>b()),this._listenerRemovers.set(g.ino,S)},"watchLinkNodeChanged"),f=c(l=>{let a=l.getNode(),g=c(F=>{this.emit("change","rename",Tc(this._filename,F.getPath())),o(F),f(F)},"onLinkChildAdd"),y=c(F=>{let T=c(P=>{let $=P.getNode().ino,R=this._listenerRemovers.get($);R&&(R.forEach(M=>M()),this._listenerRemovers.delete($));for(let[M,C]of P.children.entries())C&&M!=="."&&M!==".."&&T(C)},"removeLinkNodeListeners");T(F),this.emit("change","rename",Tc(this._filename,F.getPath()))},"onLinkChildDelete");for(let[F,T]of l.children.entries())T&&F!=="."&&F!==".."&&o(T);let b=l.changes.listen(([F,T])=>{F==="child:add"?g(T):F==="child:del"&&y(T)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{b()}),r)for(let[F,T]of l.children.entries())T&&F!=="."&&F!==".."&&f(T)},"watchLinkChildrenChanged");o(this._link),f(this._link);let m=this._link.parent;m&&m.changes.listen(([l,a])=>{l==="child:del"&&this._onParentChild(a)}),t&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(t=>t())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};c(Dp,"FSWatcher");var Ac=Dp;Nr.FSWatcher=Ac});var j0=Ze(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.fsSynchronousApiList=void 0;Nc.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var M0=Ze(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.fsCallbackApiList=void 0;Cc.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var Ia=Ze((Cr,Ic)=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.memfs=Cr.fs=Cr.vol=Cr.Volume=void 0;Cr.createFsFromVolume=Np;var LF=Id(),UF=zl(),Bc=B0();Object.defineProperty(Cr,"Volume",{enumerable:!0,get:c(function(){return Bc.Volume},"get")});var $0=ii(),WF=j0(),qF=M0(),{F_OK:zF,R_OK:HF,W_OK:GF,X_OK:VF}=$0.constants;Cr.vol=new Bc.Volume;function Np(i){let e={F_OK:zF,R_OK:HF,W_OK:GF,X_OK:VF,constants:$0.constants,Stats:LF.default,Dirent:UF.default};for(let t of WF.fsSynchronousApiList)typeof i[t]=="function"&&(e[t]=i[t].bind(i));for(let t of qF.fsCallbackApiList)typeof i[t]=="function"&&(e[t]=i[t].bind(i));return e.StatWatcher=i.StatWatcher,e.FSWatcher=i.FSWatcher,e.WriteStream=i.WriteStream,e.ReadStream=i.ReadStream,e.promises=i.promises,typeof i.realpath=="function"&&(e.realpath=i.realpath.bind(i),typeof i.realpath.native=="function"&&(e.realpath.native=i.realpath.native.bind(i))),typeof i.realpathSync=="function"&&(e.realpathSync=i.realpathSync.bind(i),typeof i.realpathSync.native=="function"&&(e.realpathSync.native=i.realpathSync.native.bind(i))),e._toUnixTimestamp=Bc.toUnixTimestamp,e.__vol=i,e}c(Np,"createFsFromVolume");Cr.fs=Np(Cr.vol);var KF=c((i={},e="/")=>{let t=Bc.Volume.fromNestedJSON(i,e);return{fs:Np(t),vol:t}},"memfs");Cr.memfs=KF;Ic.exports={...Ic.exports,...Cr.fs};Ic.exports.semantic=!0});var qp=Ze((gC,$c)=>{function W0(i){return Array.isArray(i)?i:[i]}c(W0,"makeArray");var JF=void 0,Ip="",L0=" ",Cp="\\",YF=/^\s+$/,XF=/(?:[^\\]|^)\\$/,QF=/^\\!/,ZF=/^\\#/,ek=/\r?\n/g,tk=/^\.{0,2}\/|^\.{1,2}$/,rk=/\/$/,Ba="/",q0="node-ignore";typeof Symbol<"u"&&(q0=Symbol.for("node-ignore"));var z0=q0,ja=c((i,e,t)=>(Object.defineProperty(i,e,{value:t}),t),"define"),ik=/([0-z])-([0-z])/g,H0=c(()=>!1,"RETURN_FALSE"),nk=c(i=>i.replace(ik,(e,t,r)=>t.charCodeAt(0)<=r.charCodeAt(0)?e:Ip),"sanitizeRange"),sk=c(i=>{let{length:e}=i;return i.slice(0,e-e%2)},"cleanRangeBackSlash"),ak=[[/^\uFEFF/,()=>Ip],[/((?:\\\\)*?)(\\?\s+)$/,(i,e,t)=>e+(t.indexOf("\\")===0?L0:Ip)],[/(\\+?)\s/g,(i,e)=>{let{length:t}=e;return e.slice(0,t-t%2)+L0}],[/[\\$.|*+(){^]/g,i=>`\\${i}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,c(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(i,e,t)=>e+6<t.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(i,e,t)=>{let r=t.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Cp],[/\\\\/g,()=>Cp],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(i,e,t,r,n)=>e===Cp?`\\[${t}${sk(r)}${n}`:n==="]"&&r.length%2===0?`[${nk(t)}${r}]`:"[]"],[/(?:[^*])$/,i=>/\/$/.test(i)?`${i}$`:`${i}(?=$|\\/$)`]],ok=/(^|\\\/)?\\\*$/,Lo="regex",jc="checkRegex",U0="_",lk={[Lo](i,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[jc](i,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},ck=c(i=>ak.reduce((e,[t,r])=>e.replace(t,r.bind(i)),i),"makeRegexPrefix"),Mc=c(i=>typeof i=="string","isString"),fk=c(i=>i&&Mc(i)&&!YF.test(i)&&!XF.test(i)&&i.indexOf("#")!==0,"checkPattern"),hk=c(i=>i.split(ek).filter(Boolean),"splitPattern"),Lp=class Lp{constructor(e,t,r,n,o,f){this.pattern=e,this.mark=t,this.negative=o,ja(this,"body",r),ja(this,"ignoreCase",n),ja(this,"regexPrefix",f)}get regex(){let e=U0+Lo;return this[e]?this[e]:this._make(Lo,e)}get checkRegex(){let e=U0+jc;return this[e]?this[e]:this._make(jc,e)}_make(e,t){let r=this.regexPrefix.replace(ok,lk[e]),n=this.ignoreCase?new RegExp(r,"i"):new RegExp(r);return ja(this,t,n)}};c(Lp,"IgnoreRule");var Bp=Lp,uk=c(({pattern:i,mark:e},t)=>{let r=!1,n=i;n.indexOf("!")===0&&(r=!0,n=n.substr(1)),n=n.replace(QF,"!").replace(ZF,"#");let o=ck(n);return new Bp(i,e,n,t,r,o)},"createRule"),Up=class Up{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[z0]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Mc(e)&&(e={pattern:e}),fk(e.pattern)){let t=uk(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,W0(Mc(e)?hk(e):e).forEach(this._add,this),this._added}test(e,t,r){let n=!1,o=!1,f;this._rules.forEach(l=>{let{negative:a}=l;o===a&&n!==o||a&&!n&&!o&&!t||!l[r].test(e)||(n=!a,o=a,f=a?JF:l)});let m={ignored:n,unignored:o};return f&&(m.rule=f),m}};c(Up,"RuleManager");var jp=Up,dk=c((i,e)=>{throw new e(i)},"throwError"),Oi=c((i,e,t)=>Mc(i)?i?Oi.isNotRelative(i)?t(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:t("path must not be empty",TypeError):t(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),G0=c(i=>tk.test(i),"isNotRelative");Oi.isNotRelative=G0;Oi.convert=i=>i;var Wp=class Wp{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:r=!1}={}){ja(this,z0,!0),this._rules=new jp(t),this._strictPathCheck=!r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,r,n){let o=e&&Oi.convert(e);return Oi(o,e,this._strictPathCheck?dk:H0),this._t(o,t,r,n)}checkIgnore(e){if(!rk.test(e))return this.test(e);let t=e.split(Ba).filter(Boolean);if(t.pop(),t.length){let r=this._t(t.join(Ba)+Ba,this._testCache,!0,t);if(r.ignored)return r}return this._rules.test(e,!1,jc)}_t(e,t,r,n){if(e in t)return t[e];if(n||(n=e.split(Ba).filter(Boolean)),n.pop(),!n.length)return t[e]=this._rules.test(e,r,Lo);let o=this._t(n.join(Ba)+Ba,t,r,n);return t[e]=o.ignored?o:this._rules.test(e,r,Lo)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return W0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};c(Wp,"Ignore");var Mp=Wp,$p=c(i=>new Mp(i),"factory"),pk=c(i=>Oi(i&&Oi.convert(i),i,H0),"isPathValid"),V0=c(()=>{let i=c(t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/"),"makePosix");Oi.convert=i;let e=/^[a-z]:\//i;Oi.isNotRelative=t=>e.test(t)||G0(t)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&V0();$c.exports=$p;$p.default=$p;$c.exports.isPathValid=pk;ja($c.exports,Symbol.for("setupWindows"),V0)});var si=Ze(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.constants=Qa.SEP=void 0;Qa.SEP="/";Qa.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var hm=Ze(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.Stats=void 0;var iT=si(),{S_IFMT:nT,S_IFDIR:sT,S_IFREG:aT,S_IFBLK:oT,S_IFCHR:lT,S_IFLNK:cT,S_IFIFO:fT,S_IFSOCK:hT}=iT.constants,lf=class lf{static build(e,t=!1){let r=new lf,{uid:n,gid:o,atime:f,mtime:m,ctime:l}=e,a=t?y=>BigInt(y):y=>y;r.uid=a(n),r.gid=a(o),r.rdev=a(e.rdev),r.blksize=a(4096),r.ino=a(e.ino),r.size=a(e.getSize()),r.blocks=a(1),r.atime=f,r.mtime=m,r.ctime=l,r.birthtime=l,r.atimeMs=a(f.getTime()),r.mtimeMs=a(m.getTime());let g=a(l.getTime());if(r.ctimeMs=g,r.birthtimeMs=g,t){r.atimeNs=BigInt(f.getTime())*BigInt(1e6),r.mtimeNs=BigInt(m.getTime())*BigInt(1e6);let y=BigInt(l.getTime())*BigInt(1e6);r.ctimeNs=y,r.birthtimeNs=y}return r.dev=a(0),r.mode=a(e.mode),r.nlink=a(e.nlink),r}_checkModeProperty(e){return(Number(this.mode)&nT)===e}isDirectory(){return this._checkModeProperty(sT)}isFile(){return this._checkModeProperty(aT)}isBlockDevice(){return this._checkModeProperty(oT)}isCharacterDevice(){return this._checkModeProperty(lT)}isSymbolicLink(){return this._checkModeProperty(cT)}isFIFO(){return this._checkModeProperty(fT)}isSocket(){return this._checkModeProperty(hT)}};c(lf,"Stats");var of=lf;Yo.Stats=of;Yo.default=of});var tv=Ze(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.Buffer=void 0;var uT=rr("node:buffer");Object.defineProperty(cf,"Buffer",{enumerable:!0,get:c(function(){return uT.Buffer},"get")})});var Yi=Ze(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.bufferFrom=Ji.bufferAllocUnsafe=Ji.Buffer=void 0;var ff=tv();Object.defineProperty(Ji,"Buffer",{enumerable:!0,get:c(function(){return ff.Buffer},"get")});function rv(i,...e){return new ff.Buffer(i,...e)}c(rv,"bufferV0P12Ponyfill");var dT=ff.Buffer.allocUnsafe||rv;Ji.bufferAllocUnsafe=dT;var pT=ff.Buffer.from||rv;Ji.bufferFrom=pT});var dm=Ze(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.inherits=mT;Za.promisify=gT;Za.inspect=um;Za.format=yT;function mT(i,e){if(i==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");i.super_=e,i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}c(mT,"inherits");function gT(i){if(typeof i!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((t,r)=>{i.call(this,...e,(n,o)=>{n?r(n):t(o)})})}}c(gT,"promisify");function um(i){return i===null?"null":i===void 0?"undefined":typeof i=="string"?`'${i}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[ ${i.map(t=>um(t)).join(", ")} ]`:typeof i=="object"?`{ ${Object.entries(i).map(([t,r])=>`${t}: ${um(r)}`).join(", ")} }`:String(i)}c(um,"inspect");function yT(i,...e){if(e.length===0)return i;let t=i,r=0;for(t=t.replace(/%[sdj%]/g,n=>{if(r>=e.length)return n;let o=e[r++];switch(n){case"%s":return String(o);case"%d":return Number(o).toString();case"%j":try{return JSON.stringify(o)}catch{return"[Circular]"}case"%%":return"%";default:return n}});r<e.length;)t+=" "+String(e[r++]);return t}c(yT,"format")});var Xo=Ze(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.AssertionError=wr.RangeError=wr.TypeError=wr.Error=void 0;wr.message=sv;wr.E=Xi;var pm=dm(),iv=typeof Symbol>"u"?"_kCode":Symbol("code"),nv={};function gm(i){var e;return e=class extends i{constructor(r,...n){super(sv(r,n)),this.code=r,this[iv]=r,this.name=`${super.name} [${this[iv]}]`}},c(e,"NodeError"),e}c(gm,"makeNodeError");var hf=globalThis,ym=class ym extends hf.Error{constructor(e){if(typeof e!="object"||e===null)throw new wr.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,pm.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,pm.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,wr.Error.captureStackTrace(this,e.stackStartFunction)}};c(ym,"AssertionError");var mm=ym;wr.AssertionError=mm;function sv(i,e){if(typeof i!="string")throw new wr.Error("Error message key must be a string");let t=nv[i];if(!t)throw new wr.Error(`An invalid error message key was used: ${i}.`);let r;if(typeof t=="function")r=t;else{if(r=pm.format,e===void 0||e.length===0)return t;e.unshift(t)}return String(r.apply(null,e))}c(sv,"message");function Xi(i,e){nv[i]=typeof e=="function"?e:String(e)}c(Xi,"E");wr.Error=gm(hf.Error);wr.TypeError=gm(hf.TypeError);wr.RangeError=gm(hf.RangeError);Xi("ERR_DIR_CLOSED","Directory handle was closed");Xi("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Xi("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Xi("ERR_INVALID_FILE_URL_PATH","File URL path %s");Xi("ERR_INVALID_OPT_VALUE",(i,e)=>`The value "${String(e)}" is invalid for option "${i}"`);Xi("ERR_INVALID_OPT_VALUE_ENCODING",i=>`The value "${String(i)}" is invalid for option "encoding"`);Xi("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Qo=Ze(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.ENCODING_UTF8=void 0;os.assertEncoding=bT;os.strToEncoding=_T;var wm=Yi(),wT=Xo();os.ENCODING_UTF8="utf8";function bT(i){if(i&&!wm.Buffer.isEncoding(i))throw new wT.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",i)}c(bT,"assertEncoding");function _T(i,e){return!e||e===os.ENCODING_UTF8?i:e==="buffer"?new wm.Buffer(i):new wm.Buffer(i).toString(e)}c(_T,"strToEncoding")});var pf=Ze(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.Dirent=void 0;var vT=si(),ST=Qo(),{S_IFMT:ET,S_IFDIR:FT,S_IFREG:kT,S_IFBLK:RT,S_IFCHR:TT,S_IFLNK:OT,S_IFIFO:xT,S_IFSOCK:AT}=vT.constants,df=class df{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,t){let r=new df,{mode:n}=e.getNode();return r.name=(0,ST.strToEncoding)(e.getName(),t),r.mode=n,r.path=e.getParentPath(),r.parentPath=r.path,r}_checkModeProperty(e){return(this.mode&ET)===e}isDirectory(){return this._checkModeProperty(FT)}isFile(){return this._checkModeProperty(kT)}isBlockDevice(){return this._checkModeProperty(RT)}isCharacterDevice(){return this._checkModeProperty(TT)}isSymbolicLink(){return this._checkModeProperty(OT)}isFIFO(){return this._checkModeProperty(xT)}isSocket(){return this._checkModeProperty(AT)}};c(df,"Dirent");var uf=df;Zo.Dirent=uf;Zo.default=uf});var eo=Ze(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.basename=Yt.isAbsolute=Yt.normalize=Yt.dirname=Yt.relative=Yt.join=Yt.posix=Yt.sep=Yt.resolve=void 0;var Ci=rr("node:path");Object.defineProperty(Yt,"resolve",{enumerable:!0,get:c(function(){return Ci.resolve},"get")});Object.defineProperty(Yt,"sep",{enumerable:!0,get:c(function(){return Ci.sep},"get")});Object.defineProperty(Yt,"posix",{enumerable:!0,get:c(function(){return Ci.posix},"get")});Object.defineProperty(Yt,"join",{enumerable:!0,get:c(function(){return Ci.join},"get")});Object.defineProperty(Yt,"relative",{enumerable:!0,get:c(function(){return Ci.relative},"get")});Object.defineProperty(Yt,"dirname",{enumerable:!0,get:c(function(){return Ci.dirname},"get")});Object.defineProperty(Yt,"normalize",{enumerable:!0,get:c(function(){return Ci.normalize},"get")});Object.defineProperty(Yt,"isAbsolute",{enumerable:!0,get:c(function(){return Ci.isAbsolute},"get")});Object.defineProperty(Yt,"basename",{enumerable:!0,get:c(function(){return Ci.basename},"get")})});var ov=Ze(av=>{"use strict";Object.defineProperty(av,"__esModule",{value:!0})});var _m=Ze(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.flattenJSON=void 0;var lv=Yi(),bm=eo(),PT=bm.posix?bm.posix.join:bm.join,DT=c(i=>{let e={};function t(r,n){for(let o in n){let f=n[o],m=PT(r,o);typeof f=="string"||f instanceof lv.Buffer?e[m]=f:typeof f=="object"&&f!==null&&!(f instanceof lv.Buffer)&&Object.keys(f).length>0?t(m,f):e[m]=null}}return c(t,"flatten"),t("",i),e},"flattenJSON");mf.flattenJSON=DT});var yf=Ze(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.createProcess=cv;var NT=c(()=>{if(typeof process<"u")return process;try{return rr("process")}catch{return}},"maybeReturnProcess");function cv(){let i=NT()||{};return i.cwd||(i.cwd=()=>"/"),i.emitWarning||(i.emitWarning=(e,t)=>{console.warn(`${t}${t?": ":""}${e}`)}),i.env||(i.env={}),i}c(cv,"createProcess");gf.default=cv()});var Em=Ze(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.Node=void 0;var CT=Co(),uv=yf(),Bi=Yi(),IT=si(),{S_IFMT:Ii,S_IFDIR:BT,S_IFREG:jT,S_IFLNK:fv,S_IFCHR:MT}=IT.constants,wf=c(()=>uv.default.getuid?.()??0,"getuid"),bf=c(()=>uv.default.getgid?.()??0,"getgid"),hv=(0,Bi.bufferAllocUnsafe)(0),Sm=class Sm{constructor(e,t=438){this.changes=new CT.FanOut,this._uid=wf(),this._gid=bf(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=hv,this.capacity=0,this.size=0,this.rdev=0,this._nlink=1,this.mode=t,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Ii}set perm(e){this.mode=this.mode&Ii|e&~Ii,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this._setBuf((0,Bi.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,Bi.bufferAllocUnsafe)(0)),(0,Bi.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let t=(0,Bi.bufferFrom)(e);this._setBuf(t)}_setBuf(e){let t=e.length;this.buf=e,this.capacity=t,this.size=t,this.touch()}getSize(){return this.size}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Ii)===jT}isDirectory(){return(this.mode&Ii)===BT}isSymlink(){return(this.mode&Ii)===fv}isCharacterDevice(){return(this.mode&Ii)===MT}makeSymlink(e){this.mode=fv|438,this.symlink=e}write(e,t=0,r=e.length,n=0){let o=e.length;if(t+r>o&&(r=o-t),r<=0)return 0;let f=n+r;if(f>this.capacity){let m=Math.max(this.capacity*2,64);for(;m<f;)m*=2;let l=(0,Bi.bufferAllocUnsafe)(m);this.size>0&&this.buf.copy(l,0,0,this.size),this.buf=l,this.capacity=m}return n>this.size&&this.buf.fill(0,this.size,n),e.copy(this.buf,n,t,t+r),f>this.size&&(this.size=f),this.touch(),r}read(e,t=0,r=e.byteLength,n=0){if(this.atime=new Date,n>=this.size)return 0;let o=r;if(o>e.byteLength&&(o=e.byteLength),o+n>this.size&&(o=this.size-n),o<=0)return 0;let f=e instanceof Bi.Buffer?e:Bi.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(f,t,n,n+o),o}truncate(e=0){if(!e){this.buf=hv,this.capacity=0,this.size=0,this.touch();return}if(e<=this.size)this.size=e;else{if(e>this.capacity){let t=Math.max(this.capacity*2,64);for(;t<e;)t*=2;let r=(0,Bi.bufferAllocUnsafe)(t);this.size>0&&this.buf.copy(r,0,0,this.size),r.fill(0,this.size,e),this.buf=r,this.capacity=t}else this.buf.fill(0,this.size,e);this.size=e}this.touch()}chmod(e){this.mode=this.mode&Ii|e&~Ii,this.touch()}chown(e,t){this.uid=e,this.gid=t,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=wf(),t=bf()){return!!(this.perm&4||t===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=wf(),t=bf()){return!!(this.perm&2||t===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=wf(),t=bf()){return!!(this.perm&1||t===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};c(Sm,"Node");var vm=Sm;_f.Node=vm});var km=Ze(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.Link=void 0;var $T=si(),LT=Co(),{S_IFREG:UT}=$T.constants,el=class el{get steps(){return this._steps}set steps(e){this._steps=e;for(let[t,r]of this.children.entries())t==="."||t===".."||r?.syncSteps()}constructor(e,t,r){this.changes=new LT.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=t,this.name=r,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,t=this.vol.createNode(UT|438)){let r=new el(this.vol,this,e);return r.setNode(t),t.isDirectory()&&(r.children.set(".",r),r.getNode().nlink++),this.setChild(e,r),r}setChild(e,t=new el(this.vol,this,e)){return this.children.set(e,t),t.parent=this,this.length++,t.getNode().isDirectory()&&(t.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",t,this]),t}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};c(el,"Link");var Fm=el;vf.Link=Fm});var Om=Ze(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.File=void 0;var WT=si(),{O_APPEND:qT}=WT.constants,Tm=class Tm{constructor(e,t,r,n){this.link=e,this.node=t,this.flags=r,this.fd=n,this.position=0,this.flags&qT&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,t=0,r=e.length,n){typeof n!="number"&&(n=this.position);let o=this.node.write(e,t,r,n);return this.position=n+o,o}read(e,t=0,r=e.byteLength,n){typeof n!="number"&&(n=this.position);let o=this.node.read(e,t,r,n);return this.position=n+o,o}chmod(e){this.node.chmod(e)}chown(e,t){this.node.chown(e,t)}};c(Tm,"File");var Rm=Tm;Sf.File=Rm});var io=Ze(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.FLAGS=ro.ERRSTR=void 0;var zT=si();ro.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:dv,O_WRONLY:Ef,O_RDWR:to,O_CREAT:Qi,O_EXCL:Ff,O_TRUNC:kf,O_APPEND:Rf,O_SYNC:pv}=zT.constants,mv;(function(i){i[i.r=dv]="r",i[i["r+"]=to]="r+",i[i.rs=dv|pv]="rs",i[i.sr=i.rs]="sr",i[i["rs+"]=to|pv]="rs+",i[i["sr+"]=i["rs+"]]="sr+",i[i.w=Ef|Qi|kf]="w",i[i.wx=Ef|Qi|kf|Ff]="wx",i[i.xw=i.wx]="xw",i[i["w+"]=to|Qi|kf]="w+",i[i["wx+"]=to|Qi|kf|Ff]="wx+",i[i["xw+"]=i["wx+"]]="xw+",i[i.a=Ef|Rf|Qi]="a",i[i.ax=Ef|Rf|Qi|Ff]="ax",i[i.xa=i.ax]="xa",i[i["a+"]=to|Rf|Qi]="a+",i[i["ax+"]=to|Rf|Qi|Ff]="ax+",i[i["xa+"]=i["ax+"]]="xa+"})(mv||(ro.FLAGS=mv={}))});var Am=Ze(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.default=typeof queueMicrotask=="function"?queueMicrotask:i=>Promise.resolve().then(()=>i()).catch(()=>{})});var Af=Ze(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.filenameToSteps=lr.resolve=lr.unixify=lr.isWin=void 0;lr.isFd=yv;lr.validateFd=eO;lr.dataToBuffer=tO;var Of=eo(),Tf=Yi(),gv=yf(),HT=Qo(),GT=io();lr.isWin=gv.default.platform==="win32";var VT=Of.resolve,KT=Of.posix?Of.posix.sep:Of.sep,JT=c((i,e)=>{let t=i[e];return e>0&&(t==="/"||lr.isWin&&t==="\\")},"isSeparator"),YT=c(i=>{let e=i.length-1;if(e<2)return i;for(;JT(i,e);)e--;return i.substr(0,e+1)},"removeTrailingSeparator"),XT=c((i,e)=>{if(typeof i!="string")throw new TypeError("expected a string");return i=i.replace(/[\\\/]+/g,"/"),e!==!1&&(i=YT(i)),i},"normalizePath"),QT=c((i,e=!0)=>lr.isWin?(i=XT(i,e),i.replace(/^([a-zA-Z]+:|\.\/)/,"")):i,"unixify");lr.unixify=QT;var xf=c((i,e=gv.default.cwd())=>VT(e,i),"resolve");lr.resolve=xf;if(lr.isWin){let i=xf;lr.resolve=xf=c((e,t)=>(0,lr.unixify)(i(e,t)),"resolve")}var ZT=c((i,e)=>{let r=xf(i,e).substring(1);return r?r.split(KT):[]},"filenameToSteps");lr.filenameToSteps=ZT;function yv(i){return i>>>0===i}c(yv,"isFd");function eO(i){if(!yv(i))throw TypeError(GT.ERRSTR.FD)}c(eO,"validateFd");function tO(i,e=HT.ENCODING_UTF8){return Tf.Buffer.isBuffer(i)?i:i instanceof Uint8Array?(0,Tf.bufferFrom)(i):e==="buffer"?(0,Tf.bufferFrom)(String(i),"utf8"):(0,Tf.bufferFrom)(String(i),e)}c(tO,"dataToBuffer")});var Zi=Ze(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.getWriteSyncArgs=nr.getWriteArgs=nr.bufToUint8=void 0;nr.promisify=iO;nr.validateCallback=wv;nr.modeToNumber=bv;nr.nullCheck=_v;nr.pathToFilename=aO;nr.createError=SO;nr.genRndStr6=EO;nr.flagsToNumber=FO;nr.streamToBuffer=kO;nr.bufferToEncoding=xO;nr.isReadableStream=AO;var tl=io(),Pm=Xo(),Dm=Yi(),rO=Am(),Pf=Af();function iO(i,e,t=r=>r){return(...r)=>new Promise((n,o)=>{i[e].bind(i)(...r,(f,m)=>f?o(f):n(t(m)))})}c(iO,"promisify");function wv(i){if(typeof i!="function")throw TypeError(tl.ERRSTR.CB);return i}c(wv,"validateCallback");function nO(i,e){if(typeof i=="number")return i;if(typeof i=="string")return parseInt(i,8);if(e)return bv(e)}c(nO,"_modeToNumber");function bv(i,e){let t=nO(i,e);if(typeof t!="number"||isNaN(t))throw new TypeError(tl.ERRSTR.MODE_INT);return t}c(bv,"modeToNumber");function _v(i,e){if((""+i).indexOf("\0")!==-1){let t=new Error("Path must be a string without null bytes");if(t.code="ENOENT",typeof e!="function")throw t;return(0,rO.default)(()=>{e(t)}),!1}return!0}c(_v,"nullCheck");function sO(i){if(i.hostname!=="")throw new Pm.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=i.pathname;for(let t=0;t<e.length;t++)if(e[t]==="%"){let r=e.codePointAt(t+2)|32;if(e[t+1]==="2"&&r===102)throw new Pm.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}c(sO,"getPathFromURLPosix");function aO(i){if(i instanceof Uint8Array&&(i=(0,Dm.bufferFrom)(i)),typeof i!="string"&&!Dm.Buffer.isBuffer(i)){try{if(!(i instanceof rr("url").URL))throw new TypeError(tl.ERRSTR.PATH_STR)}catch{throw new TypeError(tl.ERRSTR.PATH_STR)}i=sO(i)}let e=String(i);return _v(e),e}c(aO,"pathToFilename");var oO="ENOENT",lO="EBADF",cO="EINVAL",fO="EPERM",hO="EPROTO",uO="EEXIST",dO="ENOTDIR",pO="EMFILE",mO="EACCES",gO="EISDIR",yO="ENOTEMPTY",wO="ENOSYS",bO="ERR_FS_EISDIR",_O="ERR_OUT_OF_RANGE";function vO(i,e="",t="",r=""){let n="";switch(t&&(n=` '${t}'`),r&&(n+=` -> '${r}'`),i){case oO:return`ENOENT: no such file or directory, ${e}${n}`;case lO:return`EBADF: bad file descriptor, ${e}${n}`;case cO:return`EINVAL: invalid argument, ${e}${n}`;case fO:return`EPERM: operation not permitted, ${e}${n}`;case hO:return`EPROTO: protocol error, ${e}${n}`;case uO:return`EEXIST: file already exists, ${e}${n}`;case dO:return`ENOTDIR: not a directory, ${e}${n}`;case gO:return`EISDIR: illegal operation on a directory, ${e}${n}`;case mO:return`EACCES: permission denied, ${e}${n}`;case yO:return`ENOTEMPTY: directory not empty, ${e}${n}`;case pO:return`EMFILE: too many open files, ${e}${n}`;case wO:return`ENOSYS: function not implemented, ${e}${n}`;case bO:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${t}`;case _O:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${i}: error occurred, ${e}${n}`}}c(vO,"formatError");function SO(i,e="",t="",r="",n=Error){let o=new n(vO(i,e,t,r));return o.code=i,t&&(o.path=t),o}c(SO,"createError");function EO(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}c(EO,"genRndStr6");function FO(i){if(typeof i=="number")return i;if(typeof i=="string"){let e=tl.FLAGS[i];if(typeof e<"u")return e}throw new Pm.TypeError("ERR_INVALID_OPT_VALUE","flags",i)}c(FO,"flagsToNumber");function kO(i){let e=[];return new Promise((t,r)=>{i.on("data",n=>e.push(n)),i.on("end",()=>t(Dm.Buffer.concat(e))),i.on("error",r)})}c(kO,"streamToBuffer");var RO=c(i=>new Uint8Array(i.buffer,i.byteOffset,i.byteLength),"bufToUint8");nr.bufToUint8=RO;var TO=c((i,e,t,r,n,o)=>{(0,Pf.validateFd)(i);let f=0,m,l=null,a,g,y=typeof e,b=typeof t,S=typeof r,F=typeof n;y!=="string"?b==="function"?g=t:S==="function"?(f=t|0,g=r):F==="function"?(f=t|0,m=r,g=n):(f=t|0,m=r,l=n,g=o):b==="function"?g=t:S==="function"?(l=t,g=r):F==="function"&&(l=t,a=r,g=n);let T=(0,Pf.dataToBuffer)(e,a);y!=="string"?typeof m>"u"&&(m=T.length):(f=0,m=T.length);let P=wv(g);return[i,y==="string",T,f,m,l,P]},"getWriteArgs");nr.getWriteArgs=TO;var OO=c((i,e,t,r,n)=>{(0,Pf.validateFd)(i);let o,f,m,l,a=typeof e!="string";a?(f=(t||0)|0,m=r,l=n):(l=t,o=r);let g=(0,Pf.dataToBuffer)(e,o);return a?typeof m>"u"&&(m=g.length):(f=0,m=g.length),[i,g,f||0,m,l]},"getWriteSyncArgs");nr.getWriteSyncArgs=OO;function xO(i,e){return!e||e==="buffer"?i:i.toString(e)}c(xO,"bufferToEncoding");function AO(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"&&typeof i.on=="function"&&i.readable===!0}c(AO,"isReadableStream")});var Rv=Ze(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.Superblock=void 0;var cr=eo(),PO=Em(),vv=km(),DO=Om(),NO=Yi(),Sv=yf(),mi=si(),Ev=io(),bt=Zi(),ai=Af(),CO=_m(),no=cr.posix?cr.posix.sep:cr.sep,Fv=cr.posix?cr.posix.relative:cr.relative,IO=cr.posix?cr.posix.join:cr.join,{O_RDONLY:Nm,O_WRONLY:Df,O_RDWR:Cm,O_CREAT:kv,O_EXCL:BO,O_TRUNC:jO,O_APPEND:MO,O_DIRECTORY:$O}=mi.constants,so=class so{static fromJSON(e,t){let r=new so;return r.fromJSON(e,t),r}static fromNestedJSON(e,t){let r=new so;return r.fromNestedJSON(e,t),r}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(r,n,o,f=!0)=>{let m=this.openFile(r,n,o,f);if(!m)throw(0,bt.createError)("ENOENT","open",r);return m.fd},this.writeFile=(r,n,o,f)=>{let m=typeof r=="number",l;m?l=r:l=this.open((0,bt.pathToFilename)(r),o,f);let a=0,g=n.length,y=o&MO?void 0:0;try{for(;g>0;){let b=this.write(l,n,a,g,y);a+=b,g-=b,y!==void 0&&(y+=b)}}finally{m||this.close(l)}},this.read=(r,n,o,f,m)=>{if(n.byteLength<f)throw(0,bt.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let l=this.getFileByFdOrThrow(r);if(l.node.isSymlink())throw(0,bt.createError)("EPERM","read",l.link.getPath());return l.read(n,Number(o),Number(f),m===-1||typeof m!="number"?void 0:m)},this.readv=(r,n,o)=>{let f=this.getFileByFdOrThrow(r),m=o??void 0;m===-1&&(m=void 0);let l=0;for(let a of n){let g=f.read(a,0,a.byteLength,m);if(m=void 0,l+=g,g<a.byteLength)break}return l},this.link=(r,n)=>{let o;try{o=this.getLinkOrThrow(r,"link")}catch(g){throw g.code&&(g=(0,bt.createError)(g.code,"link",r,n)),g}let f=(0,cr.dirname)(n),m;try{m=this.getLinkOrThrow(f,"link")}catch(g){throw g.code&&(g=(0,bt.createError)(g.code,"link",r,n)),g}let l=(0,cr.basename)(n);if(m.getChild(l))throw(0,bt.createError)("EEXIST","link",r,n);let a=o.getNode();a.nlink++,m.createChild(l,a)},this.unlink=r=>{let n=this.getLinkOrThrow(r,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let o=n.getNode();o.nlink--,o.nlink<=0&&this.deleteNode(o)},this.symlink=(r,n)=>{let o=(0,ai.filenameToSteps)(n),f;try{f=this.getLinkParentAsDirOrThrow(o)}catch(g){throw g.code&&(g=(0,bt.createError)(g.code,"symlink",r,n)),g}let m=o[o.length-1];if(f.getChild(m))throw(0,bt.createError)("EEXIST","symlink",r,n);let l=f.getNode();if(!l.canExecute()||!l.canWrite())throw(0,bt.createError)("EACCES","symlink",r,n);let a=f.createChild(m);return a.getNode().makeSymlink(r),a},this.rename=(r,n)=>{let o;try{o=this.getResolvedLinkOrThrow(r)}catch(y){throw y.code&&(y=(0,bt.createError)(y.code,"rename",r,n)),y}let f;try{f=this.getLinkParentAsDirOrThrow(n)}catch(y){throw y.code&&(y=(0,bt.createError)(y.code,"rename",r,n)),y}let m=o.parent;if(!m)throw(0,bt.createError)("EINVAL","rename",r,n);let l=m.getNode(),a=f.getNode();if(!l.canExecute()||!l.canWrite()||!a.canExecute()||!a.canWrite())throw(0,bt.createError)("EACCES","rename",r,n);m.deleteChild(o);let g=(0,cr.basename)(n);o.name=g,o.steps=[...f.steps,g],f.setChild(o.getName(),o)},this.mkdir=(r,n)=>{let o=(0,ai.filenameToSteps)(r);if(!o.length)throw(0,bt.createError)("EEXIST","mkdir",r);let f=this.getLinkParentAsDirOrThrow(r,"mkdir"),m=o[o.length-1];if(f.getChild(m))throw(0,bt.createError)("EEXIST","mkdir",r);let l=f.getNode();if(!l.canWrite()||!l.canExecute())throw(0,bt.createError)("EACCES","mkdir",r);f.createChild(m,this.createNode(mi.constants.S_IFDIR|n))},this.mkdirp=(r,n)=>{let o=!1,f=(0,ai.filenameToSteps)(r),m=null,l=f.length;for(l=f.length;l>=0&&(m=this.getResolvedLink(f.slice(0,l)),!m);l--);for(m||(m=this.root,l=0),m=this.getResolvedLinkOrThrow(cr.sep+f.slice(0,l).join(cr.sep),"mkdir"),l;l<f.length;l++){let a=m.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,bt.createError)("EACCES","mkdir",r)}else throw(0,bt.createError)("ENOTDIR","mkdir",r);o=!0,m=m.createChild(f[l],this.createNode(mi.constants.S_IFDIR|n))}return o?r:void 0},this.rmdir=(r,n=!1)=>{let o=this.getLinkAsDirOrThrow(r,"rmdir");if(o.length&&!n)throw(0,bt.createError)("ENOTEMPTY","rmdir",r);this.deleteLink(o)},this.rm=(r,n=!1,o=!1)=>{let f;try{f=this.getResolvedLinkOrThrow(r,"stat")}catch(m){if(m.code==="ENOENT"&&n)return;throw m}if(f.getNode().isDirectory()&&!o)throw(0,bt.createError)("ERR_FS_EISDIR","rm",r);if(!f.parent?.getNode().canWrite())throw(0,bt.createError)("EACCES","rm",r);this.deleteLink(f)},this.close=r=>{(0,ai.validateFd)(r);let n=this.getFileByFdOrThrow(r,"close");this.closeFile(n)};let t=this.createLink();t.setNode(this.createNode(mi.constants.S_IFDIR|511)),t.setChild(".",t),t.getNode().nlink++,t.setChild("..",t),t.getNode().nlink++,this.root=t}createLink(e,t,r=!1,n){if(!e)return new vv.Link(this,void 0,"");if(!t)throw new Error("createLink: name cannot be empty");let o=n??(r?511:438),m=n&&n&mi.constants.S_IFMT?n&mi.constants.S_IFMT:r?mi.constants.S_IFDIR:mi.constants.S_IFREG,l=o&~mi.constants.S_IFMT|m;return e.createChild(t,this.createNode(l))}deleteLink(e){let t=e.parent;return t?(t.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:so.fd--}createNode(e){let t=new PO.Node(this.newInoNumber(),e);return this.inodes[t.ino]=t,t}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,t=!1,r=!1,n=!1,o){let f,m;e instanceof vv.Link?(f=e.steps,m=no+f.join(no)):typeof e=="string"?(f=(0,ai.filenameToSteps)(e),m=e):(f=e,m=no+f.join(no));let l=this.root,a=0;for(;a<f.length;){let g=l.getNode();if(g.isDirectory()){if(n&&!g.canExecute())throw(0,bt.createError)("EACCES",o,m)}else if(a<f.length-1)throw(0,bt.createError)("ENOTDIR",o,m);if(l=l.getChild(f[a])??null,!l){if(r)throw(0,bt.createError)("ENOENT",o,m);return null}if(g=l?.getNode(),g.isSymlink()&&(t||a<f.length-1)){let y=(0,cr.isAbsolute)(g.symlink)?g.symlink:IO((0,cr.dirname)(l.getPath()),g.symlink);f=(0,ai.filenameToSteps)(y).concat(f.slice(a+1)),l=this.root,a=0;continue}if(r&&!g.isDirectory()&&a<f.length-1){let y=Sv.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,bt.createError)(y,o,m)}a++}return l}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,t){return this.walk(e,!1,!0,!0,t)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,t){return this.walk(e,!0,!0,!0,t)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,t){let r=this.getLinkOrThrow(e,t);if(!r.getNode().isDirectory())throw(0,bt.createError)("ENOTDIR",t,e);return r}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,t){let r=(e instanceof Array?e:(0,ai.filenameToSteps)(e)).slice(0,-1),n=no+r.join(no),o=this.getLinkOrThrow(n,t);if(!o.getNode().isDirectory())throw(0,bt.createError)("ENOTDIR",t,n);return o}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,t){if(!(0,ai.isFd)(e))throw TypeError(Ev.ERRSTR.FD);let r=this.getFileByFd(e);if(!r)throw(0,bt.createError)("EBADF",t);return r}_toJSON(e=this.root,t={},r,n){let o=!0,f=e.children;e.getNode().isFile()&&(f=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let l of f.keys()){if(l==="."||l==="..")continue;o=!1;let a=e.getChild(l);if(!a)throw new Error("_toJSON: unexpected undefined");let g=a.getNode();if(g.isFile()){let y=a.getPath();r&&(y=Fv(r,y)),t[y]=n?g.getBuffer():g.getString()}else g.isDirectory()&&this._toJSON(a,t,r,n)}let m=e.getPath();return r&&(m=Fv(r,m)),m&&o&&(t[m]=null),t}toJSON(e,t={},r=!1,n=!1){let o=[];if(e){Array.isArray(e)||(e=[e]);for(let f of e){let m=(0,bt.pathToFilename)(f),l=this.getResolvedLink(m);l&&o.push(l)}}else o.push(this.root);if(!o.length)return t;for(let f of o)this._toJSON(f,t,r?f.getPath():"",n);return t}fromJSON(e,t=Sv.default.cwd()){for(let r in e){let n=e[r];if(r=(0,ai.resolve)(r,t),typeof n=="string"||n instanceof NO.Buffer){let o=(0,cr.dirname)(r);this.mkdirp(o,511);let f=(0,ai.dataToBuffer)(n);this.writeFile(r,f,Ev.FLAGS.w,438)}else this.mkdirp(r,511)}}fromNestedJSON(e,t){this.fromJSON((0,CO.flattenJSON)(e),t)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(mi.constants.S_IFDIR|511))}mountSync(e,t){this.fromJSON(t,e)}openLink(e,t,r=!0){if(this.openFiles>=this.maxFiles)throw(0,bt.createError)("EMFILE","open",e.getPath());let n=e;r&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let o=n.getNode();if(o.isDirectory()){if((t&(Nm|Cm|Df))!==Nm)throw(0,bt.createError)("EISDIR","open",e.getPath())}else if(t&$O)throw(0,bt.createError)("ENOTDIR","open",e.getPath());if((t&(Nm|Cm|Df))!==Df&&!o.canRead()||t&(Df|Cm)&&!o.canWrite())throw(0,bt.createError)("EACCES","open",e.getPath());let f=new DO.File(e,o,t,this.newFdNumber());return this.fds[f.fd]=f,this.openFiles++,t&jO&&f.truncate(),f}openFile(e,t,r,n=!0){let o=(0,ai.filenameToSteps)(e),f;try{if(f=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),f&&t&kv&&t&BO)throw(0,bt.createError)("EEXIST","open",e)}catch(m){if(m.code==="ENOENT"&&t&kv){let l=(0,cr.dirname)(e),a=this.getResolvedLinkOrThrow(l),g=a.getNode();if(!g.isDirectory())throw(0,bt.createError)("ENOTDIR","open",e);if(!g.canExecute()||!g.canWrite())throw(0,bt.createError)("EACCES","open",e);r??(r=438),f=this.createLink(a,o[o.length-1],!1,r)}else throw m}if(f)return this.openLink(f,t,n);throw(0,bt.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,t,r,n,o){let f=this.getFileByFdOrThrow(e,"write");if(f.node.isSymlink())throw(0,bt.createError)("EBADF","write",f.link.getPath());return f.write(t,r,n,o===-1||typeof o!="number"?void 0:o)}};c(so,"Superblock");var Nf=so;Cf.Superblock=Nf;Nf.fd=2147483647});var Ov=Ze(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.Superblock=Yr.File=Yr.Link=Yr.Node=void 0;var Tv=(Jl(),kd(Kl));Tv.__exportStar(ov(),Yr);Tv.__exportStar(_m(),Yr);var LO=Em();Object.defineProperty(Yr,"Node",{enumerable:!0,get:c(function(){return LO.Node},"get")});var UO=km();Object.defineProperty(Yr,"Link",{enumerable:!0,get:c(function(){return UO.Link},"get")});var WO=Om();Object.defineProperty(Yr,"File",{enumerable:!0,get:c(function(){return WO.File},"get")});var qO=Rv();Object.defineProperty(Yr,"Superblock",{enumerable:!0,get:c(function(){return qO.Superblock},"get")})});var xv=Ze(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.StatFs=void 0;var Bf=class Bf{static build(e,t=!1){let r=new Bf,n=t?g=>BigInt(g):g=>g;r.type=n(2240043254),r.bsize=n(4096);let o=Object.keys(e.inodes).length,f=1e6,m=Math.min(o*2,f),l=f-m;r.blocks=n(f),r.bfree=n(l),r.bavail=n(l);let a=1e6;return r.files=n(a),r.ffree=n(a-o),r}};c(Bf,"StatFs");var If=Bf;rl.StatFs=If;rl.default=If});var Av=Ze(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});function zO(i,e,t){let r=setTimeout.apply(globalThis,arguments);return r&&typeof r=="object"&&typeof r.unref=="function"&&r.unref(),r}c(zO,"setTimeoutUnref");Im.default=zO});var Dv=Ze(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.Writable=ao.Readable=void 0;var Pv=rr("node:stream");Object.defineProperty(ao,"Readable",{enumerable:!0,get:c(function(){return Pv.Readable},"get")});Object.defineProperty(ao,"Writable",{enumerable:!0,get:c(function(){return Pv.Writable},"get")})});var Bm=Ze(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.EventEmitter=void 0;var HO=rr("node:events");Object.defineProperty(jf,"EventEmitter",{enumerable:!0,get:c(function(){return HO.EventEmitter},"get")})});var Nv=Ze(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.FileHandle=void 0;var br=Zi(),GO=Bm(),Mm=class Mm extends GO.EventEmitter{constructor(e,t){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=t}getAsyncId(){return this.fd}appendFile(e,t){return(0,br.promisify)(this.fs,"appendFile")(this.fd,e,t)}chmod(e){return(0,br.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,t){return(0,br.promisify)(this.fs,"fchown")(this.fd,e,t)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,br.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,t)=>{this.closeResolve=e,this.closeReject=t}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,br.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:t="bytes",autoClose:r=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let o=c(()=>{this.readableWebStreamLocked=!1,this.unref(),r&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:t==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:c(async f=>{try{let m=f.byobRequest?.view;if(!m){let a=new Uint8Array(16384),g=await this.read(a,0,a.length,n);if(g.bytesRead===0){f.close(),o();return}n+=g.bytesRead,f.enqueue(a.slice(0,g.bytesRead));return}let l=await this.read(m,m.byteOffset,m.byteLength,n);if(l.bytesRead===0){f.close(),o();return}n+=l.bytesRead,f.byobRequest.respond(l.bytesRead)}catch(m){f.error(m),o()}},"pull"),cancel:c(async()=>{o()},"cancel")})}async read(e,t,r,n){let o=n??this.position,f=await(0,br.promisify)(this.fs,"read",m=>({bytesRead:m,buffer:e}))(this.fd,e,t,r,o);return n==null&&(this.position+=f.bytesRead),f}readv(e,t){return(0,br.promisify)(this.fs,"readv",r=>({bytesRead:r,buffers:e}))(this.fd,e,t)}readFile(e){return(0,br.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,br.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,br.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,br.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,t){return(0,br.promisify)(this.fs,"futimes")(this.fd,e,t)}async write(e,t,r,n){let o=typeof n!="number",f=o?this.position:n,m=await(0,br.promisify)(this.fs,"write",l=>({bytesWritten:l,buffer:e}))(this.fd,e,t,r,f);return o&&(this.position+=m.bytesWritten),m}writev(e,t){return(0,br.promisify)(this.fs,"writev",r=>({bytesWritten:r,buffers:e}))(this.fd,e,t)}writeFile(e,t){return(0,br.promisify)(this.fs,"writeFile")(this.fd,e,t)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,br.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};c(Mm,"FileHandle");var jm=Mm;Mf.FileHandle=jm});var Cv=Ze($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.FsPromises=void 0;var Tt=Zi(),VO=si(),Um=class Um{constructor(e,t,r={}){if(this.fs=e,this.path=t,this.options=r,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=r.maxQueue||2048,this.overflow=r.overflow||"ignore",this.startWatching(),r.signal){if(r.signal.aborted){this.finish();return}r.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,t)=>{this.enqueueEvent({eventType:e,filename:t})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let t=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(t);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:t}=this.resolveQueue.shift(),r=this.eventQueue.shift();t({value:r,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:t,reject:r}=this.resolveQueue.shift();e?r(e):t({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,t)=>{this.resolveQueue.push({resolve:e,reject:t})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};c(Um,"FSWatchAsyncIterator");var $m=Um,Wm=class Wm{constructor(e,t){this.fs=e,this.FileHandle=t,this.constants=VO.constants,this.cp=(0,Tt.promisify)(this.fs,"cp"),this.opendir=(0,Tt.promisify)(this.fs,"opendir"),this.statfs=(0,Tt.promisify)(this.fs,"statfs"),this.lutimes=(0,Tt.promisify)(this.fs,"lutimes"),this.glob=(0,Tt.promisify)(this.fs,"glob"),this.access=(0,Tt.promisify)(this.fs,"access"),this.chmod=(0,Tt.promisify)(this.fs,"chmod"),this.chown=(0,Tt.promisify)(this.fs,"chown"),this.copyFile=(0,Tt.promisify)(this.fs,"copyFile"),this.lchmod=(0,Tt.promisify)(this.fs,"lchmod"),this.lchown=(0,Tt.promisify)(this.fs,"lchown"),this.link=(0,Tt.promisify)(this.fs,"link"),this.lstat=(0,Tt.promisify)(this.fs,"lstat"),this.mkdir=(0,Tt.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,Tt.promisify)(this.fs,"mkdtemp"),this.readdir=(0,Tt.promisify)(this.fs,"readdir"),this.readlink=(0,Tt.promisify)(this.fs,"readlink"),this.realpath=(0,Tt.promisify)(this.fs,"realpath"),this.rename=(0,Tt.promisify)(this.fs,"rename"),this.rmdir=(0,Tt.promisify)(this.fs,"rmdir"),this.rm=(0,Tt.promisify)(this.fs,"rm"),this.stat=(0,Tt.promisify)(this.fs,"stat"),this.symlink=(0,Tt.promisify)(this.fs,"symlink"),this.truncate=(0,Tt.promisify)(this.fs,"truncate"),this.unlink=(0,Tt.promisify)(this.fs,"unlink"),this.utimes=(0,Tt.promisify)(this.fs,"utimes"),this.readFile=(r,n)=>(0,Tt.promisify)(this.fs,"readFile")(r instanceof this.FileHandle?r.fd:r,n),this.appendFile=(r,n,o)=>(0,Tt.promisify)(this.fs,"appendFile")(r instanceof this.FileHandle?r.fd:r,n,o),this.open=(r,n="r",o)=>(0,Tt.promisify)(this.fs,"open",f=>new this.FileHandle(this.fs,f))(r,n,o),this.writeFile=(r,n,o)=>((0,Tt.isReadableStream)(n)?(0,Tt.streamToBuffer)(n):Promise.resolve(n)).then(m=>(0,Tt.promisify)(this.fs,"writeFile")(r instanceof this.FileHandle?r.fd:r,m,o)),this.watch=(r,n)=>{let o=typeof n=="string"?{encoding:n}:n||{};return new $m(this.fs,r,o)}}};c(Wm,"FsPromises");var Lm=Wm;$f.FsPromises=Lm});var Iv=Ze(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.newNotAllowedError=_r.newTypeMismatchError=_r.newNotFoundError=_r.assertCanWrite=_r.assertName=_r.basename=_r.ctx=void 0;var KO=c((i={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...i}),"ctx");_r.ctx=KO;var JO=c((i,e)=>{i[i.length-1]===e&&(i=i.slice(0,-1));let t=i.lastIndexOf(e);return t===-1?i:i.slice(t+1)},"basename");_r.basename=JO;var YO=/^(\.{1,2})$|^(.*([\/\\]).*)$/,XO=c((i,e,t)=>{if(!i||YO.test(i))throw new TypeError(`Failed to execute '${e}' on '${t}': Name is not allowed.`)},"assertName");_r.assertName=XO;var QO=c(i=>{if(i!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");_r.assertCanWrite=QO;var ZO=c(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");_r.newNotFoundError=ZO;var ex=c(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");_r.newTypeMismatchError=ex;var tx=c(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");_r.newNotAllowedError=tx});var Bv=Ze(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.toTreeSync=void 0;var rx=bp(),ix=Iv(),nx=c((i,e={})=>{let t=e.separator||"/",r=e.dir||t;r[r.length-1]!==t&&(r+=t);let n=e.tab||"",o=e.depth??10,f=" (...)";if(o>0){let l=i.readdirSync(r,{withFileTypes:!0});f=(0,rx.printTree)(n,l.map(a=>g=>a.isDirectory()?(0,il.toTreeSync)(i,{dir:r+a.name,depth:o-1,tab:g}):a.isSymbolicLink()?""+a.name+" \u2192 "+i.readlinkSync(r+a.name):""+a.name))}return(0,ix.basename)(r,t)+t+f},"toTreeSync");il.toTreeSync=nx});var $v=Ze(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getWriteFileOptions=ht.writeFileDefaults=ht.getRealpathOptsAndCb=ht.getRealpathOptions=ht.getStatfsOptsAndCb=ht.getStatfsOptions=ht.getStatOptsAndCb=ht.getStatOptions=ht.getAppendFileOptsAndCb=ht.getAppendFileOpts=ht.getOpendirOptsAndCb=ht.getOpendirOptions=ht.getReaddirOptsAndCb=ht.getReaddirOptions=ht.getReadFileOptions=ht.getRmOptsAndCb=ht.getRmdirOptions=ht.getDefaultOptsAndCb=ht.getDefaultOpts=ht.optsDefaults=ht.getMkdirOptions=void 0;ht.getOptions=Mv;ht.optsGenerator=ji;ht.optsAndCbGenerator=ls;var Lf=io(),sx=Qo(),qm=Zi(),jv={mode:511,recursive:!1},ax=c(i=>typeof i=="number"?Object.assign({},jv,{mode:i}):Object.assign({},jv,i),"getMkdirOptions");ht.getMkdirOptions=ax;var ox=c(i=>`Expected options to be either an object or a string, but got ${i} instead`,"ERRSTR_OPTS");function Mv(i,e){let t;if(e){let r=typeof e;switch(r){case"string":t=Object.assign({},i,{encoding:e});break;case"object":t=Object.assign({},i,e);break;default:throw TypeError(ox(r))}}else return i;return t.encoding!=="buffer"&&(0,sx.assertEncoding)(t.encoding),t}c(Mv,"getOptions");function ji(i){return e=>Mv(i,e)}c(ji,"optsGenerator");function ls(i){return(e,t)=>typeof e=="function"?[i(),e]:[i(e),(0,qm.validateCallback)(t)]}c(ls,"optsAndCbGenerator");ht.optsDefaults={encoding:"utf8"};ht.getDefaultOpts=ji(ht.optsDefaults);ht.getDefaultOptsAndCb=ls(ht.getDefaultOpts);var lx={recursive:!1},cx=c(i=>Object.assign({},lx,i),"getRmdirOptions");ht.getRmdirOptions=cx;var fx=ji(ht.optsDefaults);ht.getRmOptsAndCb=ls(fx);var hx={flag:"r"};ht.getReadFileOptions=ji(hx);var ux={encoding:"utf8",recursive:!1,withFileTypes:!1};ht.getReaddirOptions=ji(ux);ht.getReaddirOptsAndCb=ls(ht.getReaddirOptions);var dx={encoding:"utf8",bufferSize:32,recursive:!1};ht.getOpendirOptions=ji(dx);ht.getOpendirOptsAndCb=ls(ht.getOpendirOptions);var px={encoding:"utf8",mode:438,flag:Lf.FLAGS[Lf.FLAGS.a]};ht.getAppendFileOpts=ji(px);ht.getAppendFileOptsAndCb=ls(ht.getAppendFileOpts);var mx={bigint:!1},gx=c((i={})=>Object.assign({},mx,i),"getStatOptions");ht.getStatOptions=gx;var yx=c((i,e)=>typeof i=="function"?[(0,ht.getStatOptions)(),i]:[(0,ht.getStatOptions)(i),(0,qm.validateCallback)(e)],"getStatOptsAndCb");ht.getStatOptsAndCb=yx;var wx={bigint:!1},bx=c((i={})=>Object.assign({},wx,i),"getStatfsOptions");ht.getStatfsOptions=bx;var _x=c((i,e)=>typeof i=="function"?[(0,ht.getStatfsOptions)(),i]:[(0,ht.getStatfsOptions)(i),(0,qm.validateCallback)(e)],"getStatfsOptsAndCb");ht.getStatfsOptsAndCb=_x;var vx=ht.optsDefaults;ht.getRealpathOptions=ji(vx);ht.getRealpathOptsAndCb=ls(ht.getRealpathOptions);ht.writeFileDefaults={encoding:"utf8",mode:438,flag:Lf.FLAGS[Lf.FLAGS.w]};ht.getWriteFileOptions=ji(ht.writeFileDefaults)});var Uv=Ze(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.Dir=void 0;var Lv=Zi(),Sx=pf(),cs=Xo(),Hm=class Hm{constructor(e,t){this.link=e,this.options=t,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let t,r,n,o;do{do if({done:t,value:r}=e[e.length-1].next(),!t)[n,o]=r;else break;while(n==="."||n==="..");if(t){if(e.pop(),e.length===0)break;t=!1}else return this.options.recursive&&o.children.size&&e.push(o.children[Symbol.iterator]()),Sx.default.build(o,this.options.encoding)}while(!t);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new cs.Error("ERR_DIR_CLOSED")):new Promise((t,r)=>{this.close(n=>{n?r(n):t()})});if((0,Lv.validateCallback)(e),this.closed){process.nextTick(e,new cs.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(t){process.nextTick(e,t)}}closeSync(){if(this.closed)throw new cs.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new cs.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((t,r)=>{this.read((n,o)=>{n?r(n):t(o??null)})});if((0,Lv.validateCallback)(e),this.closed){process.nextTick(e,new cs.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let t=this.readBase(this.iteratorInfo);process.nextTick(()=>{let r=this.operationQueue;this.operationQueue=null;for(let n of r)n();e(null,t)})}catch(t){process.nextTick(()=>{let r=this.operationQueue;this.operationQueue=null;for(let n of r)n();e(t)})}}readSync(){if(this.closed)throw new cs.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new cs.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:c(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};c(Hm,"Dir");var zm=Hm;Uf.Dir=zm});var zv=Ze(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.globSync=Ox;var fs=eo(),Ex=Ep(),Wv=Zi(),Fx=fs.posix.join,kx=fs.posix.relative,Rx=fs.posix.resolve;function qv(i,e){return(0,Ex.toRegex)(e).test(i)}c(qv,"matchesPattern");function Tx(i,e){return e?typeof e=="function"?e(i):(Array.isArray(e)?e:[e]).some(r=>qv(i,r)):!1}c(Tx,"isExcluded");function Gm(i,e,t,r,n=0){let o=[],f=r.maxdepth??1/0,m=r.cwd?(0,Wv.pathToFilename)(r.cwd):process.cwd();if(n>f)return o;try{let l=i.readdirSync(e,{withFileTypes:!0});for(let a of l){let g=Fx(e,a.name.toString()),y=kx(m,g);if(Tx(y,r.exclude))continue;if(t.some(S=>qv(y,S))&&o.push(y),a.isDirectory()&&n<f){let S=Gm(i,g,t,r,n+1);o.push(...S)}}}catch{}return o}c(Gm,"walkDirectory");function Ox(i,e,t={}){let r=t.cwd?(0,Wv.pathToFilename)(t.cwd):process.cwd(),n=Rx(r),o={cwd:n,exclude:t.exclude,maxdepth:t.maxdepth,withFileTypes:t.withFileTypes||!1},f=[];if(fs.posix.isAbsolute(e)){let m=fs.posix.dirname(e),l=fs.posix.basename(e),a=Gm(i,m,[l],{...o,cwd:m});f.push(...a.map(g=>fs.posix.resolve(m,g)))}else{let m=Gm(i,n,[e],o);f.push(...m)}return f=[...new Set(f)].sort(),f}c(Ox,"globSync")});var Xv=Ze(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.FSWatcher=Br.StatWatcher=Br.Volume=void 0;Br.pathToSteps=Hx;Br.dataToStr=Gx;Br.toUnixTimestamp=Ir;var Xt=eo(),Xm=Ov(),Km=hm(),xx=pf(),Ax=xv(),co=Yi(),Gf=Am(),Px=Av(),Vf=Dv(),Dx=si(),Kv=Bm(),hs=Qo(),Nx=Nv(),Jv=dm(),Cx=Cv(),Ix=Bv(),qf=io(),Bx=Xo(),Ft=$v(),Ee=Zi(),jx=Uv(),pr=Af(),Mx=Xt.resolve,{O_SYMLINK:Hv,F_OK:Jm,R_OK:$x,W_OK:Lx,X_OK:Ux,COPYFILE_EXCL:Wx,COPYFILE_FICLONE_FORCE:qx}=Dx.constants,TI=Xt.posix?Xt.posix.sep:Xt.sep,Wf=Xt.posix?Xt.posix.relative:Xt.relative,Ym=Xt.posix?Xt.posix.join:Xt.join,Gv=Xt.posix?Xt.posix.dirname:Xt.dirname,Vv=Xt.posix?Xt.posix.normalize:Xt.normalize,zx=128;function Hx(i){return(0,pr.filenameToSteps)((0,Ee.pathToFilename)(i))}c(Hx,"pathToSteps");function Gx(i,e=hs.ENCODING_UTF8){return co.Buffer.isBuffer(i)?i.toString(e):i instanceof Uint8Array?(0,co.bufferFrom)(i).toString(e):String(i)}c(Gx,"dataToStr");function Ir(i){if(typeof i=="string"&&+i==i)return+i;if(i instanceof Date)return i.getTime()/1e3;if(isFinite(i))return i<0?Date.now()/1e3:i;throw new Error("Cannot parse time: "+i)}c(Ir,"toUnixTimestamp");function oo(i){if(typeof i!="number")throw TypeError(qf.ERRSTR.UID)}c(oo,"validateUid");function lo(i){if(typeof i!="number")throw TypeError(qf.ERRSTR.GID)}c(lo,"validateGid");var Qm=class Qm{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Xm.Superblock){this._core=e,this.promisesApi=new Cx.FsPromises(this,Nx.FileHandle),this.openSync=(l,a,g=438)=>{let y=(0,Ee.modeToNumber)(g),b=(0,Ee.pathToFilename)(l),S=(0,Ee.flagsToNumber)(a);return this._core.open(b,S,y,!(S&Hv))},this.open=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&(b=438,S=g),b=b||438;let F=(0,Ee.modeToNumber)(b),T=(0,Ee.pathToFilename)(l),P=(0,Ee.flagsToNumber)(a);this.wrapAsync(this._core.open,[T,P,F,!(P&Hv)],S)},this.closeSync=l=>{this._core.close(l)},this.close=(l,a)=>{(0,pr.validateFd)(l);let g=this._core.getFileByFdOrThrow(l,"close");this.wrapAsync(this._core.close,[g.fd],a)},this.readSync=(l,a,g,y,b)=>((0,pr.validateFd)(l),this._core.read(l,a,g,y,b)),this.read=(l,a,g,y,b,S)=>{if((0,Ee.validateCallback)(S),y===0)return(0,Gf.default)(()=>{S&&S(null,0,a)});Promise.resolve().then(()=>{try{let F=this._core.read(l,a,g,y,b);S(null,F,a)}catch(F){S(F)}})},this.readv=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[null,g]),(0,Ee.validateCallback)(S),Promise.resolve().then(()=>{try{let F=this._core.readv(l,a,b);S(null,F,a)}catch(F){S(F)}})},this.readvSync=(l,a,g)=>((0,pr.validateFd)(l),this._core.readv(l,a,g??null)),this._readfile=(l,a,g)=>{let y,S=typeof l=="number"&&(0,pr.isFd)(l),F;if(S)F=l;else{let T=(0,Ee.pathToFilename)(l),P=String(l),$=P.length>1&&P.endsWith("/"),R=this._core.getResolvedLinkOrThrow(T,"open"),M=R.getNode();if(M.isDirectory())throw(0,Ee.createError)("EISDIR","open",R.getPath());if($&&M.isFile())throw(0,Ee.createError)("ENOTDIR","open",P);F=this.openSync(l,a)}try{y=(0,Ee.bufferToEncoding)(this._core.getFileByFdOrThrow(F).getBuffer(),g)}finally{S||this.closeSync(F)}return y},this.readFileSync=(l,a)=>{let g=(0,Ft.getReadFileOptions)(a),y=(0,Ee.flagsToNumber)(g.flag);return this._readfile(l,y,g.encoding)},this.readFile=(l,a,g)=>{let[y,b]=(0,Ft.optsAndCbGenerator)(Ft.getReadFileOptions)(a,g),S=(0,Ee.flagsToNumber)(y.flag);this.wrapAsync(this._readfile,[l,S,y.encoding],b)},this.writeSync=(l,a,g,y,b)=>{let[,S,F,T,P]=(0,Ee.getWriteSyncArgs)(l,a,g,y,b);return this._write(l,S,F,T,P)},this.write=(l,a,g,y,b,S)=>{let[,F,T,P,$,R,M]=(0,Ee.getWriteArgs)(l,a,g,y,b,S);Promise.resolve().then(()=>{try{let C=this._write(l,T,P,$,R);F?M(null,C,a):M(null,C,T)}catch(C){M(C)}})},this.writev=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[null,g]),(0,Ee.validateCallback)(S),Promise.resolve().then(()=>{try{let F=this.writevBase(l,a,b);S(null,F,a)}catch(F){S(F)}})},this.writevSync=(l,a,g)=>((0,pr.validateFd)(l),this.writevBase(l,a,g??null)),this.writeFileSync=(l,a,g)=>{let y=(0,Ft.getWriteFileOptions)(g),b=(0,Ee.flagsToNumber)(y.flag),S=(0,Ee.modeToNumber)(y.mode),F=(0,pr.dataToBuffer)(a,y.encoding);this._core.writeFile(l,F,b,S)},this.writeFile=(l,a,g,y)=>{let b=g,S=y;typeof g=="function"&&([b,S]=[Ft.writeFileDefaults,g]);let F=(0,Ee.validateCallback)(S),T=(0,Ft.getWriteFileOptions)(b),P=(0,Ee.flagsToNumber)(T.flag),$=(0,Ee.modeToNumber)(T.mode),R=(0,pr.dataToBuffer)(a,T.encoding);this.wrapAsync(this._core.writeFile,[l,R,P,$],F)},this.copyFileSync=(l,a,g)=>{let y=(0,Ee.pathToFilename)(l),b=(0,Ee.pathToFilename)(a);return this._copyFile(y,b,(g||0)|0)},this.copyFile=(l,a,g,y)=>{let b=(0,Ee.pathToFilename)(l),S=(0,Ee.pathToFilename)(a),F,T;typeof g=="function"?[F,T]=[0,g]:[F,T]=[g,y],(0,Ee.validateCallback)(T),this.wrapAsync(this._copyFile,[b,S,F],T)},this._cp=(l,a,g)=>{if(g.filter&&!g.filter(l,a))return;let y=g.dereference?this.statSync(l):this.lstatSync(l),b=null;try{b=this.lstatSync(a)}catch(S){if(S.code!=="ENOENT")throw S}if(b&&y.ino===b.ino&&y.dev===b.dev)throw(0,Ee.createError)("EINVAL","cp",l,a);if(b){if(y.isDirectory()&&!b.isDirectory())throw(0,Ee.createError)("EISDIR","cp",l,a);if(!y.isDirectory()&&b.isDirectory())throw(0,Ee.createError)("ENOTDIR","cp",l,a)}if(y.isDirectory()&&this.isSrcSubdir(l,a))throw(0,Ee.createError)("EINVAL","cp",l,a);{let S=Gv(a);this.existsSync(S)||this.mkdirSync(S,{recursive:!0})}if(y.isDirectory()){if(!g.recursive)throw(0,Ee.createError)("EISDIR","cp",l);this.cpDirSync(y,b,l,a,g)}else if(y.isFile()||y.isCharacterDevice()||y.isBlockDevice())this.cpFileSync(y,b,l,a,g);else if(y.isSymbolicLink()&&!g.dereference)this.cpSymlinkSync(b,l,a,g);else throw(0,Ee.createError)("EINVAL","cp",l)},this.linkSync=(l,a)=>{let g=(0,Ee.pathToFilename)(l),y=(0,Ee.pathToFilename)(a);this._core.link(g,y)},this.link=(l,a,g)=>{let y=(0,Ee.pathToFilename)(l),b=(0,Ee.pathToFilename)(a);this.wrapAsync(this._core.link,[y,b],g)},this.unlinkSync=l=>{let a=(0,Ee.pathToFilename)(l);this._core.unlink(a)},this.unlink=(l,a)=>{let g=(0,Ee.pathToFilename)(l);this.wrapAsync(this._core.unlink,[g],a)},this.symlinkSync=(l,a,g)=>{let y=(0,Ee.pathToFilename)(l),b=(0,Ee.pathToFilename)(a);this._core.symlink(y,b)},this.symlink=(l,a,g,y)=>{let b=(0,Ee.validateCallback)(typeof g=="function"?g:y),S=(0,Ee.pathToFilename)(l),F=(0,Ee.pathToFilename)(a);this.wrapAsync(this._core.symlink,[S,F],b)},this._lstat=(l,a=!1,g=!1)=>{let y;try{y=this._core.getLinkOrThrow(l,"lstat")}catch(b){if(b.code==="ENOENT"&&!g)return;throw b}return Km.default.build(y.getNode(),a)},this.lstatSync=(l,a)=>{let{throwIfNoEntry:g=!0,bigint:y=!1}=(0,Ft.getStatOptions)(a);return this._lstat((0,Ee.pathToFilename)(l),y,g)},this.renameSync=(l,a)=>{let g=(0,Ee.pathToFilename)(l),y=(0,Ee.pathToFilename)(a);this._core.rename(g,y)},this.rename=(l,a,g)=>{let y=(0,Ee.pathToFilename)(l),b=(0,Ee.pathToFilename)(a);this.wrapAsync(this._core.rename,[y,b],g)},this.existsSync=l=>{try{return this._exists((0,Ee.pathToFilename)(l))}catch{return!1}},this.exists=(l,a)=>{let g=(0,Ee.pathToFilename)(l);if(typeof a!="function")throw Error(qf.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(g))}catch{a(!1)}})},this.accessSync=(l,a=Jm)=>{let g=(0,Ee.pathToFilename)(l);a=a|0,this._access(g,a)},this.access=(l,a,g)=>{let y=Jm,b;typeof a!="function"?[y,b]=[a|0,(0,Ee.validateCallback)(g)]:b=a;let S=(0,Ee.pathToFilename)(l);this.wrapAsync(this._access,[S,y],b)},this.appendFileSync=(l,a,g)=>{let y=(0,Ft.getAppendFileOpts)(g);(!y.flag||(0,pr.isFd)(l))&&(y.flag="a"),this.writeFileSync(l,a,y)},this.appendFile=(l,a,g,y)=>{let[b,S]=(0,Ft.getAppendFileOptsAndCb)(g,y);(!b.flag||(0,pr.isFd)(l))&&(b.flag="a"),this.writeFile(l,a,b,S)},this._readdir=(l,a)=>{let g=(0,pr.filenameToSteps)(l),y=this._core.getResolvedLinkOrThrow(l,"scandir"),b=y.getNode();if(!b.isDirectory())throw(0,Ee.createError)("ENOTDIR","scandir",l);if(!b.canRead())throw(0,Ee.createError)("EACCES","scandir",l);let S=[];for(let T of y.children.keys()){let P=y.getChild(T);if(!(!P||T==="."||T==="..")&&(S.push(xx.default.build(P,a.encoding)),a.recursive&&P.children.size)){let $={...a,recursive:!0,withFileTypes:!0},R=this._readdir(P.getPath(),$);S.push(...R)}}if(!pr.isWin&&a.encoding!=="buffer"&&S.sort((T,P)=>T.name<P.name?-1:T.name>P.name?1:0),a.withFileTypes)return S;let F=l;return pr.isWin&&(F=F.replace(/\\/g,"/")),S.map(T=>{if(a.recursive){let P=Ym(T.parentPath,T.name.toString());return pr.isWin&&(P=P.replace(/\\/g,"/")),P.replace(F+Xt.posix.sep,"")}return T.name})},this.readdirSync=(l,a)=>{let g=(0,Ft.getReaddirOptions)(a),y=(0,Ee.pathToFilename)(l);return this._readdir(y,g)},this.readdir=(l,a,g)=>{let[y,b]=(0,Ft.getReaddirOptsAndCb)(a,g),S=(0,Ee.pathToFilename)(l);this.wrapAsync(this._readdir,[S,y],b)},this._readlink=(l,a)=>{let y=this._core.getLinkOrThrow(l,"readlink").getNode();if(!y.isSymlink())throw(0,Ee.createError)("EINVAL","readlink",l);return(0,hs.strToEncoding)(y.symlink,a)},this.readlinkSync=(l,a)=>{let g=(0,Ft.getDefaultOpts)(a),y=(0,Ee.pathToFilename)(l);return this._readlink(y,g.encoding)},this.readlink=(l,a,g)=>{let[y,b]=(0,Ft.getDefaultOptsAndCb)(a,g),S=(0,Ee.pathToFilename)(l);this.wrapAsync(this._readlink,[S,y.encoding],b)},this._fsync=l=>{this._core.getFileByFdOrThrow(l,"fsync")},this.fsyncSync=l=>{this._fsync(l)},this.fsync=(l,a)=>{this.wrapAsync(this._fsync,[l],a)},this._fdatasync=l=>{this._core.getFileByFdOrThrow(l,"fdatasync")},this.fdatasyncSync=l=>{this._fdatasync(l)},this.fdatasync=(l,a)=>{this.wrapAsync(this._fdatasync,[l],a)},this._ftruncate=(l,a)=>{this._core.getFileByFdOrThrow(l,"ftruncate").truncate(a)},this.ftruncateSync=(l,a)=>{this._ftruncate(l,a)},this.ftruncate=(l,a,g)=>{let y=typeof a=="number"?a:0,b=(0,Ee.validateCallback)(typeof a=="number"?g:a);this.wrapAsync(this._ftruncate,[l,y],b)},this._truncate=(l,a)=>{let g=this.openSync(l,"r+");try{this.ftruncateSync(g,a)}finally{this.closeSync(g)}},this.truncateSync=(l,a)=>{if((0,pr.isFd)(l))return this.ftruncateSync(l,a);this._truncate(l,a)},this.truncate=(l,a,g)=>{let y=typeof a=="number"?a:0,b=(0,Ee.validateCallback)(typeof a=="number"?g:a);if((0,pr.isFd)(l))return this.ftruncate(l,y,b);this.wrapAsync(this._truncate,[l,y],b)},this._futimes=(l,a,g)=>{let b=this._core.getFileByFdOrThrow(l,"futimes").node;b.atime=new Date(a*1e3),b.mtime=new Date(g*1e3)},this.futimesSync=(l,a,g)=>{this._futimes(l,Ir(a),Ir(g))},this.futimes=(l,a,g,y)=>{this.wrapAsync(this._futimes,[l,Ir(a),Ir(g)],y)},this._utimes=(l,a,g,y=!0)=>{let b=this._core,F=(y?b.getResolvedLinkOrThrow(l,"utimes"):b.getLinkOrThrow(l,"lutimes")).getNode();F.atime=new Date(a*1e3),F.mtime=new Date(g*1e3)},this.utimesSync=(l,a,g)=>{this._utimes((0,Ee.pathToFilename)(l),Ir(a),Ir(g),!0)},this.utimes=(l,a,g,y)=>{this.wrapAsync(this._utimes,[(0,Ee.pathToFilename)(l),Ir(a),Ir(g),!0],y)},this.lutimesSync=(l,a,g)=>{this._utimes((0,Ee.pathToFilename)(l),Ir(a),Ir(g),!1)},this.lutimes=(l,a,g,y)=>{this.wrapAsync(this._utimes,[(0,Ee.pathToFilename)(l),Ir(a),Ir(g),!1],y)},this.mkdirSync=(l,a)=>{let g=(0,Ft.getMkdirOptions)(a),y=(0,Ee.modeToNumber)(g.mode,511),b=(0,Ee.pathToFilename)(l);if(g.recursive)return this._core.mkdirp(b,y);this._core.mkdir(b,y)},this.mkdir=(l,a,g)=>{let y=(0,Ft.getMkdirOptions)(a),b=(0,Ee.validateCallback)(typeof a=="function"?a:g),S=(0,Ee.modeToNumber)(y.mode,511),F=(0,Ee.pathToFilename)(l);y.recursive?this.wrapAsync(this._core.mkdirp,[F,S],b):this.wrapAsync(this._core.mkdir,[F,S],b)},this._mkdtemp=(l,a,g=5)=>{let y=l+(0,Ee.genRndStr6)();try{return this._core.mkdir(y,511),(0,hs.strToEncoding)(y,a)}catch(b){if(b.code==="EEXIST"){if(g>1)return this._mkdtemp(l,a,g-1);throw Error("Could not create temp dir.")}else throw b}},this.mkdtempSync=(l,a)=>{let{encoding:g}=(0,Ft.getDefaultOpts)(a);if(!l||typeof l!="string")throw new TypeError("filename prefix is required");return(0,Ee.nullCheck)(l),this._mkdtemp(l,g)},this.mkdtemp=(l,a,g)=>{let[{encoding:y},b]=(0,Ft.getDefaultOptsAndCb)(a,g);if(!l||typeof l!="string")throw new TypeError("filename prefix is required");(0,Ee.nullCheck)(l)&&this.wrapAsync(this._mkdtemp,[l,y],b)},this.rmdirSync=(l,a)=>{let g=(0,Ft.getRmdirOptions)(a);this._core.rmdir((0,Ee.pathToFilename)(l),g.recursive)},this.rmdir=(l,a,g)=>{let y=(0,Ft.getRmdirOptions)(a),b=(0,Ee.validateCallback)(typeof a=="function"?a:g);this.wrapAsync(this._core.rmdir,[(0,Ee.pathToFilename)(l),y.recursive],b)},this.rmSync=(l,a)=>{this._core.rm((0,Ee.pathToFilename)(l),a?.force,a?.recursive)},this.rm=(l,a,g)=>{let[y,b]=(0,Ft.getRmOptsAndCb)(a,g);this.wrapAsync(this._core.rm,[(0,Ee.pathToFilename)(l),y?.force,y?.recursive],b)},this._fchmod=(l,a)=>{this._core.getFileByFdOrThrow(l,"fchmod").chmod(a)},this.fchmodSync=(l,a)=>{this._fchmod(l,(0,Ee.modeToNumber)(a))},this.fchmod=(l,a,g)=>{this.wrapAsync(this._fchmod,[l,(0,Ee.modeToNumber)(a)],g)},this._chmod=(l,a,g=!0)=>{(g?this._core.getResolvedLinkOrThrow(l,"chmod"):this._core.getLinkOrThrow(l,"chmod")).getNode().chmod(a)},this.chmodSync=(l,a)=>{let g=(0,Ee.modeToNumber)(a),y=(0,Ee.pathToFilename)(l);this._chmod(y,g,!0)},this.chmod=(l,a,g)=>{let y=(0,Ee.modeToNumber)(a),b=(0,Ee.pathToFilename)(l);this.wrapAsync(this._chmod,[b,y],g)},this._lchmod=(l,a)=>{this._chmod(l,a,!1)},this.lchmodSync=(l,a)=>{let g=(0,Ee.modeToNumber)(a),y=(0,Ee.pathToFilename)(l);this._lchmod(y,g)},this.lchmod=(l,a,g)=>{let y=(0,Ee.modeToNumber)(a),b=(0,Ee.pathToFilename)(l);this.wrapAsync(this._lchmod,[b,y],g)},this._fchown=(l,a,g)=>{this._core.getFileByFdOrThrow(l,"fchown").chown(a,g)},this.fchownSync=(l,a,g)=>{oo(a),lo(g),this._fchown(l,a,g)},this.fchown=(l,a,g,y)=>{oo(a),lo(g),this.wrapAsync(this._fchown,[l,a,g],y)},this._chown=(l,a,g)=>{this._core.getResolvedLinkOrThrow(l,"chown").getNode().chown(a,g)},this.chownSync=(l,a,g)=>{oo(a),lo(g),this._chown((0,Ee.pathToFilename)(l),a,g)},this.chown=(l,a,g,y)=>{oo(a),lo(g),this.wrapAsync(this._chown,[(0,Ee.pathToFilename)(l),a,g],y)},this._lchown=(l,a,g)=>{this._core.getLinkOrThrow(l,"lchown").getNode().chown(a,g)},this.lchownSync=(l,a,g)=>{oo(a),lo(g),this._lchown((0,Ee.pathToFilename)(l),a,g)},this.lchown=(l,a,g,y)=>{oo(a),lo(g),this.wrapAsync(this._lchown,[(0,Ee.pathToFilename)(l),a,g],y)},this.statWatchers={},this.cpSync=(l,a,g)=>{let y=(0,Ee.pathToFilename)(l),b=(0,Ee.pathToFilename)(a),S={dereference:g?.dereference??!1,errorOnExist:g?.errorOnExist??!1,filter:g?.filter,force:g?.force??!0,mode:g?.mode??0,preserveTimestamps:g?.preserveTimestamps??!1,recursive:g?.recursive??!1,verbatimSymlinks:g?.verbatimSymlinks??!1};return this._cp(y,b,S)},this.cp=(l,a,g,y)=>{let b=(0,Ee.pathToFilename)(l),S=(0,Ee.pathToFilename)(a),F,T;typeof g=="function"?[F,T]=[{},g]:[F,T]=[g||{},y],(0,Ee.validateCallback)(T);let P={dereference:F?.dereference??!1,errorOnExist:F?.errorOnExist??!1,filter:F?.filter,force:F?.force??!0,mode:F?.mode??0,preserveTimestamps:F?.preserveTimestamps??!1,recursive:F?.recursive??!1,verbatimSymlinks:F?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[b,S,P],T)},this.openAsBlob=async(l,a)=>{let g=(0,Ee.pathToFilename)(l),y;try{y=this._core.getResolvedLinkOrThrow(g,"open")}catch(T){throw T&&typeof T=="object"&&T.code==="ENOENT"?new Bx.TypeError("ERR_INVALID_ARG_VALUE"):T}let S=y.getNode().getBuffer(),F=a?.type||"";return new Blob([S],{type:F})},this.glob=(l,...a)=>{let[g,y]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[l,g||{}],y)},this.globSync=(l,a={})=>this._globSync(l,a),this._globSync=(l,a={})=>{let{globSync:g}=zv();return g(this,l,a)},this._opendir=(l,a)=>{let g=this._core.getResolvedLinkOrThrow(l,"scandir");if(!g.getNode().isDirectory())throw(0,Ee.createError)("ENOTDIR","scandir",l);return new jx.Dir(g,a)},this.opendirSync=(l,a)=>{let g=(0,Ft.getOpendirOptions)(a),y=(0,Ee.pathToFilename)(l);return this._opendir(y,g)},this.opendir=(l,a,g)=>{let[y,b]=(0,Ft.getOpendirOptsAndCb)(a,g),S=(0,Ee.pathToFilename)(l);this.wrapAsync(this._opendir,[S,y],b)};let t=this;this.StatWatcher=class extends zf{constructor(){super(t)}};let r=gi;this.ReadStream=class extends r{constructor(...l){super(t,...l)}};let n=Qr;this.WriteStream=class extends n{constructor(...l){super(t,...l)}},this.FSWatcher=class extends Hf{constructor(){super(t)}};let o=c((l,a)=>{let g=this._core.getResolvedLinkOrThrow(l,"realpath");return(0,hs.strToEncoding)(g.getPath()||"/",a)},"_realpath"),f=c((l,a,g)=>{let[y,b]=(0,Ft.getRealpathOptsAndCb)(a,g),S=(0,Ee.pathToFilename)(l);t.wrapAsync(o,[S,y.encoding],b)},"realpathImpl"),m=c((l,a)=>o((0,Ee.pathToFilename)(l),(0,Ft.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=f,this.realpath.native=f,this.realpathSync=m,this.realpathSync.native=m}wrapAsync(e,t,r){(0,Ee.validateCallback)(r),Promise.resolve().then(()=>{let n;try{n=e.apply(this,t)}catch(o){r(o);return}r(null,n)})}toTree(e={separator:Xt.sep}){return(0,Ix.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,t={},r=!1,n=!1){return this._core.toJSON(e,t,r,n)}fromJSON(e,t){return this._core.fromJSON(e,t)}fromNestedJSON(e,t){return this._core.fromNestedJSON(e,t)}mountSync(e,t){this._core.fromJSON(t,e)}_write(e,t,r,n,o){let f=this._core.getFileByFdOrThrow(e,"write");if(f.node.isSymlink())throw(0,Ee.createError)("EBADF","write",f.link.getPath());return f.write(t,r,n,o===-1||typeof o!="number"?void 0:o)}writevBase(e,t,r){let n=this._core.getFileByFdOrThrow(e),o=r??void 0;o===-1&&(o=void 0);let f=0;for(let m of t){let l=co.Buffer.from(m.buffer,m.byteOffset,m.byteLength),a=n.write(l,0,l.byteLength,o);if(o=void 0,f+=a,a<l.byteLength)break}return f}_copyFile(e,t,r){let n=this.readFileSync(e);if(r&Wx&&this.existsSync(t))throw(0,Ee.createError)("EEXIST","copyFile",e,t);if(r&qx)throw(0,Ee.createError)("ENOSYS","copyFile",e,t);this._core.writeFile(t,n,qf.FLAGS.w,438)}isSrcSubdir(e,t){try{let r=Vv(e.startsWith("/")?e:"/"+e),n=Vv(t.startsWith("/")?t:"/"+t);if(r===n)return!0;let o=Wf(r,n);return o===""||!o.startsWith("..")&&!(0,Xt.isAbsolute)(o)}catch{return!1}}cpFileSync(e,t,r,n,o){if(t){if(o.errorOnExist)throw(0,Ee.createError)("EEXIST","cp",n);if(!o.force)return;this.unlinkSync(n)}this.copyFileSync(r,n,o.mode),o.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,t,r,n,o){t||this.mkdirSync(n);let f=this.readdirSync(r);for(let m of f){let l=Ym(r,String(m)),a=Ym(n,String(m));o.filter&&!o.filter(l,a)||this._cp(l,a,o)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,t,r,n){let o=String(this.readlinkSync(t));!n.verbatimSymlinks&&!(0,Xt.isAbsolute)(o)&&(o=Mx(Gv(t),o)),e&&this.unlinkSync(r),this.symlinkSync(o,r)}lstat(e,t,r){let[{throwIfNoEntry:n=!0,bigint:o=!1},f]=(0,Ft.getStatOptsAndCb)(t,r);this.wrapAsync(this._lstat,[(0,Ee.pathToFilename)(e),o,n],f)}_stat(e,t=!1,r=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(o){if(o.code==="ENOENT"&&!r)return;throw o}return Km.default.build(n.getNode(),t)}statSync(e,t){let{bigint:r=!0,throwIfNoEntry:n=!0}=(0,Ft.getStatOptions)(t);return this._stat((0,Ee.pathToFilename)(e),r,n)}stat(e,t,r){let[{bigint:n=!1,throwIfNoEntry:o=!0},f]=(0,Ft.getStatOptsAndCb)(t,r);this.wrapAsync(this._stat,[(0,Ee.pathToFilename)(e),n,o],f)}fstatBase(e,t=!1){let r=this._core.getFileByFd(e);if(!r)throw(0,Ee.createError)("EBADF","fstat");return Km.default.build(r.node,t)}fstatSync(e,t){return this.fstatBase(e,(0,Ft.getStatOptions)(t).bigint)}fstat(e,t,r){let[n,o]=(0,Ft.getStatOptsAndCb)(t,r);this.wrapAsync(this.fstatBase,[e,n.bigint],o)}_exists(e){return!!this._stat(e)}_access(e,t){let n=this._core.getLinkOrThrow(e,"access").getNode();if(t!==Jm&&(t&$x&&!n.canRead()||t&Lx&&!n.canWrite()||t&Ux&&!n.canExecute()))throw(0,Ee.createError)("EACCES","access",e)}watchFile(e,t,r){let n=(0,Ee.pathToFilename)(e),o=t,f=r;if(typeof o=="function"&&(f=t,o=null),typeof f!="function")throw Error('"watchFile()" requires a listener function');let m=5007,l=!0;o&&typeof o=="object"&&(typeof o.interval=="number"&&(m=o.interval),typeof o.persistent=="boolean"&&(l=o.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,l,m),this.statWatchers[n]=a),a.addListener("change",f),a}unwatchFile(e,t){let r=(0,Ee.pathToFilename)(e),n=this.statWatchers[r];n&&(typeof t=="function"?n.removeListener("change",t):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[r]))}createReadStream(e,t){return new this.ReadStream(e,t)}createWriteStream(e,t){return new this.WriteStream(e,t)}watch(e,t,r){let n=(0,Ee.pathToFilename)(e),o=t;typeof t=="function"&&(r=t,o=null);let{persistent:f,recursive:m,encoding:l}=(0,Ft.getDefaultOpts)(o);f===void 0&&(f=!0),m===void 0&&(m=!1);let a=new this.FSWatcher;return a.start(n,f,m,l),r&&a.addListener("change",r),a}_statfs(e,t=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),Ax.default.build(this._core,t)}statfsSync(e,t){let{bigint:r=!1}=(0,Ft.getStatfsOptions)(t);return this._statfs((0,Ee.pathToFilename)(e),r)}statfs(e,t,r){let[{bigint:n=!1},o]=(0,Ft.getStatfsOptsAndCb)(t,r);this.wrapAsync(this._statfs,[(0,Ee.pathToFilename)(e),n],o)}};c(Qm,"Volume");var us=Qm;Br.Volume=us;us.fromJSON=(i,e)=>new us(Xm.Superblock.fromJSON(i,e));us.fromNestedJSON=(i,e)=>new us(Xm.Superblock.fromNestedJSON(i,e));function Vx(i){i.emit("stop")}c(Vx,"emitStop");var Zm=class Zm extends Kv.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let t=this.vol.statSync(this.filename);this.hasChanged(t)&&(this.emit("change",t,this.prev),this.prev=t)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,t=!0,r=5007){this.filename=(0,Ee.pathToFilename)(e),this.setTimeout=t?setTimeout.bind(globalThis):Px.default,this.interval=r,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Gf.default)(()=>{Vx.call(this,this)})}};c(Zm,"StatWatcher");var zf=Zm;Br.StatWatcher=zf;var Xr;function Kx(i){Xr=(0,co.bufferAllocUnsafe)(i),Xr.used=0}c(Kx,"allocNewPool");(0,Jv.inherits)(gi,Vf.Readable);Br.ReadStream=gi;function gi(i,e,t){if(!(this instanceof gi))return new gi(i,e,t);if(this._vol=i,t=Object.assign({},(0,Ft.getOptions)(t,{})),t.highWaterMark===void 0&&(t.highWaterMark=64*1024),Vf.Readable.call(this,t),this.path=(0,Ee.pathToFilename)(e),this.fd=t.fd===void 0?null:typeof t.fd!="number"?t.fd.fd:t.fd,this.flags=t.flags===void 0?"r":t.flags,this.mode=t.mode===void 0?438:t.mode,this.start=t.start,this.end=t.end,this.autoClose=t.autoClose===void 0?!0:t.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}c(gi,"FsReadStream");gi.prototype.open=function(){var i=this;this._vol.open(this.path,this.flags,this.mode,(e,t)=>{if(e){i.autoClose&&i.destroy&&i.destroy(),i.emit("error",e);return}i.fd=t,i.emit("open",t),i.read()})};gi.prototype._read=function(i){if(typeof this.fd!="number")return this.once("open",function(){this._read(i)});if(this.destroyed)return;(!Xr||Xr.length-Xr.used<zx)&&Kx(this._readableState.highWaterMark);var e=Xr,t=Math.min(Xr.length-Xr.used,i),r=Xr.used;if(this.pos!==void 0&&(t=Math.min(this.end-this.pos+1,t)),t<=0)return this.push(null);var n=this;this._vol.read(this.fd,Xr,Xr.used,t,this.pos,o),this.pos!==void 0&&(this.pos+=t),Xr.used+=t;function o(f,m){if(f)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",f);else{var l=null;m>0&&(n.bytesRead+=m,l=e.slice(r,r+m)),n.push(l)}}c(o,"onread")};gi.prototype._destroy=function(i,e){this.close(t=>{e(i||t)})};gi.prototype.close=function(i){if(i&&this.once("close",i),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",Yv);return}return(0,Gf.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function Yv(i){this.close()}c(Yv,"closeOnOpen");(0,Jv.inherits)(Qr,Vf.Writable);Br.WriteStream=Qr;function Qr(i,e,t){if(!(this instanceof Qr))return new Qr(i,e,t);if(this._vol=i,t=Object.assign({},(0,Ft.getOptions)(t,{})),Vf.Writable.call(this,t),this.path=(0,Ee.pathToFilename)(e),this.fd=t.fd===void 0?null:typeof t.fd!="number"?t.fd.fd:t.fd,this.flags=t.flags===void 0?"w":t.flags,this.mode=t.mode===void 0?438:t.mode,this.start=t.start,this.autoClose=t.autoClose===void 0?!0:!!t.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}t.encoding&&this.setDefaultEncoding(t.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}c(Qr,"FsWriteStream");Qr.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(i,e){if(i){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",i);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Qr.prototype._write=function(i,e,t){if(!(i instanceof co.Buffer||i instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(i,e,t)});var r=this;this._vol.write(this.fd,i,0,i.length,this.pos,(n,o)=>{if(n)return r.autoClose&&r.destroy&&r.destroy(),t(n);r.bytesWritten+=o,t()}),this.pos!==void 0&&(this.pos+=i.length)};Qr.prototype._writev=function(i,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(i,e)});let t=this,r=i.length,n=new Array(r);for(var o=0,f=0;f<r;f++){var m=i[f].chunk;n[f]=m,o+=m.length}let l=co.Buffer.concat(n);this._vol.write(this.fd,l,0,l.length,this.pos,(a,g)=>{if(a)return t.destroy&&t.destroy(),e(a);t.bytesWritten+=g,e()}),this.pos!==void 0&&(this.pos+=o)};Qr.prototype.close=function(i){if(i&&this.once("close",i),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",Yv);return}return(0,Gf.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Qr.prototype._destroy=gi.prototype._destroy;Qr.prototype.destroySoon=Qr.prototype.end;var eg=class eg extends Kv.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=hs.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=t=>{t.getName()===this._getName()&&this._emit("rename")},this._emit=t=>{this.emit("change",t,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,t=!0,r=!1,n=hs.ENCODING_UTF8){this._filename=(0,Ee.pathToFilename)(e),this._steps=(0,pr.filenameToSteps)(this._filename),this._filenameEncoded=(0,hs.strToEncoding)(this._filename),this._recursive=r,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(l){let a=new Error(`watch ${this._filename} ${l.code}`);throw a.code=l.code,a.errno=l.code,a}let o=c(l=>{let a=l.getPath(),g=l.getNode(),y=c(()=>{let F=Wf(this._filename,a);return F||(F=this._getName()),this.emit("change","change",F)},"onNodeChange"),b=g.changes.listen(([F])=>{F==="modify"&&y()}),S=this._listenerRemovers.get(g.ino)??[];S.push(()=>b()),this._listenerRemovers.set(g.ino,S)},"watchLinkNodeChanged"),f=c(l=>{let a=l.getNode(),g=c(F=>{this.emit("change","rename",Wf(this._filename,F.getPath())),o(F),f(F)},"onLinkChildAdd"),y=c(F=>{let T=c(P=>{let $=P.getNode().ino,R=this._listenerRemovers.get($);R&&(R.forEach(M=>M()),this._listenerRemovers.delete($));for(let[M,C]of P.children.entries())C&&M!=="."&&M!==".."&&T(C)},"removeLinkNodeListeners");T(F),this.emit("change","rename",Wf(this._filename,F.getPath()))},"onLinkChildDelete");for(let[F,T]of l.children.entries())T&&F!=="."&&F!==".."&&o(T);let b=l.changes.listen(([F,T])=>{F==="child:add"?g(T):F==="child:del"&&y(T)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{b()}),r)for(let[F,T]of l.children.entries())T&&F!=="."&&F!==".."&&f(T)},"watchLinkChildrenChanged");o(this._link),f(this._link);let m=this._link.parent;m&&m.changes.listen(([l,a])=>{l==="child:del"&&this._onParentChild(a)}),t&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(t=>t())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};c(eg,"FSWatcher");var Hf=eg;Br.FSWatcher=Hf});var Qv=Ze(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.fsSynchronousApiList=void 0;Kf.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var Zv=Ze(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});Jf.fsCallbackApiList=void 0;Jf.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var tS=Ze((jr,Yf)=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.memfs=jr.fs=jr.vol=jr.Volume=void 0;jr.createFsFromVolume=tg;var Jx=hm(),Yx=pf(),Xf=Xv();Object.defineProperty(jr,"Volume",{enumerable:!0,get:c(function(){return Xf.Volume},"get")});var eS=si(),Xx=Qv(),Qx=Zv(),{F_OK:Zx,R_OK:eA,W_OK:tA,X_OK:rA}=eS.constants;jr.vol=new Xf.Volume;function tg(i){let e={F_OK:Zx,R_OK:eA,W_OK:tA,X_OK:rA,constants:eS.constants,Stats:Jx.default,Dirent:Yx.default};for(let t of Xx.fsSynchronousApiList)typeof i[t]=="function"&&(e[t]=i[t].bind(i));for(let t of Qx.fsCallbackApiList)typeof i[t]=="function"&&(e[t]=i[t].bind(i));return e.StatWatcher=i.StatWatcher,e.FSWatcher=i.FSWatcher,e.WriteStream=i.WriteStream,e.ReadStream=i.ReadStream,e.promises=i.promises,typeof i.realpath=="function"&&(e.realpath=i.realpath.bind(i),typeof i.realpath.native=="function"&&(e.realpath.native=i.realpath.native.bind(i))),typeof i.realpathSync=="function"&&(e.realpathSync=i.realpathSync.bind(i),typeof i.realpathSync.native=="function"&&(e.realpathSync.native=i.realpathSync.native.bind(i))),e._toUnixTimestamp=Xf.toUnixTimestamp,e.__vol=i,e}c(tg,"createFsFromVolume");jr.fs=tg(jr.vol);var iA=c((i={},e="/")=>{let t=Xf.Volume.fromNestedJSON(i,e);return{fs:tg(t),vol:t}},"memfs");jr.memfs=iA;Yf.exports={...Yf.exports,...jr.fs};Yf.exports.semantic=!0});var Iw=c(i=>{try{let t=i.split(".")[1];if(!t)throw new Error("Invalid JWT format");let r=t.replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4!==0;)r+="=";let n=atob(r),f=JSON.parse(n).exp;if(!f||typeof f!="number")throw new Error('JWT does not contain a valid "exp" field');return f*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),Fo,qs,Rd=(qs=class{constructor(e){pt(this,"strategy","jwt");pt(this,"cachedToken",null);pt(this,"tokenExpiry",null);So(this,Fo);Eo(this,Fo,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let t=await vo(this,Fo).call(this);return t?(this.cachedToken=t,this.tokenExpiry=Iw(t),{Authorization:`Bearer ${t}`}):!1}readAuthHeaders(e){let t=e.get("Authorization");if(!t)return;let[r,n]=t.split(" ");if(r!=="Bearer"||!n)throw new Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=Iw(n)}},Fo=new WeakMap,c(qs,"AssistantCloudJWTAuthStrategy"),qs),ko,Ro,To,zs,Bw=(zs=class{constructor(e,t,r){pt(this,"strategy","api-key");So(this,ko);So(this,Ro);So(this,To);Eo(this,ko,e),Eo(this,Ro,t),Eo(this,To,r)}async getAuthHeaders(){return{Authorization:`Bearer ${vo(this,ko)}`,"Aui-User-Id":vo(this,Ro),"Aui-Workspace-Id":vo(this,To)}}readAuthHeaders(){}},ko=new WeakMap,Ro=new WeakMap,To=new WeakMap,c(zs,"AssistantCloudAPIKeyAuthStrategy"),zs),Al="aui:refresh_token",Hs,jw=(Hs=class{constructor(e){pt(this,"strategy","anon");pt(this,"baseUrl");pt(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new Rd(async()=>{let t=Date.now(),r=localStorage.getItem(Al),n=r?JSON.parse(r):void 0;if(n)if(new Date(n.expires_at).getTime()-t>30*1e3){let g=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(g.ok){let y=await g.json(),{access_token:b,refresh_token:S}=y;return S&&localStorage.setItem(Al,JSON.stringify(S)),b}}else localStorage.removeItem(Al);let o=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!o.ok)return null;let f=await o.json(),{access_token:m,refresh_token:l}=f;return!m||!l?null:(localStorage.setItem(Al,JSON.stringify(l)),m)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},c(Hs,"AssistantCloudAnonymousAuthStrategy"),Hs);var Gs,AS=(Gs=class extends Error{constructor(e){super(e),this.name="APIError"}},c(Gs,"CloudAPIError"),Gs),Vs,Mw=(Vs=class{constructor(e){pt(this,"_auth");pt(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new Rd(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new Bw(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new jw(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let r=await this._auth.getAuthHeaders();if(!r)throw new Error("Authorization failed");let n={...r,...t.headers,"Content-Type":"application/json"},o=new URLSearchParams;if(t.query)for(let[l,a]of Object.entries(t.query))a!==!1&&(a===!0?o.set(l,"true"):o.set(l,a.toString()));let f=new URL(`${this._baseUrl}/v1${e}`);f.search=o.toString();let m=await fetch(f,{method:t.method??"GET",headers:n,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(m.headers),!m.ok){let l=await m.text();try{let a=JSON.parse(l);throw new AS(a.message)}catch{throw new Error(`Request failed with status ${m.status}, ${l}`)}}return m}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}},c(Vs,"AssistantCloudAPI"),Vs);var Ks,$w=(Ks=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},c(Ks,"AssistantCloudAuthTokens"),Ks);var Oo={toResponse(i,e){return new Response(Oo.toByteStream(i,e),{headers:e.headers??{}})},fromResponse(i,e){return Oo.fromByteStream(i.body,e)},toByteStream(i,e){return i.pipeThrough(e)},fromByteStream(i,e){return i.pipeThrough(e)}};var Pl=c(function(){let i,e,t=new Promise((r,n)=>{i=r,e=n});if(!i||!e)throw new Error("Failed to create promise");return{promise:t,resolve:i,reject:e}},"promiseWithResolvers");var Lw=c(()=>{let i=[],e=!1,t,r,n=c(f=>{f.promise||(f.promise=f.reader.read().then(({done:m,value:l})=>{f.promise=void 0,m?(i.splice(i.indexOf(f),1),e&&i.length===0&&t.close()):t.enqueue(l),r?.resolve(),r=void 0}).catch(m=>{console.error(m),i.forEach(l=>{l.reader.cancel()}),i.length=0,t.error(m),r?.reject(m),r=void 0}))},"handlePull");return{readable:new ReadableStream({start(f){t=f},pull(){return r=Pl(),i.forEach(f=>{n(f)}),r.promise},cancel(){i.forEach(f=>{f.reader.cancel()}),i.length=0}}),isSealed(){return e},seal(){e=!0,i.length===0&&t.close()},addStream(f){if(e)throw new Error("Cannot add streams after the run callback has settled.");let m={reader:f.getReader()};i.push(m),n(m)},enqueue(f){this.addStream(new ReadableStream({start(m){m.enqueue(f),m.close()}}))}}},"createMergeStream");var Js,Uw=(Js=class{constructor(e){pt(this,"_controller");pt(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},c(Js,"TextStreamControllerImpl"),Js),Td=c(i=>new ReadableStream({start(e){return i.start?.(new Uw(e))},pull(e){return i.pull?.(new Uw(e))},cancel(e){return i.cancel?.(e)}}),"createTextStream"),Od=c(()=>{let i;return[Td({start(t){i=t}}),i]},"createTextStreamController");var Ys,Ww=(Ys=class{constructor(e){pt(this,"_isClosed",!1);pt(this,"_mergeTask");pt(this,"_argsTextController");this._controller=e;let t=Td({start:c(n=>{this._argsTextController=n},"start")}),r=!1;this._mergeTask=t.pipeTo(new WritableStream({write:c(n=>{switch(n.type){case"text-delta":r=!0,this._controller.enqueue(n);break;case"part-finish":r||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},c(Ys,"ToolCallStreamControllerImpl"),Ys),PS=c(i=>new ReadableStream({start(e){return i.start?.(new Ww(e))},pull(e){return i.pull?.(new Ww(e))},cancel(e){return i.cancel?.(e)}}),"createToolCallStream"),qw=c(()=>{let i;return[PS({start(t){i=t}}),i]},"createToolCallStreamController");var Xs,Dl=(Xs=class{constructor(){pt(this,"value",-1)}up(){return++this.value}},c(Xs,"Counter"),Xs);var Qs,zw=(Qs=class extends TransformStream{constructor(e){super({transform(t,r){r.enqueue({...t,path:[e,...t.path]})}})}},c(Qs,"PathAppendEncoder"),Qs),Zs,qA=(Zs=class extends TransformStream{constructor(e){super({transform(t,r){let{path:[n,...o]}=t;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);r.enqueue({...t,path:o})}})}},c(Zs,"PathAppendDecoder"),Zs),ea,Hw=(ea=class extends TransformStream{constructor(e){let t=new Dl,r=new Map;super({transform(n,o){n.type==="part-start"&&n.path.length===0&&r.set(t.up(),e.up());let[f,...m]=n.path;if(f===void 0){o.enqueue(n);return}let l=r.get(f);if(l===void 0)throw new Error("Path not found");o.enqueue({...n,path:[l,...m]})}})}},c(ea,"PathMergeEncoder"),ea);var ta,Gw=(ta=class extends TransformStream{constructor(e,t,r){let[n,o]=Vw(),f;super({start(m){return f=n.pipeTo(new WritableStream({write(l){m.enqueue(l)},abort(l){m.error(l)},close(){m.terminate()}})).catch(l=>{m.error(l)}),e.start?.(o)},transform(m){return e.transform?.(m,o)},async flush(){await e.flush?.(o),o.close(),await f}},t,r)}},c(ta,"AssistantTransformStream"),ta);var ra,Kw=(ra=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},c(ra,"PipeableTransformStream"),ra);var Nl=c((i,e=21)=>(t=e)=>{let r="",n=t|0;for(;n--;)r+=i[Math.random()*i.length|0];return r},"customAlphabet");var Jw=Nl("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Yn,DS=(Yn=class{constructor(e){pt(this,"_state");pt(this,"_parentId");this._state=e||{merger:Lw(),contentCounter:new Dl}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new zw(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new Hw(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=Od();return this._addPart({type:"text"},e),t}addReasoningPart(){let[e,t]=Od();return this._addPart({type:"reasoning"},e),t}addToolCallPart(e){let t=typeof e=="string"?{toolName:e}:e,r=t.toolName,n=t.toolCallId??Jw(),[o,f]=qw();return this._addPart({type:"tool-call",toolName:r,toolCallId:n,...this._parentId&&{parentId:this._parentId}},o),t.argsText!==void 0&&(f.argsText.append(t.argsText),f.argsText.close()),t.args!==void 0&&(f.argsText.append(JSON.stringify(t.args)),f.argsText.close()),t.response!==void 0&&f.setResponse(t.response),f}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let t=new Yn(this._state);return t._parentId=e,t}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},c(Yn,"_AssistantStreamControllerImpl"),Yn);function NS(i){let e=new DS;return c(async()=>{try{await i(e)}catch(r){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(r)}),r}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}c(NS,"createAssistantStream");function Vw(){let{resolve:i,promise:e}=Pl(),t;return[NS(n=>(t=n,t.__internal_subscribeToClose(i),e)),t]}c(Vw,"createAssistantStreamController");var ia,xd=(ia=class extends Kw{constructor(){super(e=>{let t=new Gw({transform(r,n){n.appendText(r)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},c(ia,"PlainTextDecoder"),ia);var na,Yw=(na=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:c(async()=>{let t=await this.cloud._auth.getAuthHeaders();if(!t)throw new Error("Authorization failed");return{...t,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let t=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return Oo.fromResponse(t,new xd)}},c(na,"AssistantCloudRuns"),na);var sa,Xw=(sa=class{constructor(e){this.cloud=e}async list(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t})}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:t})}},c(sa,"AssistantCloudThreadMessages"),sa);var aa,Qw=(aa=class{constructor(e){pt(this,"messages");this.cloud=e,this.messages=new Xw(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},c(aa,"AssistantCloudThreads"),aa);var oa,Zw=(oa=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},c(oa,"AssistantCloudFiles"),oa);var la,Ad=(la=class{constructor(e){pt(this,"threads");pt(this,"auth");pt(this,"runs");pt(this,"files");let t=new Mw(e);this.threads=new Qw(t),this.auth={tokens:new $w(t)},this.runs=new Yw(t),this.files=new Zw(t)}},c(la,"AssistantCloud"),la);var Xn={toResponse(i,e){return new Response(Xn.toByteStream(i,e),{headers:e.headers??{}})},fromResponse(i,e){return Xn.fromByteStream(i.body,e)},toByteStream(i,e){return i.pipeThrough(e)},fromByteStream(i,e){return i.pipeThrough(e)}};var Cl=c(function(){let i,e,t=new Promise((r,n)=>{i=r,e=n});if(!i||!e)throw new Error("Failed to create promise");return{promise:t,resolve:i,reject:e}},"promiseWithResolvers");var eb=c(()=>{let i=[],e=!1,t,r,n=c(f=>{f.promise||(f.promise=f.reader.read().then(({done:m,value:l})=>{f.promise=void 0,m?(i.splice(i.indexOf(f),1),e&&i.length===0&&t.close()):t.enqueue(l),r?.resolve(),r=void 0}).catch(m=>{console.error(m),i.forEach(l=>{l.reader.cancel()}),i.length=0,t.error(m),r?.reject(m),r=void 0}))},"handlePull");return{readable:new ReadableStream({start(f){t=f},pull(){return r=Cl(),i.forEach(f=>{n(f)}),r.promise},cancel(){i.forEach(f=>{f.reader.cancel()}),i.length=0}}),isSealed(){return e},seal(){e=!0,i.length===0&&t.close()},addStream(f){if(e)throw new Error("Cannot add streams after the run callback has settled.");let m={reader:f.getReader()};i.push(m),n(m)},enqueue(f){this.addStream(new ReadableStream({start(m){m.enqueue(f),m.close()}}))}}},"createMergeStream");var ca,tb=(ca=class{constructor(e){pt(this,"_controller");pt(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},c(ca,"TextStreamControllerImpl"),ca),Pd=c(i=>new ReadableStream({start(e){return i.start?.(new tb(e))},pull(e){return i.pull?.(new tb(e))},cancel(e){return i.cancel?.(e)}}),"createTextStream"),Dd=c(()=>{let i;return[Pd({start(t){i=t}}),i]},"createTextStreamController");var fa,rb=(fa=class{constructor(e){pt(this,"_isClosed",!1);pt(this,"_mergeTask");pt(this,"_argsTextController");this._controller=e;let t=Pd({start:c(n=>{this._argsTextController=n},"start")}),r=!1;this._mergeTask=t.pipeTo(new WritableStream({write:c(n=>{switch(n.type){case"text-delta":r=!0,this._controller.enqueue(n);break;case"part-finish":r||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},c(fa,"ToolCallStreamControllerImpl"),fa),CS=c(i=>new ReadableStream({start(e){return i.start?.(new rb(e))},pull(e){return i.pull?.(new rb(e))},cancel(e){return i.cancel?.(e)}}),"createToolCallStream"),ib=c(()=>{let i;return[CS({start(t){i=t}}),i]},"createToolCallStreamController");var ha,Il=(ha=class{constructor(){pt(this,"value",-1)}up(){return++this.value}},c(ha,"Counter"),ha);var ua,nb=(ua=class extends TransformStream{constructor(e){super({transform(t,r){r.enqueue({...t,path:[e,...t.path]})}})}},c(ua,"PathAppendEncoder"),ua),da,QP=(da=class extends TransformStream{constructor(e){super({transform(t,r){let{path:[n,...o]}=t;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);r.enqueue({...t,path:o})}})}},c(da,"PathAppendDecoder"),da),pa,sb=(pa=class extends TransformStream{constructor(e){let t=new Il,r=new Map;super({transform(n,o){n.type==="part-start"&&n.path.length===0&&r.set(t.up(),e.up());let[f,...m]=n.path;if(f===void 0){o.enqueue(n);return}let l=r.get(f);if(l===void 0)throw new Error("Path not found");o.enqueue({...n,path:[l,...m]})}})}},c(pa,"PathMergeEncoder"),pa);var ma,ab=(ma=class extends TransformStream{constructor(e,t,r){let[n,o]=xo(),f;super({start(m){return f=n.pipeTo(new WritableStream({write(l){m.enqueue(l)},abort(l){m.error(l)},close(){m.terminate()}})).catch(l=>{m.error(l)}),e.start?.(o)},transform(m){return e.transform?.(m,o)},async flush(){await e.flush?.(o),o.close(),await f}},t,r)}},c(ma,"AssistantTransformStream"),ma);var ga,Bl=(ga=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},c(ga,"PipeableTransformStream"),ga);var It=(i=>(i.TextDelta="0",i.Data="2",i.Error="3",i.Annotation="8",i.ToolCall="9",i.ToolCallResult="a",i.StartToolCall="b",i.ToolCallArgsTextDelta="c",i.FinishMessage="d",i.FinishStep="e",i.StartStep="f",i.ReasoningDelta="g",i.Source="h",i.RedactedReasoning="i",i.ReasoningSignature="j",i.File="k",i.AuiUpdateStateOperations="aui-state",i.AuiTextDelta="aui-text-delta",i.AuiReasoningDelta="aui-reasoning-delta",i))(It||{});var ya,ob=(ya=class extends TransformStream{constructor(){super({transform:c((e,t)=>{t.enqueue(`${e.type}:${JSON.stringify(e.value)}
10
+ `)},"transform")})}},c(ya,"DataStreamChunkEncoder"),ya),wa,IS=(wa=class extends TransformStream{constructor(){super({transform:c((e,t)=>{let r=e.indexOf(":");if(r===-1)throw new Error("Invalid stream part");t.enqueue({type:e.slice(0,r),value:JSON.parse(e.slice(r+1))})},"transform")})}},c(wa,"DataStreamChunkDecoder"),wa);var ba,lb=(ba=class extends TransformStream{constructor(){let e=[];super({transform(t,r){if(t.type==="part-start"){if(t.path.length!==0){r.error(new Error("Nested parts are not supported"));return}e.push(t.part),r.enqueue(t);return}if(t.type==="text-delta"||t.type==="result"||t.type==="part-finish"||t.type==="tool-call-args-text-finish"){if(t.path.length!==1){r.error(new Error(`${t.type} chunks must have a path of length 1`));return}let n=t.path[0];if(n<0||n>=e.length){r.error(new Error(`Invalid path index: ${n}`));return}let o=e[n];r.enqueue({...t,meta:o});return}r.enqueue(t)}})}},c(ba,"AssistantMetaTransformStream"),ba);var _a,Nd=(_a=class extends Bl{constructor(){super(t=>{let r=new TransformStream({transform(n,o){let f=n.type;switch(f){case"part-start":{let m=n.part;if(m.type==="tool-call"){let{type:l,...a}=m;o.enqueue({type:It.StartToolCall,value:a})}if(m.type==="source"){let{type:l,...a}=m;o.enqueue({type:It.Source,value:a})}break}case"text-delta":{let m=n.meta;switch(m.type){case"text":{m.parentId?o.enqueue({type:It.AuiTextDelta,value:{textDelta:n.textDelta,parentId:m.parentId}}):o.enqueue({type:It.TextDelta,value:n.textDelta});break}case"reasoning":{m.parentId?o.enqueue({type:It.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:m.parentId}}):o.enqueue({type:It.ReasoningDelta,value:n.textDelta});break}case"tool-call":{o.enqueue({type:It.ToolCallArgsTextDelta,value:{toolCallId:m.toolCallId,argsTextDelta:n.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${m.type}`)}break}case"result":{let m=n.meta;if(m.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${m.type}`);o.enqueue({type:It.ToolCallResult,value:{toolCallId:m.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:m,...l}=n;o.enqueue({type:It.StartStep,value:l});break}case"step-finish":{let{type:m,...l}=n;o.enqueue({type:It.FinishStep,value:l});break}case"message-finish":{let{type:m,...l}=n;o.enqueue({type:It.FinishMessage,value:l});break}case"error":{o.enqueue({type:It.Error,value:n.error});break}case"annotations":{o.enqueue({type:It.Annotation,value:n.annotations});break}case"data":{o.enqueue({type:It.Data,value:n.data});break}case"update-state":{o.enqueue({type:It.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let m=f;throw new Error(`Unsupported chunk type: ${m}`)}}}});return t.pipeThrough(new lb).pipeThrough(r).pipeThrough(new ob).pipeThrough(new TextEncoderStream)});pt(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},c(_a,"DataStreamEncoder"),_a),mD=[It.StartToolCall,It.ToolCall,It.TextDelta,It.ReasoningDelta,It.Source,It.Error,It.FinishStep,It.FinishMessage,It.AuiTextDelta,It.AuiReasoningDelta];var cb=Nl("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Qn,BS=(Qn=class{constructor(e){pt(this,"_state");pt(this,"_parentId");this._state=e||{merger:eb(),contentCounter:new Il}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new nb(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new sb(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=Dd();return this._addPart({type:"text"},e),t}addReasoningPart(){let[e,t]=Dd();return this._addPart({type:"reasoning"},e),t}addToolCallPart(e){let t=typeof e=="string"?{toolName:e}:e,r=t.toolName,n=t.toolCallId??cb(),[o,f]=ib();return this._addPart({type:"tool-call",toolName:r,toolCallId:n,...this._parentId&&{parentId:this._parentId}},o),t.argsText!==void 0&&(f.argsText.append(t.argsText),f.argsText.close()),t.args!==void 0&&(f.argsText.append(JSON.stringify(t.args)),f.argsText.close()),t.response!==void 0&&f.setResponse(t.response),f}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let t=new Qn(this._state);return t._parentId=e,t}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},c(Qn,"_AssistantStreamControllerImpl"),Qn);function fb(i){let e=new BS;return c(async()=>{try{await i(e)}catch(r){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(r)}),r}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}c(fb,"createAssistantStream");function xo(){let{resolve:i,promise:e}=Cl(),t;return[fb(n=>(t=n,t.__internal_subscribeToClose(i),e)),t]}c(xo,"createAssistantStreamController");var va,Cd=(va=class extends Bl{constructor(){super(e=>{let t=new ab({transform(r,n){n.appendText(r)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},c(va,"PlainTextDecoder"),va);var ef=Li(Ia(),1),N_=Li(qp(),1),tf=Li(Ia(),1),I_=Li(qp(),1),rf=Li(Ia(),1),nf=Li(Ia(),1),sf=Li(Ia(),1);import*as Vp from"path";import*as x_ from"path";import*as Wc from"path";import*as j_ from"path";import*as Kp from"path";var mk=Object.create,Vc=Object.defineProperty,gk=Object.getOwnPropertyDescriptor,yk=Object.getOwnPropertyNames,wk=Object.getPrototypeOf,bk=Object.prototype.hasOwnProperty,_k=c((i,e,t)=>e in i?Vc(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,"Fv"),h=c((i,e)=>Vc(i,"name",{value:e,configurable:!0}),"o"),Nt=(i=>typeof rr<"u"?rr:typeof Proxy<"u"?new Proxy(i,{get:c((e,t)=>(typeof rr<"u"?rr:e)[t],"get")}):i)(function(i){if(typeof rr<"u")return rr.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')}),De=c((i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),"O"),vk=c((i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yk(e))!bk.call(i,n)&&n!==t&&Vc(i,n,{get:c(()=>e[n],"get"),enumerable:!(r=gk(e,n))||r.enumerable});return i},"Sv"),Ht=c((i,e,t)=>(t=i!=null?mk(wk(i)):{},vk(e||!i||!i.__esModule?Vc(t,"default",{value:i,enumerable:!0}):t,i)),"le"),mt=c((i,e,t)=>_k(i,typeof e!="symbol"?e+"":e,t),"$"),Sk=De((i,e)=>{"use strict";var t=h(function(r){if(r=r||{},this.Promise=r.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=r.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=r.timeout||t.DEFAULT_TIMEOUT,this.maxOccupationTime=r.maxOccupationTime||t.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=r.maxExecutionTime||t.DEFAULT_MAX_EXECUTION_TIME,r.maxPending===1/0||Number.isInteger(r.maxPending)&&r.maxPending>=0?this.maxPending=r.maxPending:this.maxPending=t.DEFAULT_MAX_PENDING},"AsyncLock");t.DEFAULT_TIMEOUT=0,t.DEFAULT_MAX_OCCUPATION_TIME=0,t.DEFAULT_MAX_EXECUTION_TIME=0,t.DEFAULT_MAX_PENDING=1e3,t.prototype.acquire=function(r,n,o,f){if(Array.isArray(r))return this._acquireBatch(r,n,o,f);if(typeof n!="function")throw new Error("You must pass a function to execute");var m=null,l=null,a=null;typeof o!="function"&&(f=o,o=null,a=new this.Promise(function(U,J){m=U,l=J})),f=f||{};var g=!1,y=null,b=null,S=null,F=this,T=h(function(U,J,ne){b&&(clearTimeout(b),b=null),S&&(clearTimeout(S),S=null),U&&(F.queues[r]&&F.queues[r].length===0&&delete F.queues[r],F.domainReentrant&&delete F.domains[r]),g||(a?J?l(J):m(ne):typeof o=="function"&&o(J,ne),g=!0),U&&F.queues[r]&&F.queues[r].length>0&&F.queues[r].shift()()},"done"),P=h(function(U){if(g)return T(U);y&&(clearTimeout(y),y=null),F.domainReentrant&&U&&(F.domains[r]=process.domain);var J=f.maxExecutionTime||F.maxExecutionTime;if(J&&(S=setTimeout(function(){F.queues[r]&&T(U,new Error("Maximum execution time is exceeded "+r))},J)),n.length===1){var ne=!1;try{n(function(oe,z){ne||(ne=!0,T(U,oe,z))})}catch(oe){ne||(ne=!0,T(U,oe))}}else F._promiseTry(function(){return n()}).then(function(oe){T(U,void 0,oe)},function(oe){T(U,oe)})},"exec");F.domainReentrant&&process.domain&&(P=process.domain.bind(P));var $=f.maxPending||F.maxPending;if(!F.queues[r])F.queues[r]=[],P(!0);else if(F.domainReentrant&&process.domain&&process.domain===F.domains[r])P(!1);else if(F.queues[r].length>=$)T(!1,new Error("Too many pending tasks in queue "+r));else{var R=h(function(){P(!0)},"taskFn");f.skipQueue?F.queues[r].unshift(R):F.queues[r].push(R);var M=f.timeout||F.timeout;M&&(y=setTimeout(function(){y=null,T(!1,new Error("async-lock timed out in queue "+r))},M))}var C=f.maxOccupationTime||F.maxOccupationTime;if(C&&(b=setTimeout(function(){F.queues[r]&&T(!1,new Error("Maximum occupation time is exceeded in queue "+r))},C)),a)return a},t.prototype._acquireBatch=function(r,n,o,f){typeof o!="function"&&(f=o,o=null);var m=this,l=h(function(g,y){return function(b){m.acquire(g,y,b,f)}},"getFn"),a=r.reduceRight(function(g,y){return l(y,g)},n);if(typeof o=="function")a(o);else return new this.Promise(function(g,y){a.length===1?a(function(b,S){b?y(b):g(S)}):g(a())})},t.prototype.isBusy=function(r){return r?!!this.queues[r]:Object.keys(this.queues).length>0},t.prototype._promiseTry=function(r){try{return this.Promise.resolve(r())}catch(n){return this.Promise.reject(n)}},e.exports=t}),Ek=De((i,e)=>{"use strict";e.exports=Sk()}),Fk=De((i,e)=>{typeof Object.create=="function"?e.exports=h(function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):e.exports=h(function(t,r){if(r){t.super_=r;var n=h(function(){},"TempCtor");n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},"inherits")}),kk=De((i,e)=>{try{if(t=Nt("util"),typeof t.inherits!="function")throw"";e.exports=t.inherits}catch{e.exports=Fk()}var t}),Kc=De((i,e)=>{var t=Nt("buffer"),r=t.Buffer;function n(f,m){for(var l in f)m[l]=f[l]}c(n,"Xu"),h(n,"copyProps"),r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=t:(n(t,i),i.Buffer=o);function o(f,m,l){return r(f,m,l)}c(o,"hr"),h(o,"SafeBuffer"),o.prototype=Object.create(r.prototype),n(r,o),o.from=function(f,m,l){if(typeof f=="number")throw new TypeError("Argument must not be a number");return r(f,m,l)},o.alloc=function(f,m,l){if(typeof f!="number")throw new TypeError("Argument must be a number");var a=r(f);return m!==void 0?typeof l=="string"?a.fill(m,l):a.fill(m):a.fill(0),a},o.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return r(f)},o.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(f)}}),Rk=De((i,e)=>{var t={}.toString;e.exports=Array.isArray||function(r){return t.call(r)=="[object Array]"}}),Ho=De((i,e)=>{"use strict";e.exports=TypeError}),s_=De((i,e)=>{"use strict";e.exports=Object}),Tk=De((i,e)=>{"use strict";e.exports=Error}),Ok=De((i,e)=>{"use strict";e.exports=EvalError}),xk=De((i,e)=>{"use strict";e.exports=RangeError}),Ak=De((i,e)=>{"use strict";e.exports=ReferenceError}),a_=De((i,e)=>{"use strict";e.exports=SyntaxError}),Pk=De((i,e)=>{"use strict";e.exports=URIError}),Dk=De((i,e)=>{"use strict";e.exports=Math.abs}),Nk=De((i,e)=>{"use strict";e.exports=Math.floor}),Ck=De((i,e)=>{"use strict";e.exports=Math.max}),Ik=De((i,e)=>{"use strict";e.exports=Math.min}),Bk=De((i,e)=>{"use strict";e.exports=Math.pow}),jk=De((i,e)=>{"use strict";e.exports=Math.round}),Mk=De((i,e)=>{"use strict";e.exports=Number.isNaN||h(function(t){return t!==t},"isNaN")}),$k=De((i,e)=>{"use strict";var t=Mk();e.exports=h(function(r){return t(r)||r===0?r:r<0?-1:1},"sign")}),Lk=De((i,e)=>{"use strict";e.exports=Object.getOwnPropertyDescriptor}),Go=De((i,e)=>{"use strict";var t=Lk();if(t)try{t([],"length")}catch{t=null}e.exports=t}),Jc=De((i,e)=>{"use strict";var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}e.exports=t}),o_=De((i,e)=>{"use strict";e.exports=h(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;t[r]=o;for(var f in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var m=Object.getOwnPropertySymbols(t);if(m.length!==1||m[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(t,r);if(l.value!==o||l.enumerable!==!0)return!1}return!0},"hasSymbols")}),Uk=De((i,e)=>{"use strict";var t=typeof Symbol<"u"&&Symbol,r=o_();e.exports=h(function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:r()},"hasNativeSymbols")}),l_=De((i,e)=>{"use strict";e.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),c_=De((i,e)=>{"use strict";var t=s_();e.exports=t.getPrototypeOf||null}),Wk=De((i,e)=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Object.prototype.toString,n=Math.max,o="[object Function]",f=h(function(a,g){for(var y=[],b=0;b<a.length;b+=1)y[b]=a[b];for(var S=0;S<g.length;S+=1)y[S+a.length]=g[S];return y},"concatty"),m=h(function(a,g){for(var y=[],b=g||0,S=0;b<a.length;b+=1,S+=1)y[S]=a[b];return y},"slicy"),l=h(function(a,g){for(var y="",b=0;b<a.length;b+=1)y+=a[b],b+1<a.length&&(y+=g);return y},"joiny");e.exports=h(function(a){var g=this;if(typeof g!="function"||r.apply(g)!==o)throw new TypeError(t+g);for(var y=m(arguments,1),b,S=h(function(){if(this instanceof b){var R=g.apply(this,f(y,arguments));return Object(R)===R?R:this}return g.apply(a,f(y,arguments))},"binder"),F=n(0,g.length-y.length),T=[],P=0;P<F;P++)T[P]="$"+P;if(b=Function("binder","return function ("+l(T,",")+"){ return binder.apply(this,arguments); }")(S),g.prototype){var $=h(function(){},"Empty");$.prototype=g.prototype,b.prototype=new $,$.prototype=null}return b},"bind")}),Vo=De((i,e)=>{"use strict";var t=Wk();e.exports=Function.prototype.bind||t}),rm=De((i,e)=>{"use strict";e.exports=Function.prototype.call}),im=De((i,e)=>{"use strict";e.exports=Function.prototype.apply}),qk=De((i,e)=>{"use strict";e.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),f_=De((i,e)=>{"use strict";var t=Vo(),r=im(),n=rm(),o=qk();e.exports=o||t.call(n,r)}),nm=De((i,e)=>{"use strict";var t=Vo(),r=Ho(),n=rm(),o=f_();e.exports=h(function(f){if(f.length<1||typeof f[0]!="function")throw new r("a function is required");return o(t,n,f)},"callBindBasic")}),zk=De((i,e)=>{"use strict";var t=nm(),r=Go(),n;try{n=[].__proto__===Array.prototype}catch(l){if(!l||typeof l!="object"||!("code"in l)||l.code!=="ERR_PROTO_ACCESS")throw l}var o=!!n&&r&&r(Object.prototype,"__proto__"),f=Object,m=f.getPrototypeOf;e.exports=o&&typeof o.get=="function"?t([o.get]):typeof m=="function"?h(function(l){return m(l==null?l:f(l))},"getDunder"):!1}),h_=De((i,e)=>{"use strict";var t=l_(),r=c_(),n=zk();e.exports=t?h(function(o){return t(o)},"getProto"):r?h(function(o){if(!o||typeof o!="object"&&typeof o!="function")throw new TypeError("getProto: not an object");return r(o)},"getProto"):n?h(function(o){return n(o)},"getProto"):null}),Hk=De((i,e)=>{"use strict";var t=Function.prototype.call,r=Object.prototype.hasOwnProperty,n=Vo();e.exports=n.call(t,r)}),u_=De((i,e)=>{"use strict";var t,r=s_(),n=Tk(),o=Ok(),f=xk(),m=Ak(),l=a_(),a=Ho(),g=Pk(),y=Dk(),b=Nk(),S=Ck(),F=Ik(),T=Bk(),P=jk(),$=$k(),R=Function,M=h(function(Ke){try{return R('"use strict"; return ('+Ke+").constructor;")()}catch{}},"getEvalledConstructor"),C=Go(),U=Jc(),J=h(function(){throw new a},"throwTypeError"),ne=C?function(){try{return arguments.callee,J}catch{try{return C(arguments,"callee").get}catch{return J}}}():J,oe=Uk()(),z=h_(),ee=c_(),H=l_(),j=im(),V=rm(),X={},pe=typeof Uint8Array>"u"||!z?t:z(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":oe&&z?z([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":X,"%AsyncGenerator%":X,"%AsyncGeneratorFunction%":X,"%AsyncIteratorPrototype%":X,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":R,"%GeneratorFunction%":X,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":oe&&z?z(z([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!oe||!z?t:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":C,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":f,"%ReferenceError%":m,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!oe||!z?t:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":oe&&z?z(""[Symbol.iterator]()):t,"%Symbol%":oe?Symbol:t,"%SyntaxError%":l,"%ThrowTypeError%":ne,"%TypedArray%":pe,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":g,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":V,"%Function.prototype.apply%":j,"%Object.defineProperty%":U,"%Object.getPrototypeOf%":ee,"%Math.abs%":y,"%Math.floor%":b,"%Math.max%":S,"%Math.min%":F,"%Math.pow%":T,"%Math.round%":P,"%Math.sign%":$,"%Reflect.getPrototypeOf%":H};if(z)try{null.error}catch(Ke){he=z(z(Ke)),we["%Error.prototype%"]=he}var he,Ae=h(c(function Ke(ve){var ye;if(ve==="%AsyncFunction%")ye=M("async function () {}");else if(ve==="%GeneratorFunction%")ye=M("function* () {}");else if(ve==="%AsyncGeneratorFunction%")ye=M("async function* () {}");else if(ve==="%AsyncGenerator%"){var Fe=Ke("%AsyncGeneratorFunction%");Fe&&(ye=Fe.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var G=Ke("%AsyncGenerator%");G&&z&&(ye=z(G.prototype))}return we[ve]=ye,ye},"e"),"doEval"),lt={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},le=Vo(),$e=Hk(),K=le.call(V,Array.prototype.concat),Oe=le.call(j,Array.prototype.splice),je=le.call(V,String.prototype.replace),Te=le.call(V,String.prototype.slice),Ge=le.call(V,RegExp.prototype.exec),me=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Je=/\\(\\)?/g,He=h(function(Ke){var ve=Te(Ke,0,1),ye=Te(Ke,-1);if(ve==="%"&&ye!=="%")throw new l("invalid intrinsic syntax, expected closing `%`");if(ye==="%"&&ve!=="%")throw new l("invalid intrinsic syntax, expected opening `%`");var Fe=[];return je(Ke,me,function(G,te,se,ke){Fe[Fe.length]=se?je(ke,Je,"$1"):te||G}),Fe},"stringToPath"),it=h(function(Ke,ve){var ye=Ke,Fe;if($e(lt,ye)&&(Fe=lt[ye],ye="%"+Fe[0]+"%"),$e(we,ye)){var G=we[ye];if(G===X&&(G=Ae(ye)),typeof G>"u"&&!ve)throw new a("intrinsic "+Ke+" exists, but is not available. Please file an issue!");return{alias:Fe,name:ye,value:G}}throw new l("intrinsic "+Ke+" does not exist!")},"getBaseIntrinsic");e.exports=h(function(Ke,ve){if(typeof Ke!="string"||Ke.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ve!="boolean")throw new a('"allowMissing" argument must be a boolean');if(Ge(/^%?[^%]*%?$/,Ke)===null)throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ye=He(Ke),Fe=ye.length>0?ye[0]:"",G=it("%"+Fe+"%",ve),te=G.name,se=G.value,ke=!1,_e=G.alias;_e&&(Fe=_e[0],Oe(ye,K([0,1],_e)));for(var Pe=1,Q=!0;Pe<ye.length;Pe+=1){var ge=ye[Pe],Ie=Te(ge,0,1),xe=Te(ge,-1);if((Ie==='"'||Ie==="'"||Ie==="`"||xe==='"'||xe==="'"||xe==="`")&&Ie!==xe)throw new l("property names with quotes must have matching quotes");if((ge==="constructor"||!Q)&&(ke=!0),Fe+="."+ge,te="%"+Fe+"%",$e(we,te))se=we[te];else if(se!=null){if(!(ge in se)){if(!ve)throw new a("base intrinsic for "+Ke+" exists, but the property is not available.");return}if(C&&Pe+1>=ye.length){var Ye=C(se,ge);Q=!!Ye,Q&&"get"in Ye&&!("originalValue"in Ye.get)?se=Ye.get:se=se[ge]}else Q=$e(se,ge),se=se[ge];Q&&!ke&&(we[te]=se)}}return se},"GetIntrinsic")}),d_=De((i,e)=>{"use strict";var t=u_(),r=nm(),n=r([t("%String.prototype.indexOf%")]);e.exports=h(function(o,f){var m=t(o,!!f);return typeof m=="function"&&n(o,".prototype.")>-1?r([m]):m},"callBoundIntrinsic")}),Gk=De((i,e)=>{"use strict";var t=Function.prototype.toString,r=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,o;if(typeof r=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:h(function(){throw o},"get")}),o={},r(function(){throw 42},null,n)}catch(C){C!==o&&(r=null)}else r=null;var f=/^\s*class\b/,m=h(function(C){try{var U=t.call(C);return f.test(U)}catch{return!1}},"isES6ClassFunction"),l=h(function(C){try{return m(C)?!1:(t.call(C),!0)}catch{return!1}},"tryFunctionToStr"),a=Object.prototype.toString,g="[object Object]",y="[object Function]",b="[object GeneratorFunction]",S="[object HTMLAllCollection]",F="[object HTML document.all class]",T="[object HTMLCollection]",P=typeof Symbol=="function"&&!!Symbol.toStringTag,$=!(0 in[,]),R=h(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(M=document.all,a.call(M)===a.call(document.all)&&(R=h(function(C){if(($||!C)&&(typeof C>"u"||typeof C=="object"))try{var U=a.call(C);return(U===S||U===F||U===T||U===g)&&C("")==null}catch{}return!1},"isDocumentDotAll")));var M;e.exports=h(r?function(C){if(R(C))return!0;if(!C||typeof C!="function"&&typeof C!="object")return!1;try{r(C,null,n)}catch(U){if(U!==o)return!1}return!m(C)&&l(C)}:function(C){if(R(C))return!0;if(!C||typeof C!="function"&&typeof C!="object")return!1;if(P)return l(C);if(m(C))return!1;var U=a.call(C);return U!==y&&U!==b&&!/^\[object HTML/.test(U)?!1:l(C)},"isCallable")}),Vk=De((i,e)=>{"use strict";var t=Gk(),r=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=h(function(a,g,y){for(var b=0,S=a.length;b<S;b++)n.call(a,b)&&(y==null?g(a[b],b,a):g.call(y,a[b],b,a))},"forEachArray"),f=h(function(a,g,y){for(var b=0,S=a.length;b<S;b++)y==null?g(a.charAt(b),b,a):g.call(y,a.charAt(b),b,a)},"forEachString"),m=h(function(a,g,y){for(var b in a)n.call(a,b)&&(y==null?g(a[b],b,a):g.call(y,a[b],b,a))},"forEachObject");function l(a){return r.call(a)==="[object Array]"}c(l,"qF"),h(l,"isArray"),e.exports=h(function(a,g,y){if(!t(g))throw new TypeError("iterator must be a function");var b;arguments.length>=3&&(b=y),l(a)?o(a,g,b):typeof a=="string"?f(a,g,b):m(a,g,b)},"forEach")}),Kk=De((i,e)=>{"use strict";e.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),Jk=De((i,e)=>{"use strict";var t=Kk(),r=globalThis;e.exports=h(function(){for(var n=[],o=0;o<t.length;o++)typeof r[t[o]]=="function"&&(n[n.length]=t[o]);return n},"availableTypedArrays")}),Yk=De((i,e)=>{"use strict";var t=Jc(),r=a_(),n=Ho(),o=Go();e.exports=h(function(f,m,l){if(!f||typeof f!="object"&&typeof f!="function")throw new n("`obj` must be an object or a function`");if(typeof m!="string"&&typeof m!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,g=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,b=arguments.length>6?arguments[6]:!1,S=!!o&&o(f,m);if(t)t(f,m,{configurable:y===null&&S?S.configurable:!y,enumerable:a===null&&S?S.enumerable:!a,value:l,writable:g===null&&S?S.writable:!g});else if(b||!a&&!g&&!y)f[m]=l;else throw new r("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")}),Xk=De((i,e)=>{"use strict";var t=Jc(),r=h(function(){return!!t},"hasPropertyDescriptors");r.hasArrayLengthDefineBug=h(function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug"),e.exports=r}),Qk=De((i,e)=>{"use strict";var t=u_(),r=Yk(),n=Xk()(),o=Go(),f=Ho(),m=t("%Math.floor%");e.exports=h(function(l,a){if(typeof l!="function")throw new f("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||m(a)!==a)throw new f("`length` must be a positive 32-bit integer");var g=arguments.length>2&&!!arguments[2],y=!0,b=!0;if("length"in l&&o){var S=o(l,"length");S&&!S.configurable&&(y=!1),S&&!S.writable&&(b=!1)}return(y||b||!g)&&(n?r(l,"length",a,!0,!0):r(l,"length",a)),l},"setFunctionLength")}),Zk=De((i,e)=>{"use strict";var t=Vo(),r=im(),n=f_();e.exports=h(function(){return n(t,r,arguments)},"applyBind")}),eR=De((i,e)=>{"use strict";var t=Qk(),r=Jc(),n=nm(),o=Zk();e.exports=h(function(f){var m=n(arguments),l=f.length-(arguments.length-1);return t(m,1+(l>0?l:0),!0)},"callBind"),r?r(e.exports,"apply",{value:o}):e.exports.apply=o}),tR=De((i,e)=>{"use strict";var t=o_();e.exports=h(function(){return t()&&!!Symbol.toStringTag},"hasToStringTagShams")}),rR=De((i,e)=>{"use strict";var t=Vk(),r=Jk(),n=eR(),o=d_(),f=Go(),m=h_(),l=o("Object.prototype.toString"),a=tR()(),g=globalThis,y=r(),b=o("String.prototype.slice"),S=o("Array.prototype.indexOf",!0)||h(function($,R){for(var M=0;M<$.length;M+=1)if($[M]===R)return M;return-1},"indexOf"),F={__proto__:null};a&&f&&m?t(y,function($){var R=new g[$];if(Symbol.toStringTag in R&&m){var M=m(R),C=f(M,Symbol.toStringTag);if(!C&&M){var U=m(M);C=f(U,Symbol.toStringTag)}F["$"+$]=n(C.get)}}):t(y,function($){var R=new g[$],M=R.slice||R.set;M&&(F["$"+$]=n(M))});var T=h(function($){var R=!1;return t(F,function(M,C){if(!R)try{"$"+M($)===C&&(R=b(C,1))}catch{}}),R},"tryAllTypedArrays"),P=h(function($){var R=!1;return t(F,function(M,C){if(!R)try{M($),R=b(C,1)}catch{}}),R},"tryAllSlices");e.exports=h(function($){if(!$||typeof $!="object")return!1;if(!a){var R=b(l($),8,-1);return S(y,R)>-1?R:R!=="Object"?!1:P($)}return f?T($):null},"whichTypedArray")}),iR=De((i,e)=>{"use strict";var t=rR();e.exports=h(function(r){return!!t(r)},"isTypedArray")}),nR=De((i,e)=>{"use strict";var t=Ho(),r=d_(),n=r("TypedArray.prototype.buffer",!0),o=iR();e.exports=n||h(function(f){if(!o(f))throw new t("Not a Typed Array");return f.buffer},"typedArrayBuffer")}),sR=De((i,e)=>{"use strict";var t=Kc().Buffer,r=Rk(),n=nR(),o=ArrayBuffer.isView||h(function(a){try{return n(a),!0}catch{return!1}},"isView"),f=typeof Uint8Array<"u",m=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",l=m&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);e.exports=h(function(a,g){if(t.isBuffer(a))return a.constructor&&!("isBuffer"in a)?t.from(a):a;if(typeof a=="string")return t.from(a,g);if(m&&o(a)){if(a.byteLength===0)return t.alloc(0);if(l){var y=t.from(a.buffer,a.byteOffset,a.byteLength);if(y.byteLength===a.byteLength)return y}var b=a instanceof Uint8Array?a:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),S=t.from(b);if(S.length===a.byteLength)return S}if(f&&a instanceof Uint8Array)return t.from(a);var F=r(a);if(F)for(var T=0;T<a.length;T+=1){var P=a[T];if(typeof P!="number"||P<0||P>255||~~P!==P)throw new RangeError("Array items must be numbers in the range 0-255.")}if(F||t.isBuffer(a)&&a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a))return t.from(a);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")}),aR=De((i,e)=>{"use strict";var t=Kc().Buffer,r=sR();function n(o,f){this._block=t.alloc(o),this._finalSize=f,this._blockSize=o,this._len=0}c(n,"Oa"),h(n,"Hash"),n.prototype.update=function(o,f){o=r(o,f||"utf8");for(var m=this._block,l=this._blockSize,a=o.length,g=this._len,y=0;y<a;){for(var b=g%l,S=Math.min(a-y,l-b),F=0;F<S;F++)m[b+F]=o[y+F];g+=S,y+=S,g%l===0&&this._update(m)}return this._len+=a,this},n.prototype.digest=function(o){var f=this._len%this._blockSize;this._block[f]=128,this._block.fill(0,f+1),f>=this._finalSize&&(this._update(this._block),this._block.fill(0));var m=this._len*8;if(m<=4294967295)this._block.writeUInt32BE(m,this._blockSize-4);else{var l=(m&4294967295)>>>0,a=(m-l)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(l,this._blockSize-4)}this._update(this._block);var g=this._hash();return o?g.toString(o):g},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=n}),oR=De((i,e)=>{"use strict";var t=kk(),r=aR(),n=Kc().Buffer,o=[1518500249,1859775393,-1894007588,-899497514],f=new Array(80);function m(){this.init(),this._w=f,r.call(this,64,56)}c(m,"Qi"),h(m,"Sha1"),t(m,r),m.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function l(b){return b<<1|b>>>31}c(l,"vS"),h(l,"rotl1");function a(b){return b<<5|b>>>27}c(a,"FS"),h(a,"rotl5");function g(b){return b<<30|b>>>2}c(g,"SS"),h(g,"rotl30");function y(b,S,F,T){return b===0?S&F|~S&T:b===2?S&F|S&T|F&T:S^F^T}c(y,"ES"),h(y,"ft"),m.prototype._update=function(b){for(var S=this._w,F=this._a|0,T=this._b|0,P=this._c|0,$=this._d|0,R=this._e|0,M=0;M<16;++M)S[M]=b.readInt32BE(M*4);for(;M<80;++M)S[M]=l(S[M-3]^S[M-8]^S[M-14]^S[M-16]);for(var C=0;C<80;++C){var U=~~(C/20),J=a(F)+y(U,T,P,$)+R+S[C]+o[U]|0;R=$,$=P,P=g(T),T=F,F=J}this._a=F+this._a|0,this._b=T+this._b|0,this._c=P+this._c|0,this._d=$+this._d|0,this._e=R+this._e|0},m.prototype._hash=function(){var b=n.allocUnsafe(20);return b.writeInt32BE(this._a|0,0),b.writeInt32BE(this._b|0,4),b.writeInt32BE(this._c|0,8),b.writeInt32BE(this._d|0,12),b.writeInt32BE(this._e|0,16),b},e.exports=m}),lR=De(i=>{var e;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof i=="object"?t(i):typeof define=="function"&&define.amd?define(function(){var r={};return t(r),r}):t(e={}):t(e={})})(function(t){t.version="1.2.2";function r(){for(var z=0,ee=new Array(256),H=0;H!=256;++H)z=H,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,ee[H]=z;return typeof Int32Array<"u"?new Int32Array(ee):ee}c(r,"t"),h(r,"signed_crc_table");var n=r();function o(z){var ee=0,H=0,j=0,V=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(j=0;j!=256;++j)V[j]=z[j];for(j=0;j!=256;++j)for(H=z[j],ee=256+j;ee<4096;ee+=256)H=V[ee]=H>>>8^z[H&255];var X=[];for(j=1;j!=16;++j)X[j-1]=typeof Int32Array<"u"?V.subarray(j*256,j*256+256):V.slice(j*256,j*256+256);return X}c(o,"i"),h(o,"slice_by_16_tables");var f=o(n),m=f[0],l=f[1],a=f[2],g=f[3],y=f[4],b=f[5],S=f[6],F=f[7],T=f[8],P=f[9],$=f[10],R=f[11],M=f[12],C=f[13],U=f[14];function J(z,ee){for(var H=ee^-1,j=0,V=z.length;j<V;)H=H>>>8^n[(H^z.charCodeAt(j++))&255];return~H}c(J,"F"),h(J,"crc32_bstr");function ne(z,ee){for(var H=ee^-1,j=z.length-15,V=0;V<j;)H=U[z[V++]^H&255]^C[z[V++]^H>>8&255]^M[z[V++]^H>>16&255]^R[z[V++]^H>>>24]^$[z[V++]]^P[z[V++]]^T[z[V++]]^F[z[V++]]^S[z[V++]]^b[z[V++]]^y[z[V++]]^g[z[V++]]^a[z[V++]]^l[z[V++]]^m[z[V++]]^n[z[V++]];for(j+=15;V<j;)H=H>>>8^n[(H^z[V++])&255];return~H}c(ne,"S"),h(ne,"crc32_buf");function oe(z,ee){for(var H=ee^-1,j=0,V=z.length,X=0,pe=0;j<V;)X=z.charCodeAt(j++),X<128?H=H>>>8^n[(H^X)&255]:X<2048?(H=H>>>8^n[(H^(192|X>>6&31))&255],H=H>>>8^n[(H^(128|X&63))&255]):X>=55296&&X<57344?(X=(X&1023)+64,pe=z.charCodeAt(j++)&1023,H=H>>>8^n[(H^(240|X>>8&7))&255],H=H>>>8^n[(H^(128|X>>2&63))&255],H=H>>>8^n[(H^(128|pe>>6&15|(X&3)<<4))&255],H=H>>>8^n[(H^(128|pe&63))&255]):(H=H>>>8^n[(H^(224|X>>12&15))&255],H=H>>>8^n[(H^(128|X>>6&63))&255],H=H>>>8^n[(H^(128|X&63))&255]);return~H}c(oe,"P"),h(oe,"crc32_str"),t.table=n,t.bstr=J,t.buf=ne,t.str=oe})}),Vi=De(i=>{"use strict";var e=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function t(o,f){return Object.prototype.hasOwnProperty.call(o,f)}c(t,"xS"),h(t,"_has"),i.assign=function(o){for(var f=Array.prototype.slice.call(arguments,1);f.length;){var m=f.shift();if(m){if(typeof m!="object")throw new TypeError(m+"must be non-object");for(var l in m)t(m,l)&&(o[l]=m[l])}}return o},i.shrinkBuf=function(o,f){return o.length===f?o:o.subarray?o.subarray(0,f):(o.length=f,o)};var r={arraySet:h(function(o,f,m,l,a){if(f.subarray&&o.subarray){o.set(f.subarray(m,m+l),a);return}for(var g=0;g<l;g++)o[a+g]=f[m+g]},"arraySet"),flattenChunks:h(function(o){var f,m,l,a,g,y;for(l=0,f=0,m=o.length;f<m;f++)l+=o[f].length;for(y=new Uint8Array(l),a=0,f=0,m=o.length;f<m;f++)g=o[f],y.set(g,a),a+=g.length;return y},"flattenChunks")},n={arraySet:h(function(o,f,m,l,a){for(var g=0;g<l;g++)o[a+g]=f[m+g]},"arraySet"),flattenChunks:h(function(o){return[].concat.apply([],o)},"flattenChunks")};i.setTyped=function(o){o?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,r)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,n))},i.setTyped(e)}),cR=De(i=>{"use strict";var e=Vi(),t=4,r=0,n=1,o=2;function f(B){for(var Y=B.length;--Y>=0;)B[Y]=0}c(f,"ei"),h(f,"zero");var m=0,l=1,a=2,g=3,y=258,b=29,S=256,F=S+1+b,T=30,P=19,$=2*F+1,R=15,M=16,C=7,U=256,J=16,ne=17,oe=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ee=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],H=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=512,X=new Array((F+2)*2);f(X);var pe=new Array(T*2);f(pe);var we=new Array(V);f(we);var he=new Array(y-g+1);f(he);var Ae=new Array(b);f(Ae);var lt=new Array(T);f(lt);function le(B,Y,Ne,et,re){this.static_tree=B,this.extra_bits=Y,this.extra_base=Ne,this.elems=et,this.max_length=re,this.has_stree=B&&B.length}c(le,"Pl"),h(le,"StaticTreeDesc");var $e,K,Oe;function je(B,Y){this.dyn_tree=B,this.max_code=0,this.stat_desc=Y}c(je,"Tl"),h(je,"TreeDesc");function Te(B){return B<256?we[B]:we[256+(B>>>7)]}c(Te,"Tp"),h(Te,"d_code");function Ge(B,Y){B.pending_buf[B.pending++]=Y&255,B.pending_buf[B.pending++]=Y>>>8&255}c(Ge,"an"),h(Ge,"put_short");function me(B,Y,Ne){B.bi_valid>M-Ne?(B.bi_buf|=Y<<B.bi_valid&65535,Ge(B,B.bi_buf),B.bi_buf=Y>>M-B.bi_valid,B.bi_valid+=Ne-M):(B.bi_buf|=Y<<B.bi_valid&65535,B.bi_valid+=Ne)}c(me,"Ne"),h(me,"send_bits");function Je(B,Y,Ne){me(B,Ne[Y*2],Ne[Y*2+1])}c(Je,"wt"),h(Je,"send_code");function He(B,Y){var Ne=0;do Ne|=B&1,B>>>=1,Ne<<=1;while(--Y>0);return Ne>>>1}c(He,"Ap"),h(He,"bi_reverse");function it(B){B.bi_valid===16?(Ge(B,B.bi_buf),B.bi_buf=0,B.bi_valid=0):B.bi_valid>=8&&(B.pending_buf[B.pending++]=B.bi_buf&255,B.bi_buf>>=8,B.bi_valid-=8)}c(it,"MS"),h(it,"bi_flush");function Ke(B,Y){var Ne=Y.dyn_tree,et=Y.max_code,re=Y.stat_desc.static_tree,be=Y.stat_desc.has_stree,A=Y.stat_desc.extra_bits,Ce=Y.stat_desc.extra_base,dt=Y.stat_desc.max_length,v,ue,de,N,Z,fe,st=0;for(N=0;N<=R;N++)B.bl_count[N]=0;for(Ne[B.heap[B.heap_max]*2+1]=0,v=B.heap_max+1;v<$;v++)ue=B.heap[v],N=Ne[Ne[ue*2+1]*2+1]+1,N>dt&&(N=dt,st++),Ne[ue*2+1]=N,!(ue>et)&&(B.bl_count[N]++,Z=0,ue>=Ce&&(Z=A[ue-Ce]),fe=Ne[ue*2],B.opt_len+=fe*(N+Z),be&&(B.static_len+=fe*(re[ue*2+1]+Z)));if(st!==0){do{for(N=dt-1;B.bl_count[N]===0;)N--;B.bl_count[N]--,B.bl_count[N+1]+=2,B.bl_count[dt]--,st-=2}while(st>0);for(N=dt;N!==0;N--)for(ue=B.bl_count[N];ue!==0;)de=B.heap[--v],!(de>et)&&(Ne[de*2+1]!==N&&(B.opt_len+=(N-Ne[de*2+1])*Ne[de*2],Ne[de*2+1]=N),ue--)}}c(Ke,"jS"),h(Ke,"gen_bitlen");function ve(B,Y,Ne){var et=new Array(R+1),re=0,be,A;for(be=1;be<=R;be++)et[be]=re=re+Ne[be-1]<<1;for(A=0;A<=Y;A++){var Ce=B[A*2+1];Ce!==0&&(B[A*2]=He(et[Ce]++,Ce))}}c(ve,"Op"),h(ve,"gen_codes");function ye(){var B,Y,Ne,et,re,be=new Array(R+1);for(Ne=0,et=0;et<b-1;et++)for(Ae[et]=Ne,B=0;B<1<<z[et];B++)he[Ne++]=et;for(he[Ne-1]=et,re=0,et=0;et<16;et++)for(lt[et]=re,B=0;B<1<<ee[et];B++)we[re++]=et;for(re>>=7;et<T;et++)for(lt[et]=re<<7,B=0;B<1<<ee[et]-7;B++)we[256+re++]=et;for(Y=0;Y<=R;Y++)be[Y]=0;for(B=0;B<=143;)X[B*2+1]=8,B++,be[8]++;for(;B<=255;)X[B*2+1]=9,B++,be[9]++;for(;B<=279;)X[B*2+1]=7,B++,be[7]++;for(;B<=287;)X[B*2+1]=8,B++,be[8]++;for(ve(X,F+1,be),B=0;B<T;B++)pe[B*2+1]=5,pe[B*2]=He(B,5);$e=new le(X,z,S+1,F,R),K=new le(pe,ee,0,T,R),Oe=new le(new Array(0),H,0,P,C)}c(ye,"HS"),h(ye,"tr_static_init");function Fe(B){var Y;for(Y=0;Y<F;Y++)B.dyn_ltree[Y*2]=0;for(Y=0;Y<T;Y++)B.dyn_dtree[Y*2]=0;for(Y=0;Y<P;Y++)B.bl_tree[Y*2]=0;B.dyn_ltree[U*2]=1,B.opt_len=B.static_len=0,B.last_lit=B.matches=0}c(Fe,"Dp"),h(Fe,"init_block");function G(B){B.bi_valid>8?Ge(B,B.bi_buf):B.bi_valid>0&&(B.pending_buf[B.pending++]=B.bi_buf),B.bi_buf=0,B.bi_valid=0}c(G,"Rp"),h(G,"bi_windup");function te(B,Y,Ne,et){G(B),et&&(Ge(B,Ne),Ge(B,~Ne)),e.arraySet(B.pending_buf,B.window,Y,Ne,B.pending),B.pending+=Ne}c(te,"qS"),h(te,"copy_block");function se(B,Y,Ne,et){var re=Y*2,be=Ne*2;return B[re]<B[be]||B[re]===B[be]&&et[Y]<=et[Ne]}c(se,"pp"),h(se,"smaller");function ke(B,Y,Ne){for(var et=B.heap[Ne],re=Ne<<1;re<=B.heap_len&&(re<B.heap_len&&se(Y,B.heap[re+1],B.heap[re],B.depth)&&re++,!se(Y,et,B.heap[re],B.depth));)B.heap[Ne]=B.heap[re],Ne=re,re<<=1;B.heap[Ne]=et}c(ke,"Al"),h(ke,"pqdownheap");function _e(B,Y,Ne){var et,re,be=0,A,Ce;if(B.last_lit!==0)do et=B.pending_buf[B.d_buf+be*2]<<8|B.pending_buf[B.d_buf+be*2+1],re=B.pending_buf[B.l_buf+be],be++,et===0?Je(B,re,Y):(A=he[re],Je(B,A+S+1,Y),Ce=z[A],Ce!==0&&(re-=Ae[A],me(B,re,Ce)),et--,A=Te(et),Je(B,A,Ne),Ce=ee[A],Ce!==0&&(et-=lt[A],me(B,et,Ce)));while(be<B.last_lit);Je(B,U,Y)}c(_e,"mp"),h(_e,"compress_block");function Pe(B,Y){var Ne=Y.dyn_tree,et=Y.stat_desc.static_tree,re=Y.stat_desc.has_stree,be=Y.stat_desc.elems,A,Ce,dt=-1,v;for(B.heap_len=0,B.heap_max=$,A=0;A<be;A++)Ne[A*2]!==0?(B.heap[++B.heap_len]=dt=A,B.depth[A]=0):Ne[A*2+1]=0;for(;B.heap_len<2;)v=B.heap[++B.heap_len]=dt<2?++dt:0,Ne[v*2]=1,B.depth[v]=0,B.opt_len--,re&&(B.static_len-=et[v*2+1]);for(Y.max_code=dt,A=B.heap_len>>1;A>=1;A--)ke(B,Ne,A);v=be;do A=B.heap[1],B.heap[1]=B.heap[B.heap_len--],ke(B,Ne,1),Ce=B.heap[1],B.heap[--B.heap_max]=A,B.heap[--B.heap_max]=Ce,Ne[v*2]=Ne[A*2]+Ne[Ce*2],B.depth[v]=(B.depth[A]>=B.depth[Ce]?B.depth[A]:B.depth[Ce])+1,Ne[A*2+1]=Ne[Ce*2+1]=v,B.heap[1]=v++,ke(B,Ne,1);while(B.heap_len>=2);B.heap[--B.heap_max]=B.heap[1],Ke(B,Y),ve(Ne,dt,B.bl_count)}c(Pe,"Dl"),h(Pe,"build_tree");function Q(B,Y,Ne){var et,re=-1,be,A=Y[0*2+1],Ce=0,dt=7,v=4;for(A===0&&(dt=138,v=3),Y[(Ne+1)*2+1]=65535,et=0;et<=Ne;et++)be=A,A=Y[(et+1)*2+1],!(++Ce<dt&&be===A)&&(Ce<v?B.bl_tree[be*2]+=Ce:be!==0?(be!==re&&B.bl_tree[be*2]++,B.bl_tree[J*2]++):Ce<=10?B.bl_tree[ne*2]++:B.bl_tree[oe*2]++,Ce=0,re=be,A===0?(dt=138,v=3):be===A?(dt=6,v=3):(dt=7,v=4))}c(Q,"wp"),h(Q,"scan_tree");function ge(B,Y,Ne){var et,re=-1,be,A=Y[0*2+1],Ce=0,dt=7,v=4;for(A===0&&(dt=138,v=3),et=0;et<=Ne;et++)if(be=A,A=Y[(et+1)*2+1],!(++Ce<dt&&be===A)){if(Ce<v)do Je(B,be,B.bl_tree);while(--Ce!==0);else be!==0?(be!==re&&(Je(B,be,B.bl_tree),Ce--),Je(B,J,B.bl_tree),me(B,Ce-3,2)):Ce<=10?(Je(B,ne,B.bl_tree),me(B,Ce-3,3)):(Je(B,oe,B.bl_tree),me(B,Ce-11,7));Ce=0,re=be,A===0?(dt=138,v=3):be===A?(dt=6,v=3):(dt=7,v=4)}}c(ge,"gp"),h(ge,"send_tree");function Ie(B){var Y;for(Q(B,B.dyn_ltree,B.l_desc.max_code),Q(B,B.dyn_dtree,B.d_desc.max_code),Pe(B,B.bl_desc),Y=P-1;Y>=3&&B.bl_tree[j[Y]*2+1]===0;Y--);return B.opt_len+=3*(Y+1)+5+5+4,Y}c(Ie,"US"),h(Ie,"build_bl_tree");function xe(B,Y,Ne,et){var re;for(me(B,Y-257,5),me(B,Ne-1,5),me(B,et-4,4),re=0;re<et;re++)me(B,B.bl_tree[j[re]*2+1],3);ge(B,B.dyn_ltree,Y-1),ge(B,B.dyn_dtree,Ne-1)}c(xe,"zS"),h(xe,"send_all_trees");function Ye(B){var Y=4093624447,Ne;for(Ne=0;Ne<=31;Ne++,Y>>>=1)if(Y&1&&B.dyn_ltree[Ne*2]!==0)return r;if(B.dyn_ltree[9*2]!==0||B.dyn_ltree[10*2]!==0||B.dyn_ltree[13*2]!==0)return n;for(Ne=32;Ne<S;Ne++)if(B.dyn_ltree[Ne*2]!==0)return n;return r}c(Ye,"WS"),h(Ye,"detect_data_type");var kt=!1;function Gt(B){kt||(ye(),kt=!0),B.l_desc=new je(B.dyn_ltree,$e),B.d_desc=new je(B.dyn_dtree,K),B.bl_desc=new je(B.bl_tree,Oe),B.bi_buf=0,B.bi_valid=0,Fe(B)}c(Gt,"VS"),h(Gt,"_tr_init");function gt(B,Y,Ne,et){me(B,(m<<1)+(et?1:0),3),te(B,Y,Ne,!0)}c(gt,"Cp"),h(gt,"_tr_stored_block");function _t(B){me(B,l<<1,3),Je(B,U,X),it(B)}c(_t,"GS"),h(_t,"_tr_align");function St(B,Y,Ne,et){var re,be,A=0;B.level>0?(B.strm.data_type===o&&(B.strm.data_type=Ye(B)),Pe(B,B.l_desc),Pe(B,B.d_desc),A=Ie(B),re=B.opt_len+3+7>>>3,be=B.static_len+3+7>>>3,be<=re&&(re=be)):re=be=Ne+5,Ne+4<=re&&Y!==-1?gt(B,Y,Ne,et):B.strategy===t||be===re?(me(B,(l<<1)+(et?1:0),3),_e(B,X,pe)):(me(B,(a<<1)+(et?1:0),3),xe(B,B.l_desc.max_code+1,B.d_desc.max_code+1,A+1),_e(B,B.dyn_ltree,B.dyn_dtree)),Fe(B),et&&G(B)}c(St,"ZS"),h(St,"_tr_flush_block");function Pt(B,Y,Ne){return B.pending_buf[B.d_buf+B.last_lit*2]=Y>>>8&255,B.pending_buf[B.d_buf+B.last_lit*2+1]=Y&255,B.pending_buf[B.l_buf+B.last_lit]=Ne&255,B.last_lit++,Y===0?B.dyn_ltree[Ne*2]++:(B.matches++,Y--,B.dyn_ltree[(he[Ne]+S+1)*2]++,B.dyn_dtree[Te(Y)*2]++),B.last_lit===B.lit_bufsize-1}c(Pt,"KS"),h(Pt,"_tr_tally"),i._tr_init=Gt,i._tr_stored_block=gt,i._tr_flush_block=St,i._tr_tally=Pt,i._tr_align=_t}),p_=De((i,e)=>{"use strict";function t(r,n,o,f){for(var m=r&65535|0,l=r>>>16&65535|0,a=0;o!==0;){a=o>2e3?2e3:o,o-=a;do m=m+n[f++]|0,l=l+m|0;while(--a);m%=65521,l%=65521}return m|l<<16|0}c(t,"YS"),h(t,"adler32"),e.exports=t}),m_=De((i,e)=>{"use strict";function t(){for(var o,f=[],m=0;m<256;m++){o=m;for(var l=0;l<8;l++)o=o&1?3988292384^o>>>1:o>>>1;f[m]=o}return f}c(t,"XS"),h(t,"makeTable");var r=t();function n(o,f,m,l){var a=r,g=l+m;o^=-1;for(var y=l;y<g;y++)o=o>>>8^a[(o^f[y])&255];return o^-1}c(n,"QS"),h(n,"crc32"),e.exports=n}),sm=De((i,e)=>{"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),fR=De(i=>{"use strict";var e=Vi(),t=cR(),r=p_(),n=m_(),o=sm(),f=0,m=1,l=3,a=4,g=5,y=0,b=1,S=-2,F=-3,T=-5,P=-1,$=1,R=2,M=3,C=4,U=0,J=2,ne=8,oe=9,z=15,ee=8,H=29,j=256,V=j+1+H,X=30,pe=19,we=2*V+1,he=15,Ae=3,lt=258,le=lt+Ae+1,$e=32,K=42,Oe=69,je=73,Te=91,Ge=103,me=113,Je=666,He=1,it=2,Ke=3,ve=4,ye=3;function Fe(v,ue){return v.msg=o[ue],ue}c(Fe,"Vt"),h(Fe,"err");function G(v){return(v<<1)-(v>4?9:0)}c(G,"jp"),h(G,"rank");function te(v){for(var ue=v.length;--ue>=0;)v[ue]=0}c(te,"zt"),h(te,"zero");function se(v){var ue=v.state,de=ue.pending;de>v.avail_out&&(de=v.avail_out),de!==0&&(e.arraySet(v.output,ue.pending_buf,ue.pending_out,de,v.next_out),v.next_out+=de,ue.pending_out+=de,v.total_out+=de,v.avail_out-=de,ue.pending-=de,ue.pending===0&&(ue.pending_out=0))}c(se,"Ut"),h(se,"flush_pending");function ke(v,ue){t._tr_flush_block(v,v.block_start>=0?v.block_start:-1,v.strstart-v.block_start,ue),v.block_start=v.strstart,se(v.strm)}c(ke,"ve"),h(ke,"flush_block_only");function _e(v,ue){v.pending_buf[v.pending++]=ue}c(_e,"Z"),h(_e,"put_byte");function Pe(v,ue){v.pending_buf[v.pending++]=ue>>>8&255,v.pending_buf[v.pending++]=ue&255}c(Pe,"sn"),h(Pe,"putShortMSB");function Q(v,ue,de,N){var Z=v.avail_in;return Z>N&&(Z=N),Z===0?0:(v.avail_in-=Z,e.arraySet(ue,v.input,v.next_in,Z,de),v.state.wrap===1?v.adler=r(v.adler,ue,Z,de):v.state.wrap===2&&(v.adler=n(v.adler,ue,Z,de)),v.next_in+=Z,v.total_in+=Z,Z)}c(Q,"vE"),h(Q,"read_buf");function ge(v,ue){var de=v.max_chain_length,N=v.strstart,Z,fe,st=v.prev_length,Xe=v.nice_match,D=v.strstart>v.w_size-le?v.strstart-(v.w_size-le):0,W=v.window,Me=v.w_mask,Le=v.prev,Ue=v.strstart+lt,ut=W[N+st-1],vt=W[N+st];v.prev_length>=v.good_match&&(de>>=2),Xe>v.lookahead&&(Xe=v.lookahead);do if(Z=ue,!(W[Z+st]!==vt||W[Z+st-1]!==ut||W[Z]!==W[N]||W[++Z]!==W[N+1])){N+=2,Z++;do;while(W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&W[++N]===W[++Z]&&N<Ue);if(fe=lt-(Ue-N),N=Ue-lt,fe>st){if(v.match_start=ue,st=fe,fe>=Xe)break;ut=W[N+st-1],vt=W[N+st]}}while((ue=Le[ue&Me])>D&&--de!==0);return st<=v.lookahead?st:v.lookahead}c(ge,"qp"),h(ge,"longest_match");function Ie(v){var ue=v.w_size,de,N,Z,fe,st;do{if(fe=v.window_size-v.lookahead-v.strstart,v.strstart>=ue+(ue-le)){e.arraySet(v.window,v.window,ue,ue,0),v.match_start-=ue,v.strstart-=ue,v.block_start-=ue,N=v.hash_size,de=N;do Z=v.head[--de],v.head[de]=Z>=ue?Z-ue:0;while(--N);N=ue,de=N;do Z=v.prev[--de],v.prev[de]=Z>=ue?Z-ue:0;while(--N);fe+=ue}if(v.strm.avail_in===0)break;if(N=Q(v.strm,v.window,v.strstart+v.lookahead,fe),v.lookahead+=N,v.lookahead+v.insert>=Ae)for(st=v.strstart-v.insert,v.ins_h=v.window[st],v.ins_h=(v.ins_h<<v.hash_shift^v.window[st+1])&v.hash_mask;v.insert&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[st+Ae-1])&v.hash_mask,v.prev[st&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=st,st++,v.insert--,!(v.lookahead+v.insert<Ae)););}while(v.lookahead<le&&v.strm.avail_in!==0)}c(Ie,"yr"),h(Ie,"fill_window");function xe(v,ue){var de=65535;for(de>v.pending_buf_size-5&&(de=v.pending_buf_size-5);;){if(v.lookahead<=1){if(Ie(v),v.lookahead===0&&ue===f)return He;if(v.lookahead===0)break}v.strstart+=v.lookahead,v.lookahead=0;var N=v.block_start+de;if((v.strstart===0||v.strstart>=N)&&(v.lookahead=v.strstart-N,v.strstart=N,ke(v,!1),v.strm.avail_out===0)||v.strstart-v.block_start>=v.w_size-le&&(ke(v,!1),v.strm.avail_out===0))return He}return v.insert=0,ue===a?(ke(v,!0),v.strm.avail_out===0?Ke:ve):(v.strstart>v.block_start&&(ke(v,!1),v.strm.avail_out),He)}c(xe,"FE"),h(xe,"deflate_stored");function Ye(v,ue){for(var de,N;;){if(v.lookahead<le){if(Ie(v),v.lookahead<le&&ue===f)return He;if(v.lookahead===0)break}if(de=0,v.lookahead>=Ae&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+Ae-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),de!==0&&v.strstart-de<=v.w_size-le&&(v.match_length=ge(v,de)),v.match_length>=Ae)if(N=t._tr_tally(v,v.strstart-v.match_start,v.match_length-Ae),v.lookahead-=v.match_length,v.match_length<=v.max_lazy_match&&v.lookahead>=Ae){v.match_length--;do v.strstart++,v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+Ae-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart;while(--v.match_length!==0);v.strstart++}else v.strstart+=v.match_length,v.match_length=0,v.ins_h=v.window[v.strstart],v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+1])&v.hash_mask;else N=t._tr_tally(v,0,v.window[v.strstart]),v.lookahead--,v.strstart++;if(N&&(ke(v,!1),v.strm.avail_out===0))return He}return v.insert=v.strstart<Ae-1?v.strstart:Ae-1,ue===a?(ke(v,!0),v.strm.avail_out===0?Ke:ve):v.last_lit&&(ke(v,!1),v.strm.avail_out===0)?He:it}c(Ye,"Ml"),h(Ye,"deflate_fast");function kt(v,ue){for(var de,N,Z;;){if(v.lookahead<le){if(Ie(v),v.lookahead<le&&ue===f)return He;if(v.lookahead===0)break}if(de=0,v.lookahead>=Ae&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+Ae-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),v.prev_length=v.match_length,v.prev_match=v.match_start,v.match_length=Ae-1,de!==0&&v.prev_length<v.max_lazy_match&&v.strstart-de<=v.w_size-le&&(v.match_length=ge(v,de),v.match_length<=5&&(v.strategy===$||v.match_length===Ae&&v.strstart-v.match_start>4096)&&(v.match_length=Ae-1)),v.prev_length>=Ae&&v.match_length<=v.prev_length){Z=v.strstart+v.lookahead-Ae,N=t._tr_tally(v,v.strstart-1-v.prev_match,v.prev_length-Ae),v.lookahead-=v.prev_length-1,v.prev_length-=2;do++v.strstart<=Z&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+Ae-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart);while(--v.prev_length!==0);if(v.match_available=0,v.match_length=Ae-1,v.strstart++,N&&(ke(v,!1),v.strm.avail_out===0))return He}else if(v.match_available){if(N=t._tr_tally(v,0,v.window[v.strstart-1]),N&&ke(v,!1),v.strstart++,v.lookahead--,v.strm.avail_out===0)return He}else v.match_available=1,v.strstart++,v.lookahead--}return v.match_available&&(N=t._tr_tally(v,0,v.window[v.strstart-1]),v.match_available=0),v.insert=v.strstart<Ae-1?v.strstart:Ae-1,ue===a?(ke(v,!0),v.strm.avail_out===0?Ke:ve):v.last_lit&&(ke(v,!1),v.strm.avail_out===0)?He:it}c(kt,"ri"),h(kt,"deflate_slow");function Gt(v,ue){for(var de,N,Z,fe,st=v.window;;){if(v.lookahead<=lt){if(Ie(v),v.lookahead<=lt&&ue===f)return He;if(v.lookahead===0)break}if(v.match_length=0,v.lookahead>=Ae&&v.strstart>0&&(Z=v.strstart-1,N=st[Z],N===st[++Z]&&N===st[++Z]&&N===st[++Z])){fe=v.strstart+lt;do;while(N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&N===st[++Z]&&Z<fe);v.match_length=lt-(fe-Z),v.match_length>v.lookahead&&(v.match_length=v.lookahead)}if(v.match_length>=Ae?(de=t._tr_tally(v,1,v.match_length-Ae),v.lookahead-=v.match_length,v.strstart+=v.match_length,v.match_length=0):(de=t._tr_tally(v,0,v.window[v.strstart]),v.lookahead--,v.strstart++),de&&(ke(v,!1),v.strm.avail_out===0))return He}return v.insert=0,ue===a?(ke(v,!0),v.strm.avail_out===0?Ke:ve):v.last_lit&&(ke(v,!1),v.strm.avail_out===0)?He:it}c(Gt,"SE"),h(Gt,"deflate_rle");function gt(v,ue){for(var de;;){if(v.lookahead===0&&(Ie(v),v.lookahead===0)){if(ue===f)return He;break}if(v.match_length=0,de=t._tr_tally(v,0,v.window[v.strstart]),v.lookahead--,v.strstart++,de&&(ke(v,!1),v.strm.avail_out===0))return He}return v.insert=0,ue===a?(ke(v,!0),v.strm.avail_out===0?Ke:ve):v.last_lit&&(ke(v,!1),v.strm.avail_out===0)?He:it}c(gt,"EE"),h(gt,"deflate_huff");function _t(v,ue,de,N,Z){this.good_length=v,this.max_lazy=ue,this.nice_length=de,this.max_chain=N,this.func=Z}c(_t,"gt"),h(_t,"Config");var St;St=[new _t(0,0,0,0,xe),new _t(4,4,8,4,Ye),new _t(4,5,16,8,Ye),new _t(4,6,32,32,Ye),new _t(4,4,16,16,kt),new _t(8,16,32,32,kt),new _t(8,16,128,128,kt),new _t(8,32,128,256,kt),new _t(32,128,258,1024,kt),new _t(32,258,258,4096,kt)];function Pt(v){v.window_size=2*v.w_size,te(v.head),v.max_lazy_match=St[v.level].max_lazy,v.good_match=St[v.level].good_length,v.nice_match=St[v.level].nice_length,v.max_chain_length=St[v.level].max_chain,v.strstart=0,v.block_start=0,v.lookahead=0,v.insert=0,v.match_length=v.prev_length=Ae-1,v.match_available=0,v.ins_h=0}c(Pt,"kE"),h(Pt,"lm_init");function B(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ne,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new e.Buf16(we*2),this.dyn_dtree=new e.Buf16((2*X+1)*2),this.bl_tree=new e.Buf16((2*pe+1)*2),te(this.dyn_ltree),te(this.dyn_dtree),te(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(he+1),this.heap=new e.Buf16(2*V+1),te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*V+1),te(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}c(B,"xE"),h(B,"DeflateState");function Y(v){var ue;return!v||!v.state?Fe(v,S):(v.total_in=v.total_out=0,v.data_type=J,ue=v.state,ue.pending=0,ue.pending_out=0,ue.wrap<0&&(ue.wrap=-ue.wrap),ue.status=ue.wrap?K:me,v.adler=ue.wrap===2?0:1,ue.last_flush=f,t._tr_init(ue),y)}c(Y,"Up"),h(Y,"deflateResetKeep");function Ne(v){var ue=Y(v);return ue===y&&Pt(v.state),ue}c(Ne,"zp"),h(Ne,"deflateReset");function et(v,ue){return!v||!v.state||v.state.wrap!==2?S:(v.state.gzhead=ue,y)}c(et,"PE"),h(et,"deflateSetHeader");function re(v,ue,de,N,Z,fe){if(!v)return S;var st=1;if(ue===P&&(ue=6),N<0?(st=0,N=-N):N>15&&(st=2,N-=16),Z<1||Z>oe||de!==ne||N<8||N>15||ue<0||ue>9||fe<0||fe>C)return Fe(v,S);N===8&&(N=9);var Xe=new B;return v.state=Xe,Xe.strm=v,Xe.wrap=st,Xe.gzhead=null,Xe.w_bits=N,Xe.w_size=1<<Xe.w_bits,Xe.w_mask=Xe.w_size-1,Xe.hash_bits=Z+7,Xe.hash_size=1<<Xe.hash_bits,Xe.hash_mask=Xe.hash_size-1,Xe.hash_shift=~~((Xe.hash_bits+Ae-1)/Ae),Xe.window=new e.Buf8(Xe.w_size*2),Xe.head=new e.Buf16(Xe.hash_size),Xe.prev=new e.Buf16(Xe.w_size),Xe.lit_bufsize=1<<Z+6,Xe.pending_buf_size=Xe.lit_bufsize*4,Xe.pending_buf=new e.Buf8(Xe.pending_buf_size),Xe.d_buf=1*Xe.lit_bufsize,Xe.l_buf=3*Xe.lit_bufsize,Xe.level=ue,Xe.strategy=fe,Xe.method=de,Ne(v)}c(re,"Wp"),h(re,"deflateInit2");function be(v,ue){return re(v,ue,ne,z,ee,U)}c(be,"TE"),h(be,"deflateInit");function A(v,ue){var de,N,Z,fe;if(!v||!v.state||ue>g||ue<0)return v?Fe(v,S):S;if(N=v.state,!v.output||!v.input&&v.avail_in!==0||N.status===Je&&ue!==a)return Fe(v,v.avail_out===0?T:S);if(N.strm=v,de=N.last_flush,N.last_flush=ue,N.status===K)if(N.wrap===2)v.adler=0,_e(N,31),_e(N,139),_e(N,8),N.gzhead?(_e(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),_e(N,N.gzhead.time&255),_e(N,N.gzhead.time>>8&255),_e(N,N.gzhead.time>>16&255),_e(N,N.gzhead.time>>24&255),_e(N,N.level===9?2:N.strategy>=R||N.level<2?4:0),_e(N,N.gzhead.os&255),N.gzhead.extra&&N.gzhead.extra.length&&(_e(N,N.gzhead.extra.length&255),_e(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(v.adler=n(v.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=Oe):(_e(N,0),_e(N,0),_e(N,0),_e(N,0),_e(N,0),_e(N,N.level===9?2:N.strategy>=R||N.level<2?4:0),_e(N,ye),N.status=me);else{var st=ne+(N.w_bits-8<<4)<<8,Xe=-1;N.strategy>=R||N.level<2?Xe=0:N.level<6?Xe=1:N.level===6?Xe=2:Xe=3,st|=Xe<<6,N.strstart!==0&&(st|=$e),st+=31-st%31,N.status=me,Pe(N,st),N.strstart!==0&&(Pe(N,v.adler>>>16),Pe(N,v.adler&65535)),v.adler=1}if(N.status===Oe)if(N.gzhead.extra){for(Z=N.pending;N.gzindex<(N.gzhead.extra.length&65535)&&!(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),se(v),Z=N.pending,N.pending===N.pending_buf_size));)_e(N,N.gzhead.extra[N.gzindex]&255),N.gzindex++;N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=je)}else N.status=je;if(N.status===je)if(N.gzhead.name){Z=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),se(v),Z=N.pending,N.pending===N.pending_buf_size)){fe=1;break}N.gzindex<N.gzhead.name.length?fe=N.gzhead.name.charCodeAt(N.gzindex++)&255:fe=0,_e(N,fe)}while(fe!==0);N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),fe===0&&(N.gzindex=0,N.status=Te)}else N.status=Te;if(N.status===Te)if(N.gzhead.comment){Z=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),se(v),Z=N.pending,N.pending===N.pending_buf_size)){fe=1;break}N.gzindex<N.gzhead.comment.length?fe=N.gzhead.comment.charCodeAt(N.gzindex++)&255:fe=0,_e(N,fe)}while(fe!==0);N.gzhead.hcrc&&N.pending>Z&&(v.adler=n(v.adler,N.pending_buf,N.pending-Z,Z)),fe===0&&(N.status=Ge)}else N.status=Ge;if(N.status===Ge&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&se(v),N.pending+2<=N.pending_buf_size&&(_e(N,v.adler&255),_e(N,v.adler>>8&255),v.adler=0,N.status=me)):N.status=me),N.pending!==0){if(se(v),v.avail_out===0)return N.last_flush=-1,y}else if(v.avail_in===0&&G(ue)<=G(de)&&ue!==a)return Fe(v,T);if(N.status===Je&&v.avail_in!==0)return Fe(v,T);if(v.avail_in!==0||N.lookahead!==0||ue!==f&&N.status!==Je){var D=N.strategy===R?gt(N,ue):N.strategy===M?Gt(N,ue):St[N.level].func(N,ue);if((D===Ke||D===ve)&&(N.status=Je),D===He||D===Ke)return v.avail_out===0&&(N.last_flush=-1),y;if(D===it&&(ue===m?t._tr_align(N):ue!==g&&(t._tr_stored_block(N,0,0,!1),ue===l&&(te(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),se(v),v.avail_out===0))return N.last_flush=-1,y}return ue!==a?y:N.wrap<=0?b:(N.wrap===2?(_e(N,v.adler&255),_e(N,v.adler>>8&255),_e(N,v.adler>>16&255),_e(N,v.adler>>24&255),_e(N,v.total_in&255),_e(N,v.total_in>>8&255),_e(N,v.total_in>>16&255),_e(N,v.total_in>>24&255)):(Pe(N,v.adler>>>16),Pe(N,v.adler&65535)),se(v),N.wrap>0&&(N.wrap=-N.wrap),N.pending!==0?y:b)}c(A,"AE"),h(A,"deflate");function Ce(v){var ue;return!v||!v.state?S:(ue=v.state.status,ue!==K&&ue!==Oe&&ue!==je&&ue!==Te&&ue!==Ge&&ue!==me&&ue!==Je?Fe(v,S):(v.state=null,ue===me?Fe(v,F):y))}c(Ce,"OE"),h(Ce,"deflateEnd");function dt(v,ue){var de=ue.length,N,Z,fe,st,Xe,D,W,Me;if(!v||!v.state||(N=v.state,st=N.wrap,st===2||st===1&&N.status!==K||N.lookahead))return S;for(st===1&&(v.adler=r(v.adler,ue,de,0)),N.wrap=0,de>=N.w_size&&(st===0&&(te(N.head),N.strstart=0,N.block_start=0,N.insert=0),Me=new e.Buf8(N.w_size),e.arraySet(Me,ue,de-N.w_size,N.w_size,0),ue=Me,de=N.w_size),Xe=v.avail_in,D=v.next_in,W=v.input,v.avail_in=de,v.next_in=0,v.input=ue,Ie(N);N.lookahead>=Ae;){Z=N.strstart,fe=N.lookahead-(Ae-1);do N.ins_h=(N.ins_h<<N.hash_shift^N.window[Z+Ae-1])&N.hash_mask,N.prev[Z&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=Z,Z++;while(--fe);N.strstart=Z,N.lookahead=Ae-1,Ie(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=Ae-1,N.match_available=0,v.next_in=D,v.input=W,v.avail_in=Xe,N.wrap=st,y}c(dt,"DE"),h(dt,"deflateSetDictionary"),i.deflateInit=be,i.deflateInit2=re,i.deflateReset=Ne,i.deflateResetKeep=Y,i.deflateSetHeader=et,i.deflate=A,i.deflateEnd=Ce,i.deflateSetDictionary=dt,i.deflateInfo="pako deflate (from Nodeca project)"}),g_=De(i=>{"use strict";var e=Vi(),t=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{t=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}var n=new e.Buf8(256);for(o=0;o<256;o++)n[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;var o;n[254]=n[254]=1,i.string2buf=function(m){var l,a,g,y,b,S=m.length,F=0;for(y=0;y<S;y++)a=m.charCodeAt(y),(a&64512)===55296&&y+1<S&&(g=m.charCodeAt(y+1),(g&64512)===56320&&(a=65536+(a-55296<<10)+(g-56320),y++)),F+=a<128?1:a<2048?2:a<65536?3:4;for(l=new e.Buf8(F),b=0,y=0;b<F;y++)a=m.charCodeAt(y),(a&64512)===55296&&y+1<S&&(g=m.charCodeAt(y+1),(g&64512)===56320&&(a=65536+(a-55296<<10)+(g-56320),y++)),a<128?l[b++]=a:a<2048?(l[b++]=192|a>>>6,l[b++]=128|a&63):a<65536?(l[b++]=224|a>>>12,l[b++]=128|a>>>6&63,l[b++]=128|a&63):(l[b++]=240|a>>>18,l[b++]=128|a>>>12&63,l[b++]=128|a>>>6&63,l[b++]=128|a&63);return l};function f(m,l){if(l<65534&&(m.subarray&&r||!m.subarray&&t))return String.fromCharCode.apply(null,e.shrinkBuf(m,l));for(var a="",g=0;g<l;g++)a+=String.fromCharCode(m[g]);return a}c(f,"Kp"),h(f,"buf2binstring"),i.buf2binstring=function(m){return f(m,m.length)},i.binstring2buf=function(m){for(var l=new e.Buf8(m.length),a=0,g=l.length;a<g;a++)l[a]=m.charCodeAt(a);return l},i.buf2string=function(m,l){var a,g,y,b,S=l||m.length,F=new Array(S*2);for(g=0,a=0;a<S;){if(y=m[a++],y<128){F[g++]=y;continue}if(b=n[y],b>4){F[g++]=65533,a+=b-1;continue}for(y&=b===2?31:b===3?15:7;b>1&&a<S;)y=y<<6|m[a++]&63,b--;if(b>1){F[g++]=65533;continue}y<65536?F[g++]=y:(y-=65536,F[g++]=55296|y>>10&1023,F[g++]=56320|y&1023)}return f(F,g)},i.utf8border=function(m,l){var a;for(l=l||m.length,l>m.length&&(l=m.length),a=l-1;a>=0&&(m[a]&192)===128;)a--;return a<0||a===0?l:a+n[m[a]]>l?a:l}}),y_=De((i,e)=>{"use strict";function t(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}c(t,"RE"),h(t,"ZStream"),e.exports=t}),hR=De(i=>{"use strict";var e=fR(),t=Vi(),r=g_(),n=sm(),o=y_(),f=Object.prototype.toString,m=0,l=4,a=0,g=1,y=2,b=-1,S=0,F=8;function T(M){if(!(this instanceof T))return new T(M);this.options=t.assign({level:b,method:F,chunkSize:16384,windowBits:15,memLevel:8,strategy:S,to:""},M||{});var C=this.options;C.raw&&C.windowBits>0?C.windowBits=-C.windowBits:C.gzip&&C.windowBits>0&&C.windowBits<16&&(C.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var U=e.deflateInit2(this.strm,C.level,C.method,C.windowBits,C.memLevel,C.strategy);if(U!==a)throw new Error(n[U]);if(C.header&&e.deflateSetHeader(this.strm,C.header),C.dictionary){var J;if(typeof C.dictionary=="string"?J=r.string2buf(C.dictionary):f.call(C.dictionary)==="[object ArrayBuffer]"?J=new Uint8Array(C.dictionary):J=C.dictionary,U=e.deflateSetDictionary(this.strm,J),U!==a)throw new Error(n[U]);this._dict_set=!0}}c(T,"_r"),h(T,"Deflate"),T.prototype.push=function(M,C){var U=this.strm,J=this.options.chunkSize,ne,oe;if(this.ended)return!1;oe=C===~~C?C:C===!0?l:m,typeof M=="string"?U.input=r.string2buf(M):f.call(M)==="[object ArrayBuffer]"?U.input=new Uint8Array(M):U.input=M,U.next_in=0,U.avail_in=U.input.length;do{if(U.avail_out===0&&(U.output=new t.Buf8(J),U.next_out=0,U.avail_out=J),ne=e.deflate(U,oe),ne!==g&&ne!==a)return this.onEnd(ne),this.ended=!0,!1;(U.avail_out===0||U.avail_in===0&&(oe===l||oe===y))&&(this.options.to==="string"?this.onData(r.buf2binstring(t.shrinkBuf(U.output,U.next_out))):this.onData(t.shrinkBuf(U.output,U.next_out)))}while((U.avail_in>0||U.avail_out===0)&&ne!==g);return oe===l?(ne=e.deflateEnd(this.strm),this.onEnd(ne),this.ended=!0,ne===a):(oe===y&&(this.onEnd(a),U.avail_out=0),!0)},T.prototype.onData=function(M){this.chunks.push(M)},T.prototype.onEnd=function(M){M===a&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=M,this.msg=this.strm.msg};function P(M,C){var U=new T(C);if(U.push(M,!0),U.err)throw U.msg||n[U.err];return U.result}c(P,"Gl"),h(P,"deflate");function $(M,C){return C=C||{},C.raw=!0,P(M,C)}c($,"LE"),h($,"deflateRaw");function R(M,C){return C=C||{},C.gzip=!0,P(M,C)}c(R,"ME"),h(R,"gzip"),i.Deflate=T,i.deflate=P,i.deflateRaw=$,i.gzip=R}),uR=De((i,e)=>{"use strict";var t=30,r=12;e.exports=h(function(n,o){var f,m,l,a,g,y,b,S,F,T,P,$,R,M,C,U,J,ne,oe,z,ee,H,j,V,X;f=n.state,m=n.next_in,V=n.input,l=m+(n.avail_in-5),a=n.next_out,X=n.output,g=a-(o-n.avail_out),y=a+(n.avail_out-257),b=f.dmax,S=f.wsize,F=f.whave,T=f.wnext,P=f.window,$=f.hold,R=f.bits,M=f.lencode,C=f.distcode,U=(1<<f.lenbits)-1,J=(1<<f.distbits)-1;e:do{R<15&&($+=V[m++]<<R,R+=8,$+=V[m++]<<R,R+=8),ne=M[$&U];t:for(;;){if(oe=ne>>>24,$>>>=oe,R-=oe,oe=ne>>>16&255,oe===0)X[a++]=ne&65535;else if(oe&16){z=ne&65535,oe&=15,oe&&(R<oe&&($+=V[m++]<<R,R+=8),z+=$&(1<<oe)-1,$>>>=oe,R-=oe),R<15&&($+=V[m++]<<R,R+=8,$+=V[m++]<<R,R+=8),ne=C[$&J];r:for(;;){if(oe=ne>>>24,$>>>=oe,R-=oe,oe=ne>>>16&255,oe&16){if(ee=ne&65535,oe&=15,R<oe&&($+=V[m++]<<R,R+=8,R<oe&&($+=V[m++]<<R,R+=8)),ee+=$&(1<<oe)-1,ee>b){n.msg="invalid distance too far back",f.mode=t;break e}if($>>>=oe,R-=oe,oe=a-g,ee>oe){if(oe=ee-oe,oe>F&&f.sane){n.msg="invalid distance too far back",f.mode=t;break e}if(H=0,j=P,T===0){if(H+=S-oe,oe<z){z-=oe;do X[a++]=P[H++];while(--oe);H=a-ee,j=X}}else if(T<oe){if(H+=S+T-oe,oe-=T,oe<z){z-=oe;do X[a++]=P[H++];while(--oe);if(H=0,T<z){oe=T,z-=oe;do X[a++]=P[H++];while(--oe);H=a-ee,j=X}}}else if(H+=T-oe,oe<z){z-=oe;do X[a++]=P[H++];while(--oe);H=a-ee,j=X}for(;z>2;)X[a++]=j[H++],X[a++]=j[H++],X[a++]=j[H++],z-=3;z&&(X[a++]=j[H++],z>1&&(X[a++]=j[H++]))}else{H=a-ee;do X[a++]=X[H++],X[a++]=X[H++],X[a++]=X[H++],z-=3;while(z>2);z&&(X[a++]=X[H++],z>1&&(X[a++]=X[H++]))}}else if(oe&64){n.msg="invalid distance code",f.mode=t;break e}else{ne=C[(ne&65535)+($&(1<<oe)-1)];continue r}break}}else if(oe&64)if(oe&32){f.mode=r;break e}else{n.msg="invalid literal/length code",f.mode=t;break e}else{ne=M[(ne&65535)+($&(1<<oe)-1)];continue t}break}}while(m<l&&a<y);z=R>>3,m-=z,R-=z<<3,$&=(1<<R)-1,n.next_in=m,n.next_out=a,n.avail_in=m<l?5+(l-m):5-(m-l),n.avail_out=a<y?257+(y-a):257-(a-y),f.hold=$,f.bits=R},"inflate_fast")}),dR=De((i,e)=>{"use strict";var t=Vi(),r=15,n=852,o=592,f=0,m=1,l=2,a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],g=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],y=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],b=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=h(function(S,F,T,P,$,R,M,C){var U=C.bits,J=0,ne=0,oe=0,z=0,ee=0,H=0,j=0,V=0,X=0,pe=0,we,he,Ae,lt,le,$e=null,K=0,Oe,je=new t.Buf16(r+1),Te=new t.Buf16(r+1),Ge=null,me=0,Je,He,it;for(J=0;J<=r;J++)je[J]=0;for(ne=0;ne<P;ne++)je[F[T+ne]]++;for(ee=U,z=r;z>=1&&je[z]===0;z--);if(ee>z&&(ee=z),z===0)return $[R++]=1<<24|64<<16|0,$[R++]=1<<24|64<<16|0,C.bits=1,0;for(oe=1;oe<z&&je[oe]===0;oe++);for(ee<oe&&(ee=oe),V=1,J=1;J<=r;J++)if(V<<=1,V-=je[J],V<0)return-1;if(V>0&&(S===f||z!==1))return-1;for(Te[1]=0,J=1;J<r;J++)Te[J+1]=Te[J]+je[J];for(ne=0;ne<P;ne++)F[T+ne]!==0&&(M[Te[F[T+ne]]++]=ne);if(S===f?($e=Ge=M,Oe=19):S===m?($e=a,K-=257,Ge=g,me-=257,Oe=256):($e=y,Ge=b,Oe=-1),pe=0,ne=0,J=oe,le=R,H=ee,j=0,Ae=-1,X=1<<ee,lt=X-1,S===m&&X>n||S===l&&X>o)return 1;for(;;){Je=J-j,M[ne]<Oe?(He=0,it=M[ne]):M[ne]>Oe?(He=Ge[me+M[ne]],it=$e[K+M[ne]]):(He=96,it=0),we=1<<J-j,he=1<<H,oe=he;do he-=we,$[le+(pe>>j)+he]=Je<<24|He<<16|it|0;while(he!==0);for(we=1<<J-1;pe&we;)we>>=1;if(we!==0?(pe&=we-1,pe+=we):pe=0,ne++,--je[J]===0){if(J===z)break;J=F[T+M[ne]]}if(J>ee&&(pe&lt)!==Ae){for(j===0&&(j=ee),le+=oe,H=J-j,V=1<<H;H+j<z&&(V-=je[H+j],!(V<=0));)H++,V<<=1;if(X+=1<<H,S===m&&X>n||S===l&&X>o)return 1;Ae=pe&lt,$[Ae]=ee<<24|H<<16|le-R|0}}return pe!==0&&($[le+pe]=J-j<<24|64<<16|0),C.bits=ee,0},"inflate_table")}),pR=De(i=>{"use strict";var e=Vi(),t=p_(),r=m_(),n=uR(),o=dR(),f=0,m=1,l=2,a=4,g=5,y=6,b=0,S=1,F=2,T=-2,P=-3,$=-4,R=-5,M=8,C=1,U=2,J=3,ne=4,oe=5,z=6,ee=7,H=8,j=9,V=10,X=11,pe=12,we=13,he=14,Ae=15,lt=16,le=17,$e=18,K=19,Oe=20,je=21,Te=22,Ge=23,me=24,Je=25,He=26,it=27,Ke=28,ve=29,ye=30,Fe=31,G=32,te=852,se=592,ke=15,_e=ke;function Pe(re){return(re>>>24&255)+(re>>>8&65280)+((re&65280)<<8)+((re&255)<<24)}c(Pe,"Cm"),h(Pe,"zswap32");function Q(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}c(Q,"r1"),h(Q,"InflateState");function ge(re){var be;return!re||!re.state?T:(be=re.state,re.total_in=re.total_out=be.total=0,re.msg="",be.wrap&&(re.adler=be.wrap&1),be.mode=C,be.last=0,be.havedict=0,be.dmax=32768,be.head=null,be.hold=0,be.bits=0,be.lencode=be.lendyn=new e.Buf32(te),be.distcode=be.distdyn=new e.Buf32(se),be.sane=1,be.back=-1,b)}c(ge,"Mm"),h(ge,"inflateResetKeep");function Ie(re){var be;return!re||!re.state?T:(be=re.state,be.wsize=0,be.whave=0,be.wnext=0,ge(re))}c(Ie,"jm"),h(Ie,"inflateReset");function xe(re,be){var A,Ce;return!re||!re.state||(Ce=re.state,be<0?(A=0,be=-be):(A=(be>>4)+1,be<48&&(be&=15)),be&&(be<8||be>15))?T:(Ce.window!==null&&Ce.wbits!==be&&(Ce.window=null),Ce.wrap=A,Ce.wbits=be,Ie(re))}c(xe,"Hm"),h(xe,"inflateReset2");function Ye(re,be){var A,Ce;return re?(Ce=new Q,re.state=Ce,Ce.window=null,A=xe(re,be),A!==b&&(re.state=null),A):T}c(Ye,"qm"),h(Ye,"inflateInit2");function kt(re){return Ye(re,_e)}c(kt,"i1"),h(kt,"inflateInit");var Gt=!0,gt,_t;function St(re){if(Gt){var be;for(gt=new e.Buf32(512),_t=new e.Buf32(32),be=0;be<144;)re.lens[be++]=8;for(;be<256;)re.lens[be++]=9;for(;be<280;)re.lens[be++]=7;for(;be<288;)re.lens[be++]=8;for(o(m,re.lens,0,288,gt,0,re.work,{bits:9}),be=0;be<32;)re.lens[be++]=5;o(l,re.lens,0,32,_t,0,re.work,{bits:5}),Gt=!1}re.lencode=gt,re.lenbits=9,re.distcode=_t,re.distbits=5}c(St,"n1"),h(St,"fixedtables");function Pt(re,be,A,Ce){var dt,v=re.state;return v.window===null&&(v.wsize=1<<v.wbits,v.wnext=0,v.whave=0,v.window=new e.Buf8(v.wsize)),Ce>=v.wsize?(e.arraySet(v.window,be,A-v.wsize,v.wsize,0),v.wnext=0,v.whave=v.wsize):(dt=v.wsize-v.wnext,dt>Ce&&(dt=Ce),e.arraySet(v.window,be,A-Ce,dt,v.wnext),Ce-=dt,Ce?(e.arraySet(v.window,be,A-Ce,Ce,0),v.wnext=Ce,v.whave=v.wsize):(v.wnext+=dt,v.wnext===v.wsize&&(v.wnext=0),v.whave<v.wsize&&(v.whave+=dt))),0}c(Pt,"Um"),h(Pt,"updatewindow");function B(re,be){var A,Ce,dt,v,ue,de,N,Z,fe,st,Xe,D,W,Me,Le=0,Ue,ut,vt,Lt,Zr,fr,Ct,ze,Mt=new e.Buf8(4),sr,Qt,Mr=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!re||!re.state||!re.output||!re.input&&re.avail_in!==0)return T;A=re.state,A.mode===pe&&(A.mode=we),ue=re.next_out,dt=re.output,N=re.avail_out,v=re.next_in,Ce=re.input,de=re.avail_in,Z=A.hold,fe=A.bits,st=de,Xe=N,ze=b;e:for(;;)switch(A.mode){case C:if(A.wrap===0){A.mode=we;break}for(;fe<16;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(A.wrap&2&&Z===35615){A.check=0,Mt[0]=Z&255,Mt[1]=Z>>>8&255,A.check=r(A.check,Mt,2,0),Z=0,fe=0,A.mode=U;break}if(A.flags=0,A.head&&(A.head.done=!1),!(A.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){re.msg="incorrect header check",A.mode=ye;break}if((Z&15)!==M){re.msg="unknown compression method",A.mode=ye;break}if(Z>>>=4,fe-=4,Ct=(Z&15)+8,A.wbits===0)A.wbits=Ct;else if(Ct>A.wbits){re.msg="invalid window size",A.mode=ye;break}A.dmax=1<<Ct,re.adler=A.check=1,A.mode=Z&512?V:pe,Z=0,fe=0;break;case U:for(;fe<16;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(A.flags=Z,(A.flags&255)!==M){re.msg="unknown compression method",A.mode=ye;break}if(A.flags&57344){re.msg="unknown header flags set",A.mode=ye;break}A.head&&(A.head.text=Z>>8&1),A.flags&512&&(Mt[0]=Z&255,Mt[1]=Z>>>8&255,A.check=r(A.check,Mt,2,0)),Z=0,fe=0,A.mode=J;case J:for(;fe<32;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.head&&(A.head.time=Z),A.flags&512&&(Mt[0]=Z&255,Mt[1]=Z>>>8&255,Mt[2]=Z>>>16&255,Mt[3]=Z>>>24&255,A.check=r(A.check,Mt,4,0)),Z=0,fe=0,A.mode=ne;case ne:for(;fe<16;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.head&&(A.head.xflags=Z&255,A.head.os=Z>>8),A.flags&512&&(Mt[0]=Z&255,Mt[1]=Z>>>8&255,A.check=r(A.check,Mt,2,0)),Z=0,fe=0,A.mode=oe;case oe:if(A.flags&1024){for(;fe<16;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.length=Z,A.head&&(A.head.extra_len=Z),A.flags&512&&(Mt[0]=Z&255,Mt[1]=Z>>>8&255,A.check=r(A.check,Mt,2,0)),Z=0,fe=0}else A.head&&(A.head.extra=null);A.mode=z;case z:if(A.flags&1024&&(D=A.length,D>de&&(D=de),D&&(A.head&&(Ct=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),e.arraySet(A.head.extra,Ce,v,D,Ct)),A.flags&512&&(A.check=r(A.check,Ce,D,v)),de-=D,v+=D,A.length-=D),A.length))break e;A.length=0,A.mode=ee;case ee:if(A.flags&2048){if(de===0)break e;D=0;do Ct=Ce[v+D++],A.head&&Ct&&A.length<65536&&(A.head.name+=String.fromCharCode(Ct));while(Ct&&D<de);if(A.flags&512&&(A.check=r(A.check,Ce,D,v)),de-=D,v+=D,Ct)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=H;case H:if(A.flags&4096){if(de===0)break e;D=0;do Ct=Ce[v+D++],A.head&&Ct&&A.length<65536&&(A.head.comment+=String.fromCharCode(Ct));while(Ct&&D<de);if(A.flags&512&&(A.check=r(A.check,Ce,D,v)),de-=D,v+=D,Ct)break e}else A.head&&(A.head.comment=null);A.mode=j;case j:if(A.flags&512){for(;fe<16;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(Z!==(A.check&65535)){re.msg="header crc mismatch",A.mode=ye;break}Z=0,fe=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),re.adler=A.check=0,A.mode=pe;break;case V:for(;fe<32;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}re.adler=A.check=Pe(Z),Z=0,fe=0,A.mode=X;case X:if(A.havedict===0)return re.next_out=ue,re.avail_out=N,re.next_in=v,re.avail_in=de,A.hold=Z,A.bits=fe,F;re.adler=A.check=1,A.mode=pe;case pe:if(be===g||be===y)break e;case we:if(A.last){Z>>>=fe&7,fe-=fe&7,A.mode=it;break}for(;fe<3;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}switch(A.last=Z&1,Z>>>=1,fe-=1,Z&3){case 0:A.mode=he;break;case 1:if(St(A),A.mode=Oe,be===y){Z>>>=2,fe-=2;break e}break;case 2:A.mode=le;break;case 3:re.msg="invalid block type",A.mode=ye}Z>>>=2,fe-=2;break;case he:for(Z>>>=fe&7,fe-=fe&7;fe<32;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if((Z&65535)!==(Z>>>16^65535)){re.msg="invalid stored block lengths",A.mode=ye;break}if(A.length=Z&65535,Z=0,fe=0,A.mode=Ae,be===y)break e;case Ae:A.mode=lt;case lt:if(D=A.length,D){if(D>de&&(D=de),D>N&&(D=N),D===0)break e;e.arraySet(dt,Ce,v,D,ue),de-=D,v+=D,N-=D,ue+=D,A.length-=D;break}A.mode=pe;break;case le:for(;fe<14;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(A.nlen=(Z&31)+257,Z>>>=5,fe-=5,A.ndist=(Z&31)+1,Z>>>=5,fe-=5,A.ncode=(Z&15)+4,Z>>>=4,fe-=4,A.nlen>286||A.ndist>30){re.msg="too many length or distance symbols",A.mode=ye;break}A.have=0,A.mode=$e;case $e:for(;A.have<A.ncode;){for(;fe<3;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.lens[Mr[A.have++]]=Z&7,Z>>>=3,fe-=3}for(;A.have<19;)A.lens[Mr[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,sr={bits:A.lenbits},ze=o(f,A.lens,0,19,A.lencode,0,A.work,sr),A.lenbits=sr.bits,ze){re.msg="invalid code lengths set",A.mode=ye;break}A.have=0,A.mode=K;case K:for(;A.have<A.nlen+A.ndist;){for(;Le=A.lencode[Z&(1<<A.lenbits)-1],Ue=Le>>>24,ut=Le>>>16&255,vt=Le&65535,!(Ue<=fe);){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(vt<16)Z>>>=Ue,fe-=Ue,A.lens[A.have++]=vt;else{if(vt===16){for(Qt=Ue+2;fe<Qt;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(Z>>>=Ue,fe-=Ue,A.have===0){re.msg="invalid bit length repeat",A.mode=ye;break}Ct=A.lens[A.have-1],D=3+(Z&3),Z>>>=2,fe-=2}else if(vt===17){for(Qt=Ue+3;fe<Qt;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}Z>>>=Ue,fe-=Ue,Ct=0,D=3+(Z&7),Z>>>=3,fe-=3}else{for(Qt=Ue+7;fe<Qt;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}Z>>>=Ue,fe-=Ue,Ct=0,D=11+(Z&127),Z>>>=7,fe-=7}if(A.have+D>A.nlen+A.ndist){re.msg="invalid bit length repeat",A.mode=ye;break}for(;D--;)A.lens[A.have++]=Ct}}if(A.mode===ye)break;if(A.lens[256]===0){re.msg="invalid code -- missing end-of-block",A.mode=ye;break}if(A.lenbits=9,sr={bits:A.lenbits},ze=o(m,A.lens,0,A.nlen,A.lencode,0,A.work,sr),A.lenbits=sr.bits,ze){re.msg="invalid literal/lengths set",A.mode=ye;break}if(A.distbits=6,A.distcode=A.distdyn,sr={bits:A.distbits},ze=o(l,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,sr),A.distbits=sr.bits,ze){re.msg="invalid distances set",A.mode=ye;break}if(A.mode=Oe,be===y)break e;case Oe:A.mode=je;case je:if(de>=6&&N>=258){re.next_out=ue,re.avail_out=N,re.next_in=v,re.avail_in=de,A.hold=Z,A.bits=fe,n(re,Xe),ue=re.next_out,dt=re.output,N=re.avail_out,v=re.next_in,Ce=re.input,de=re.avail_in,Z=A.hold,fe=A.bits,A.mode===pe&&(A.back=-1);break}for(A.back=0;Le=A.lencode[Z&(1<<A.lenbits)-1],Ue=Le>>>24,ut=Le>>>16&255,vt=Le&65535,!(Ue<=fe);){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(ut&&!(ut&240)){for(Lt=Ue,Zr=ut,fr=vt;Le=A.lencode[fr+((Z&(1<<Lt+Zr)-1)>>Lt)],Ue=Le>>>24,ut=Le>>>16&255,vt=Le&65535,!(Lt+Ue<=fe);){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}Z>>>=Lt,fe-=Lt,A.back+=Lt}if(Z>>>=Ue,fe-=Ue,A.back+=Ue,A.length=vt,ut===0){A.mode=He;break}if(ut&32){A.back=-1,A.mode=pe;break}if(ut&64){re.msg="invalid literal/length code",A.mode=ye;break}A.extra=ut&15,A.mode=Te;case Te:if(A.extra){for(Qt=A.extra;fe<Qt;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.length+=Z&(1<<A.extra)-1,Z>>>=A.extra,fe-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=Ge;case Ge:for(;Le=A.distcode[Z&(1<<A.distbits)-1],Ue=Le>>>24,ut=Le>>>16&255,vt=Le&65535,!(Ue<=fe);){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(!(ut&240)){for(Lt=Ue,Zr=ut,fr=vt;Le=A.distcode[fr+((Z&(1<<Lt+Zr)-1)>>Lt)],Ue=Le>>>24,ut=Le>>>16&255,vt=Le&65535,!(Lt+Ue<=fe);){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}Z>>>=Lt,fe-=Lt,A.back+=Lt}if(Z>>>=Ue,fe-=Ue,A.back+=Ue,ut&64){re.msg="invalid distance code",A.mode=ye;break}A.offset=vt,A.extra=ut&15,A.mode=me;case me:if(A.extra){for(Qt=A.extra;fe<Qt;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}A.offset+=Z&(1<<A.extra)-1,Z>>>=A.extra,fe-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){re.msg="invalid distance too far back",A.mode=ye;break}A.mode=Je;case Je:if(N===0)break e;if(D=Xe-N,A.offset>D){if(D=A.offset-D,D>A.whave&&A.sane){re.msg="invalid distance too far back",A.mode=ye;break}D>A.wnext?(D-=A.wnext,W=A.wsize-D):W=A.wnext-D,D>A.length&&(D=A.length),Me=A.window}else Me=dt,W=ue-A.offset,D=A.length;D>N&&(D=N),N-=D,A.length-=D;do dt[ue++]=Me[W++];while(--D);A.length===0&&(A.mode=je);break;case He:if(N===0)break e;dt[ue++]=A.length,N--,A.mode=je;break;case it:if(A.wrap){for(;fe<32;){if(de===0)break e;de--,Z|=Ce[v++]<<fe,fe+=8}if(Xe-=N,re.total_out+=Xe,A.total+=Xe,Xe&&(re.adler=A.check=A.flags?r(A.check,dt,Xe,ue-Xe):t(A.check,dt,Xe,ue-Xe)),Xe=N,(A.flags?Z:Pe(Z))!==A.check){re.msg="incorrect data check",A.mode=ye;break}Z=0,fe=0}A.mode=Ke;case Ke:if(A.wrap&&A.flags){for(;fe<32;){if(de===0)break e;de--,Z+=Ce[v++]<<fe,fe+=8}if(Z!==(A.total&4294967295)){re.msg="incorrect length check",A.mode=ye;break}Z=0,fe=0}A.mode=ve;case ve:ze=S;break e;case ye:ze=P;break e;case Fe:return $;case G:default:return T}return re.next_out=ue,re.avail_out=N,re.next_in=v,re.avail_in=de,A.hold=Z,A.bits=fe,(A.wsize||Xe!==re.avail_out&&A.mode<ye&&(A.mode<it||be!==a))&&Pt(re,re.output,re.next_out,Xe-re.avail_out)?(A.mode=Fe,$):(st-=re.avail_in,Xe-=re.avail_out,re.total_in+=st,re.total_out+=Xe,A.total+=Xe,A.wrap&&Xe&&(re.adler=A.check=A.flags?r(A.check,dt,Xe,re.next_out-Xe):t(A.check,dt,Xe,re.next_out-Xe)),re.data_type=A.bits+(A.last?64:0)+(A.mode===pe?128:0)+(A.mode===Oe||A.mode===Ae?256:0),(st===0&&Xe===0||be===a)&&ze===b&&(ze=R),ze)}c(B,"a1"),h(B,"inflate");function Y(re){if(!re||!re.state)return T;var be=re.state;return be.window&&(be.window=null),re.state=null,b}c(Y,"o1"),h(Y,"inflateEnd");function Ne(re,be){var A;return!re||!re.state||(A=re.state,!(A.wrap&2))?T:(A.head=be,be.done=!1,b)}c(Ne,"s1"),h(Ne,"inflateGetHeader");function et(re,be){var A=be.length,Ce,dt,v;return!re||!re.state||(Ce=re.state,Ce.wrap!==0&&Ce.mode!==X)?T:Ce.mode===X&&(dt=1,dt=t(dt,be,A,0),dt!==Ce.check)?P:(v=Pt(re,be,A,A),v?(Ce.mode=Fe,$):(Ce.havedict=1,b))}c(et,"l1"),h(et,"inflateSetDictionary"),i.inflateReset=Ie,i.inflateReset2=xe,i.inflateResetKeep=ge,i.inflateInit=kt,i.inflateInit2=Ye,i.inflate=B,i.inflateEnd=Y,i.inflateGetHeader=Ne,i.inflateSetDictionary=et,i.inflateInfo="pako inflate (from Nodeca project)"}),w_=De((i,e)=>{"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),mR=De((i,e)=>{"use strict";function t(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}c(t,"c1"),h(t,"GZheader"),e.exports=t}),gR=De(i=>{"use strict";var e=pR(),t=Vi(),r=g_(),n=w_(),o=sm(),f=y_(),m=mR(),l=Object.prototype.toString;function a(b){if(!(this instanceof a))return new a(b);this.options=t.assign({chunkSize:16384,windowBits:0,to:""},b||{});var S=this.options;S.raw&&S.windowBits>=0&&S.windowBits<16&&(S.windowBits=-S.windowBits,S.windowBits===0&&(S.windowBits=-15)),S.windowBits>=0&&S.windowBits<16&&!(b&&b.windowBits)&&(S.windowBits+=32),S.windowBits>15&&S.windowBits<48&&(S.windowBits&15||(S.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var F=e.inflateInit2(this.strm,S.windowBits);if(F!==n.Z_OK)throw new Error(o[F]);if(this.header=new m,e.inflateGetHeader(this.strm,this.header),S.dictionary&&(typeof S.dictionary=="string"?S.dictionary=r.string2buf(S.dictionary):l.call(S.dictionary)==="[object ArrayBuffer]"&&(S.dictionary=new Uint8Array(S.dictionary)),S.raw&&(F=e.inflateSetDictionary(this.strm,S.dictionary),F!==n.Z_OK)))throw new Error(o[F])}c(a,"Fr"),h(a,"Inflate"),a.prototype.push=function(b,S){var F=this.strm,T=this.options.chunkSize,P=this.options.dictionary,$,R,M,C,U,J=!1;if(this.ended)return!1;R=S===~~S?S:S===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof b=="string"?F.input=r.binstring2buf(b):l.call(b)==="[object ArrayBuffer]"?F.input=new Uint8Array(b):F.input=b,F.next_in=0,F.avail_in=F.input.length;do{if(F.avail_out===0&&(F.output=new t.Buf8(T),F.next_out=0,F.avail_out=T),$=e.inflate(F,n.Z_NO_FLUSH),$===n.Z_NEED_DICT&&P&&($=e.inflateSetDictionary(this.strm,P)),$===n.Z_BUF_ERROR&&J===!0&&($=n.Z_OK,J=!1),$!==n.Z_STREAM_END&&$!==n.Z_OK)return this.onEnd($),this.ended=!0,!1;F.next_out&&(F.avail_out===0||$===n.Z_STREAM_END||F.avail_in===0&&(R===n.Z_FINISH||R===n.Z_SYNC_FLUSH))&&(this.options.to==="string"?(M=r.utf8border(F.output,F.next_out),C=F.next_out-M,U=r.buf2string(F.output,M),F.next_out=C,F.avail_out=T-C,C&&t.arraySet(F.output,F.output,M,C,0),this.onData(U)):this.onData(t.shrinkBuf(F.output,F.next_out))),F.avail_in===0&&F.avail_out===0&&(J=!0)}while((F.avail_in>0||F.avail_out===0)&&$!==n.Z_STREAM_END);return $===n.Z_STREAM_END&&(R=n.Z_FINISH),R===n.Z_FINISH?($=e.inflateEnd(this.strm),this.onEnd($),this.ended=!0,$===n.Z_OK):(R===n.Z_SYNC_FLUSH&&(this.onEnd(n.Z_OK),F.avail_out=0),!0)},a.prototype.onData=function(b){this.chunks.push(b)},a.prototype.onEnd=function(b){b===n.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg};function g(b,S){var F=new a(S);if(F.push(b,!0),F.err)throw F.msg||o[F.err];return F.result}c(g,"ac"),h(g,"inflate");function y(b,S){return S=S||{},S.raw=!0,g(b,S)}c(y,"d1"),h(y,"inflateRaw"),i.Inflate=a,i.inflate=g,i.inflateRaw=y,i.ungzip=g}),yR=De((i,e)=>{"use strict";var t=Vi().assign,r=hR(),n=gR(),o=w_(),f={};t(f,r,n,o),e.exports=f}),wR=De((i,e)=>{"use strict";var t=h((r,n)=>function(...o){let f=n.promiseModule;return new f((m,l)=>{n.multiArgs?o.push((...a)=>{n.errorFirst?a[0]?l(a):(a.shift(),m(a)):m(a)}):n.errorFirst?o.push((a,g)=>{a?l(a):m(g)}):o.push(m),r.apply(this,o)})},"processFn");e.exports=(r,n)=>{n=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},n);let o=typeof r;if(!(r!==null&&(o==="object"||o==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${r===null?"null":o}\``);let f=h(l=>{let a=h(g=>typeof g=="string"?l===g:g.test(l),"match");return n.include?n.include.some(a):!n.exclude.some(a)},"filter"),m;o==="function"?m=h(function(...l){return n.excludeMain?r(...l):t(r,n).apply(this,l)},"ret"):m=Object.create(Object.getPrototypeOf(r));for(let l in r){let a=r[l];m[l]=typeof a=="function"&&f(l)?t(a,n):a}return m}}),bR=De((i,e)=>{"use strict";function t(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}c(t,"g1"),h(t,"escapeRegExp");function r(o,f,m){return f=f instanceof RegExp?f:new RegExp(t(f),"g"),o.replace(f,m)}c(r,"vt"),h(r,"replaceAll");var n={clean:h(function(o){if(typeof o!="string")throw new Error("Expected a string, received: "+o);return o=r(o,"./","/"),o=r(o,"..","."),o=r(o," ","-"),o=r(o,/^[~^:?*\\\-]/g,""),o=r(o,/[~^:?*\\]/g,"-"),o=r(o,/[~^:?*\\\-]$/g,""),o=r(o,"@{","-"),o=r(o,/\.$/g,""),o=r(o,/\/$/g,""),o=r(o,/\.lock$/g,""),o},"clean")};e.exports=n}),_R=De((i,e)=>{e.exports=function(t,r){var n=t,o=r,f=n.length,m=o.length,l=!1,a=null,g=f+1,y=[],b=[],S=[],F="",T=-1,P=0,$=1,R,M,C=h(function(){f>=m&&(R=n,M=f,n=o,o=R,f=m,m=M,l=!0,g=f+1)},"init"),U=h(function(z,ee,H){return{x:z,y:ee,k:H}},"P"),J=h(function(z,ee){return{elem:z,t:ee}},"seselem"),ne=h(function(z,ee,H){var j,V,X;for(ee>H?j=y[z-1+g]:j=y[z+1+g],X=Math.max(ee,H),V=X-z;V<f&&X<m&&n[V]===o[X];)++V,++X;return y[z+g]=b.length,b[b.length]=new U(V,X,j),X},"snake"),oe=h(function(z){var ee,H,j,V,X;for(ee=H=1,j=V=0,X=z.length-1;X>=0;--X)for(;j<z[X].x||V<z[X].y;)z[X].y-z[X].x>V-j?(l?S[S.length]=new J(o[V],T):S[S.length]=new J(o[V],$),++H,++V):z[X].y-z[X].x<V-j?(l?S[S.length]=new J(n[j],$):S[S.length]=new J(n[j],T),++ee,++j):(S[S.length]=new J(n[j],P),F+=n[j],++ee,++H,++j,++V)},"recordseq");return C(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:h(function(){return a},"editdistance"),getlcs:h(function(){return F},"getlcs"),getses:h(function(){return S},"getses"),compose:h(function(){var z,ee,H,j,V,X,pe,we;for(z=m-f,ee=f+m+3,H={},pe=0;pe<ee;++pe)H[pe]=-1,y[pe]=-1;j=-1;do{for(++j,we=-j;we<=z-1;++we)H[we+g]=ne(we,H[we-1+g]+1,H[we+1+g]);for(we=z+j;we>=z+1;--we)H[we+g]=ne(we,H[we-1+g]+1,H[we+1+g]);H[z+g]=ne(z,H[z-1+g]+1,H[z+1+g])}while(H[z+g]!==m);for(a=z+2*j,V=y[z+g],X=[];V!==-1;)X[X.length]=new U(b[V].x,b[V].y,null),V=b[V].k;oe(X)},"compose")}}}),vR=De((i,e)=>{var t=_R();function r(m,l){var a=new t(m,l);a.compose();for(var g=a.getses(),y,b,S=m.length-1,F=l.length-1,T=g.length-1;T>=0;--T)g[T].t===a.SES_COMMON?(b?(b.chain={file1index:S,file2index:F,chain:null},b=b.chain):(y={file1index:S,file2index:F,chain:null},b=y),S--,F--):g[T].t===a.SES_DELETE?S--:g[T].t===a.SES_ADD&&F--;var P={file1index:-1,file2index:-1,chain:null};return b?(b.chain=P,y):P}c(r,"_1"),h(r,"longestCommonSubsequence");function n(m,l){for(var a=[],g=m.length,y=l.length,b=r(m,l);b!==null;b=b.chain){var S=g-b.file1index-1,F=y-b.file2index-1;g=b.file1index,y=b.file2index,(S||F)&&a.push({file1:[g+1,S],file2:[y+1,F]})}return a.reverse(),a}c(n,"ow"),h(n,"diffIndices");function o(m,l,a){var g,y=n(l,m),b=n(l,a),S=[];function F(le,$e){S.push([le.file1[0],$e,le.file1[1],le.file2[0],le.file2[1]])}for(c(F,"l"),h(F,"addHunk"),g=0;g<y.length;g++)F(y[g],0);for(g=0;g<b.length;g++)F(b[g],2);S.sort(function(le,$e){return le[0]-$e[0]});var T=[],P=0;function $(le){le>P&&(T.push([1,P,le-P]),P=le)}c($,"f"),h($,"copyCommon");for(var R=0;R<S.length;R++){for(var M=R,C=S[R],U=C[0],J=U+C[2];R<S.length-1;){var ne=S[R+1],oe=ne[0];if(oe>J)break;J=Math.max(J,oe+ne[2]),R++}if($(U),M==R)C[4]>0&&T.push([C[1],C[3],C[4]]);else{var z={0:[m.length,-1,l.length,-1],2:[a.length,-1,l.length,-1]};for(g=M;g<=R;g++){C=S[g];var ee=C[1],H=z[ee],j=C[0],V=j+C[2],X=C[3],pe=X+C[4];H[0]=Math.min(X,H[0]),H[1]=Math.max(pe,H[1]),H[2]=Math.min(j,H[2]),H[3]=Math.max(V,H[3])}var we=z[0][0]+(U-z[0][2]),he=z[0][1]+(J-z[0][3]),Ae=z[2][0]+(U-z[2][2]),lt=z[2][1]+(J-z[2][3]);T.push([-1,we,he-we,U,J-U,Ae,lt-Ae])}P=J}return $(l.length),T}c(o,"v1"),h(o,"diff3MergeIndices");function f(m,l,a){var g=[],y=[m,l,a],b=o(m,l,a),S=[];function F(){S.length&&g.push({ok:S}),S=[]}c(F,"l"),h(F,"flushOk");function T(C){for(var U=0;U<C.length;U++)S.push(C[U])}c(T,"u"),h(T,"pushOk");function P(C){if(C[2]!=C[6])return!0;for(var U=C[1],J=C[5],ne=0;ne<C[2];ne++)if(m[ne+U]!=a[ne+J])return!0;return!1}c(P,"c"),h(P,"isTrueConflict");for(var $=0;$<b.length;$++){var R=b[$],M=R[0];M==-1?P(R)?(F(),g.push({conflict:{a:m.slice(R[1],R[1]+R[2]),aIndex:R[1],o:l.slice(R[3],R[3]+R[4]),oIndex:R[3],b:a.slice(R[5],R[5]+R[6]),bIndex:R[5]}})):T(y[0].slice(R[1],R[1]+R[2])):T(y[M].slice(R[1],R[1]+R[2]))}return F(),g}c(f,"F1"),h(f,"diff3Merge"),e.exports=f}),Jt=De(i=>{"use strict";var fn,hn,un,dn,Ss,ti,Es,Fs,pn,mn,gn,yn,wn,bn,_n,vn,ks,Ut,Sn,Rs,Ts,$i,En,Fn,kn,Rn,Tn,On,xn,An,Pn,Dn,Nn,Cn,In,Bn,jn,Mn,$n,Ln,Un,Wn,qn,zn,Hn,Gn,Vn,Si,hr,Os,xs,As,Ps,Ds,Ns,Cs,Is,Bs,js,Ms,Kn,Ei;Object.defineProperty(i,"__esModule",{value:!0});function e(p){return p&&typeof p=="object"&&"default"in p?p.default:p}c(e,"ir"),h(e,"_interopDefault");var t=e(Ek()),r=e(oR()),n=e(lR()),o=e(yR()),f=e(wR()),m=e(Nt("ignore")),l=e(bR()),a=e(vR()),g=(fn=class extends Error{constructor(s){super(s),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(s){let u=new fn(s.message);return u.code=s.code,u.data=s.data,u.caller=s.caller,u.stack=s.stack,u}get isIsomorphicGitError(){return!0}},c(fn,"ao"),fn);h(g,"BaseError");var y=g,b=(hn=class extends y{constructor(s){super(`Modifying the index is not possible because you have unmerged files: ${s.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=hn.code,this.data={filepaths:s}}},c(hn,"oo"),hn);h(b,"UnmergedPathsError");var S=b;S.code="UnmergedPathsError";var F=(un=class extends y{constructor(s){super(`An internal error caused this command to fail.
10
11
 
11
12
  If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
12
13
 
13
- Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=Wf.code,this.data={message:e}}};l(Wf,"InternalError");var z=Wf;z.code="InternalError";var zf=class zf extends ee{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=zf.code,this.data={filepath:e}}};l(zf,"UnsafeFilepathError");var qs=zf;qs.code="UnsafeFilepathError";var Lw=class Lw{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};l(Lw,"BufferCursor");var $t=Lw;function ku(t,e){return-(t<e)||+(t>e)}l(ku,"compareStrings");function JT(t,e){return ku(t.path,e.path)}l(JT,"comparePath");function KT(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}l(KT,"normalizeMode");var wr=2**32;function TT(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}l(TT,"SecondsNanoseconds");function Us(t){let[e,r]=TT(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=TT(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%wr,ctimeNanoseconds:r%wr,mtimeSeconds:i%wr,mtimeNanoseconds:n%wr,dev:t.dev%wr,ino:t.ino%wr,mode:KT(t.mode%wr),uid:t.uid%wr,gid:t.gid%wr,size:t.size>-1?t.size%wr:0}}l(Us,"normalizeStats");function sL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}l(sL,"toHex");var cw=null;async function Mr(t){return cw===null&&(cw=await aL()),cw?XT(t):oL(t)}l(Mr,"shasum");function oL(t){return new GT().update(t).digest("hex")}l(oL,"shasumSync");async function XT(t){let e=await crypto.subtle.digest("SHA-1",t);return sL(e)}l(XT,"subtleSHA1");async function aL(){try{return await XT(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}l(aL,"testSubtleSHA1");function cL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}l(cL,"parseCacheEntryFlags");function lL(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}l(lL,"renderCacheEntryFlags");var oi=class oi{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return oi.fromBuffer(e);if(e===null)return new oi(null);throw new z("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new z("Index file is empty (.git/index)");let r=new oi,i=new $t(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new z(`Invalid dircache magic file number: ${n}`);let s=await Mr(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new z(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let f=i.readUInt32BE();if(f!==2)throw new z(`Unsupported dircache version: ${f}`);let c=i.readUInt32BE(),a=0;for(;!i.eof()&&a<c;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let h=i.readUInt16BE();u.flags=cL(h);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new z(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new qs(u.path);let p=8-(i.tell()-12)%8;for(p===0&&(p=8);p--;){let m=i.readUInt8();if(m!==0)throw new z(`Expected 1-8 null characters but got '${m}' after ${u.path}`);if(i.eof())throw new z("Unexpected end of file")}u.stages=[],r._addEntry(u),a++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(JT)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Us(r);let s=Buffer.from(e),o={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
14
- `)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new $t(n),o=Us(e);return s.writeUInt32BE(o.ctimeSeconds),s.writeUInt32BE(o.ctimeNanoseconds),s.writeUInt32BE(o.mtimeSeconds),s.writeUInt32BE(o.mtimeNanoseconds),s.writeUInt32BE(o.dev),s.writeUInt32BE(o.ino),s.writeUInt32BE(o.mode),s.writeUInt32BE(o.uid),s.writeUInt32BE(o.gid),s.writeUInt32BE(o.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(lL(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new $t(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let f of this.entries)if(i.push(oi._entryToBuffer(f)),f.stages.length>1)for(let c of f.stages)c&&c!==f&&i.push(oi._entryToBuffer(c));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),o=await Mr(s);return Buffer.concat([s,Buffer.from(o,"hex")])}};l(oi,"GitIndex");var _w=oi;function Pf(t,e,r=!0,i=!0){let n=Us(t),s=Us(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}l(Pf,"compareStats");var lw=null,fw=Symbol("IndexCache");function fL(){return{map:new Map,stats:new Map}}l(fL,"createCache");async function uL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await _w.from(n);r.map.set(e,s),r.stats.set(e,i)}l(uL,"updateCachedIndexFile");async function hL(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Pf(i,n)}l(hL,"isIndexStale");var jw=class jw{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[fw]||(i[fw]=fL());let o=`${r}/index`;lw===null&&(lw=new Ma({maxPending:1/0}));let f,c=[];return await lw.acquire(o,async()=>{let a=i[fw];await hL(e,o,a)&&await uL(e,o,a);let u=a.map.get(o);if(c=u.unmergedPaths,c.length&&!n)throw new ja(c);if(f=await s(u),u._dirty){let h=await u.toObject();await e.write(o,h),a.stats.set(o,await e.lstat(o)),u._dirty=!1}}),f}};l(jw,"GitIndexManager");var Ee=jw;function Nf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}l(Nf,"basename");function Ws(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}l(Ws,"dirname");function YT(t){let e=new Map,r=l(function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Nf(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Ws(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},"mkdir"),i=l(function(n,s){if(!e.has(n)){let o={type:"blob",fullpath:n,basename:Nf(n),metadata:s,parent:r(Ws(n)),children:[]};o.parent&&o.parent.children.push(o),e.set(n,o)}return e.get(n)},"mkfile");r(".");for(let n of t)i(n.path,n);return e}l(YT,"flatFileListToDirectoryStructure");function dL(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new z(`Unexpected GitTree entry mode: ${t.toString(8)}`)}l(dL,"mode2type");var qw=class qw{constructor({fs:e,gitdir:r,cache:i}){var s;this.treePromise=Ee.acquire({fs:e,gitdir:r,cache:i},async function(o){return YT(o.entries)});let n=this;this.ConstructEntry=(s=class{constructor(f){this._fullpath=f,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}},l(s,"StageEntry"),s)}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(o=>o.fullpath);return s.sort(ku),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Us(i.metadata);e._type=i.type==="tree"?"tree":dL(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}};l(qw,"GitWalkerIndex");var Sw=qw,Ru=Symbol("GitWalkSymbol");function tn(){let t=Object.create(null);return Object.defineProperty(t,Ru,{value:l(function({fs:e,gitdir:r,cache:i}){return new Sw({fs:e,gitdir:r,cache:i})},"value")}),Object.freeze(t),t}l(tn,"STAGE");var Hf=class Hf extends ee{constructor(e){super(`Could not find ${e}.`),this.code=this.name=Hf.code,this.data={what:e}}};l(Hf,"NotFoundError");var le=Hf;le.code="NotFoundError";var Vf=class Vf extends ee{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=Vf.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};l(Vf,"ObjectTypeError");var ot=Vf;ot.code="ObjectTypeError";var Gf=class Gf extends ee{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=Gf.code,this.data={value:e}}};l(Gf,"InvalidOidError");var ci=Gf;ci.code="InvalidOidError";var Jf=class Jf extends ee{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
15
- [remote "${e}"]
14
+ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${s}`),this.code=this.name=un.code,this.data={message:s}}},c(un,"so"),un);h(F,"InternalError");var T=F;T.code="InternalError";var P=(dn=class extends y{constructor(s){super(`The filepath "${s}" contains unsafe character sequences`),this.code=this.name=dn.code,this.data={filepath:s}}},c(dn,"lo"),dn);h(P,"UnsafeFilepathError");var $=P;$.code="UnsafeFilepathError";var R=(Ss=class{constructor(s){this.buffer=s,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(s){this._start=s}slice(s){let u=this.buffer.slice(this._start,this._start+s);return this._start+=s,u}toString(s,u){let d=this.buffer.toString(s,this._start,this._start+u);return this._start+=u,d}write(s,u,d){let w=this.buffer.write(s,this._start,u,d);return this._start+=u,w}copy(s,u,d){let w=s.copy(this.buffer,this._start,u,d);return this._start+=w,w}readUInt8(){let s=this.buffer.readUInt8(this._start);return this._start+=1,s}writeUInt8(s){let u=this.buffer.writeUInt8(s,this._start);return this._start+=1,u}readUInt16BE(){let s=this.buffer.readUInt16BE(this._start);return this._start+=2,s}writeUInt16BE(s){let u=this.buffer.writeUInt16BE(s,this._start);return this._start+=2,u}readUInt32BE(){let s=this.buffer.readUInt32BE(this._start);return this._start+=4,s}writeUInt32BE(s){let u=this.buffer.writeUInt32BE(s,this._start);return this._start+=4,u}},c(Ss,"Lc"),Ss);h(R,"BufferCursor");var M=R;function C(p,s){return-(p<s)||+(p>s)}c(C,"Wo"),h(C,"compareStrings");function U(p,s){return C(p.path,s.path)}c(U,"Rw"),h(U,"comparePath");function J(p){let s=p>0?p>>12:0;s!==4&&s!==8&&s!==10&&s!==14&&(s=8);let u=p&511;return u&73?u=493:u=420,s!==8&&(u=0),(s<<12)+u}c(J,"Cw"),h(J,"normalizeMode");var ne=2**32;function oe(p,s,u,d){if(p!==void 0&&s!==void 0)return[p,s];u===void 0&&(u=d.valueOf());let w=Math.floor(u/1e3),_=(u-w*1e3)*1e6;return[w,_]}c(oe,"cw"),h(oe,"SecondsNanoseconds");function z(p){let[s,u]=oe(p.ctimeSeconds,p.ctimeNanoseconds,p.ctimeMs,p.ctime),[d,w]=oe(p.mtimeSeconds,p.mtimeNanoseconds,p.mtimeMs,p.mtime);return{ctimeSeconds:s%ne,ctimeNanoseconds:u%ne,mtimeSeconds:d%ne,mtimeNanoseconds:w%ne,dev:p.dev%ne,ino:p.ino%ne,mode:J(p.mode%ne),uid:p.uid%ne,gid:p.gid%ne,size:p.size>-1?p.size%ne:0}}c(z,"hi"),h(z,"normalizeStats");function ee(p){let s="";for(let u of new Uint8Array(p))u<16&&(s+="0"),s+=u.toString(16);return s}c(ee,"x1"),h(ee,"toHex");var H=null;async function j(p){return H===null&&(H=await pe()),H?X(p):V(p)}c(j,"Nt"),h(j,"shasum");function V(p){return new r().update(p).digest("hex")}c(V,"P1"),h(V,"shasumSync");async function X(p){let s=await crypto.subtle.digest("SHA-1",p);return ee(s)}c(X,"Iw"),h(X,"subtleSHA1");async function pe(){try{return await X(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}c(pe,"T1"),h(pe,"testSubtleSHA1");function we(p){return{assumeValid:!!(p&32768),extended:!!(p&16384),stage:(p&12288)>>12,nameLength:p&4095}}c(we,"A1"),h(we,"parseCacheEntryFlags");function he(p){let s=p.flags;return s.extended=!1,s.nameLength=Math.min(Buffer.from(p.path).length,4095),(s.assumeValid?32768:0)+(s.extended?16384:0)+((s.stage&3)<<12)+(s.nameLength&4095)}c(he,"O1"),h(he,"renderCacheEntryFlags");var Ae=(ti=class{constructor(s,u){this._dirty=!1,this._unmergedPaths=u||new Set,this._entries=s||new Map}_addEntry(s){if(s.flags.stage===0)s.stages=[s],this._entries.set(s.path,s),this._unmergedPaths.delete(s.path);else{let u=this._entries.get(s.path);u||(this._entries.set(s.path,s),u=s),u.stages[s.flags.stage]=s,this._unmergedPaths.add(s.path)}}static async from(s){if(Buffer.isBuffer(s))return ti.fromBuffer(s);if(s===null)return new ti(null);throw new T("invalid type passed to GitIndex.from")}static async fromBuffer(s){if(s.length===0)throw new T("Index file is empty (.git/index)");let u=new ti,d=new M(s),w=d.toString("utf8",4);if(w!=="DIRC")throw new T(`Invalid dircache magic file number: ${w}`);let _=await j(s.slice(0,-20)),E=s.slice(-20).toString("hex");if(E!==_)throw new T(`Invalid checksum in GitIndex buffer: expected ${E} but saw ${_}`);let k=d.readUInt32BE();if(k!==2)throw new T(`Unsupported dircache version: ${k}`);let I=d.readUInt32BE(),O=0;for(;!d.eof()&&O<I;){let x={};x.ctimeSeconds=d.readUInt32BE(),x.ctimeNanoseconds=d.readUInt32BE(),x.mtimeSeconds=d.readUInt32BE(),x.mtimeNanoseconds=d.readUInt32BE(),x.dev=d.readUInt32BE(),x.ino=d.readUInt32BE(),x.mode=d.readUInt32BE(),x.uid=d.readUInt32BE(),x.gid=d.readUInt32BE(),x.size=d.readUInt32BE(),x.oid=d.slice(20).toString("hex");let L=d.readUInt16BE();x.flags=we(L);let q=s.indexOf(0,d.tell()+1)-d.tell();if(q<1)throw new T(`Got a path length of: ${q}`);if(x.path=d.toString("utf8",q),x.path.includes("..\\")||x.path.includes("../"))throw new $(x.path);let ae=8-(d.tell()-12)%8;for(ae===0&&(ae=8);ae--;){let ce=d.readUInt8();if(ce!==0)throw new T(`Expected 1-8 null characters but got '${ce}' after ${x.path}`);if(d.eof())throw new T("Unexpected end of file")}x.stages=[],u._addEntry(x),O++}return u}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(U)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(s=>s.stages.length>1?s.stages.filter(u=>u):s)}*[Symbol.iterator](){for(let s of this.entries)yield s}insert({filepath:s,stats:u,oid:d,stage:w=0}){u||(u={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),u=z(u);let _=Buffer.from(s),E={ctimeSeconds:u.ctimeSeconds,ctimeNanoseconds:u.ctimeNanoseconds,mtimeSeconds:u.mtimeSeconds,mtimeNanoseconds:u.mtimeNanoseconds,dev:u.dev,ino:u.ino,mode:u.mode||33188,uid:u.uid,gid:u.gid,size:u.size,path:s,oid:d,flags:{assumeValid:!1,extended:!1,stage:w,nameLength:_.length<4095?_.length:4095},stages:[]};this._addEntry(E),this._dirty=!0}delete({filepath:s}){if(this._entries.has(s))this._entries.delete(s);else for(let u of this._entries.keys())u.startsWith(s+"/")&&this._entries.delete(u);this._unmergedPaths.has(s)&&this._unmergedPaths.delete(s),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:s}){return this._entries.has(s)}render(){return this.entries.map(s=>`${s.mode.toString(8)} ${s.oid} ${s.path}`).join(`
15
+ `)}static async _entryToBuffer(s){let u=Buffer.from(s.path),d=Math.ceil((62+u.length+1)/8)*8,w=Buffer.alloc(d),_=new M(w),E=z(s);return _.writeUInt32BE(E.ctimeSeconds),_.writeUInt32BE(E.ctimeNanoseconds),_.writeUInt32BE(E.mtimeSeconds),_.writeUInt32BE(E.mtimeNanoseconds),_.writeUInt32BE(E.dev),_.writeUInt32BE(E.ino),_.writeUInt32BE(E.mode),_.writeUInt32BE(E.uid),_.writeUInt32BE(E.gid),_.writeUInt32BE(E.size),_.write(s.oid,20,"hex"),_.writeUInt16BE(he(s)),_.write(s.path,u.length,"utf8"),w}async toObject(){let s=Buffer.alloc(12),u=new M(s);u.write("DIRC",4,"utf8"),u.writeUInt32BE(2),u.writeUInt32BE(this.entriesFlat.length);let d=[];for(let k of this.entries)if(d.push(ti._entryToBuffer(k)),k.stages.length>1)for(let I of k.stages)I&&I!==k&&d.push(ti._entryToBuffer(I));d=await Promise.all(d);let w=Buffer.concat(d),_=Buffer.concat([s,w]),E=await j(_);return Buffer.concat([_,Buffer.from(E,"hex")])}},c(ti,"Kt"),ti);h(Ae,"GitIndex");var lt=Ae;function le(p,s,u=!0,d=!0){let w=z(p),_=z(s);return u&&w.mode!==_.mode||w.mtimeSeconds!==_.mtimeSeconds||w.ctimeSeconds!==_.ctimeSeconds||w.uid!==_.uid||w.gid!==_.gid||d&&w.ino!==_.ino||w.size!==_.size}c(le,"Ka"),h(le,"compareStats");var $e=null,K=Symbol("IndexCache");function Oe(){return{map:new Map,stats:new Map}}c(Oe,"D1"),h(Oe,"createCache");async function je(p,s,u){let[d,w]=await Promise.all([p.lstat(s),p.read(s)]),_=await lt.from(w);u.map.set(s,_),u.stats.set(s,d)}c(je,"R1"),h(je,"updateCachedIndexFile");async function Te(p,s,u){let d=u.stats.get(s);if(d===void 0)return!0;if(d===null)return!1;let w=await p.lstat(s);return w===null?!1:le(d,w)}c(Te,"C1"),h(Te,"isIndexStale");var Ge=(Es=class{static async acquire({fs:s,gitdir:u,cache:d,allowUnmerged:w=!0},_){d[K]||(d[K]=Oe());let E=`${u}/index`;$e===null&&($e=new t({maxPending:1/0}));let k,I=[];return await $e.acquire(E,async()=>{let O=d[K];await Te(s,E,O)&&await je(s,E,O);let x=O.map.get(E);if(I=x.unmergedPaths,I.length&&!w)throw new S(I);if(k=await _(x),x._dirty){let L=await x.toObject();await s.write(E,L),O.stats.set(E,await s.lstat(E)),x._dirty=!1}}),k}},c(Es,"Mc"),Es);h(Ge,"GitIndexManager");var me=Ge;function Je(p){let s=Math.max(p.lastIndexOf("/"),p.lastIndexOf("\\"));return s>-1&&(p=p.slice(s+1)),p}c(Je,"Ya"),h(Je,"basename");function He(p){let s=Math.max(p.lastIndexOf("/"),p.lastIndexOf("\\"));return s===-1?".":s===0?"/":p.slice(0,s)}c(He,"pi"),h(He,"dirname");function it(p){let s=new Map,u=h(function(w){if(!s.has(w)){let _={type:"tree",fullpath:w,basename:Je(w),metadata:{},children:[]};s.set(w,_),_.parent=u(He(w)),_.parent&&_.parent!==_&&_.parent.children.push(_)}return s.get(w)},"mkdir"),d=h(function(w,_){if(!s.has(w)){let E={type:"blob",fullpath:w,basename:Je(w),metadata:_,parent:u(He(w)),children:[]};E.parent&&E.parent.children.push(E),s.set(w,E)}return s.get(w)},"mkfile");u(".");for(let w of p)d(w.path,w);return s}c(it,"Bw"),h(it,"flatFileListToDirectoryStructure");function Ke(p){switch(p){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new T(`Unexpected GitTree entry mode: ${p.toString(8)}`)}c(Ke,"I1"),h(Ke,"mode2type");var ve=(Fs=class{constructor({fs:s,gitdir:u,cache:d}){var E;var w;this.treePromise=me.acquire({fs:s,gitdir:u,cache:d},async function(k){return it(k.entries)});let _=this;this.ConstructEntry=(w=(E=class{constructor(I){this._fullpath=I,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return _.type(this)}async mode(){return _.mode(this)}async stat(){return _.stat(this)}async content(){return _.content(this)}async oid(){return _.oid(this)}},c(E,"a"),E),h(w,"StageEntry"),w)}async readdir(s){let u=s._fullpath,d=(await this.treePromise).get(u);if(!d||d.type==="blob")return null;if(d.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${u}'`);let w=d.children.map(_=>_.fullpath);return w.sort(C),w}async type(s){return s._type===!1&&await s.stat(),s._type}async mode(s){return s._mode===!1&&await s.stat(),s._mode}async stat(s){if(s._stat===!1){let u=(await this.treePromise).get(s._fullpath);if(!u)throw new Error(`ENOENT: no such file or directory, lstat '${s._fullpath}'`);let d=u.type==="tree"?{}:z(u.metadata);s._type=u.type==="tree"?"tree":Ke(d.mode),s._mode=d.mode,u.type==="tree"?s._stat=void 0:s._stat=d}return s._stat}async content(s){}async oid(s){if(s._oid===!1){let u=(await this.treePromise).get(s._fullpath);s._oid=u.metadata.oid}return s._oid}},c(Fs,"jc"),Fs);h(ve,"GitWalkerIndex");var ye=ve,Fe=Symbol("GitWalkSymbol");function G(){let p=Object.create(null);return Object.defineProperty(p,Fe,{value:h(function({fs:s,gitdir:u,cache:d}){return new ye({fs:s,gitdir:u,cache:d})},"value")}),Object.freeze(p),p}c(G,"Tr"),h(G,"STAGE");var te=(pn=class extends y{constructor(s){super(`Could not find ${s}.`),this.code=this.name=pn.code,this.data={what:s}}},c(pn,"co"),pn);h(te,"NotFoundError");var se=te;se.code="NotFoundError";var ke=(mn=class extends y{constructor(s,u,d,w){super(`Object ${s} ${w?`at ${w}`:""}was anticipated to be a ${d} but it is a ${u}.`),this.code=this.name=mn.code,this.data={oid:s,actual:u,expected:d,filepath:w}}},c(mn,"fo"),mn);h(ke,"ObjectTypeError");var _e=ke;_e.code="ObjectTypeError";var Pe=(gn=class extends y{constructor(s){super(`Expected a 40-char hex object id but saw "${s}".`),this.code=this.name=gn.code,this.data={value:s}}},c(gn,"uo"),gn);h(Pe,"InvalidOidError");var Q=Pe;Q.code="InvalidOidError";var ge=(yn=class extends y{constructor(s){super(`Could not find a fetch refspec for remote "${s}". Make sure the config file has an entry like the following:
16
+ [remote "${s}"]
16
17
  fetch = +refs/heads/*:refs/remotes/origin/*
17
- `),this.code=this.name=Jf.code,this.data={remote:e}}};l(Jf,"NoRefspecError");var qa=Jf;qa.code="NoRefspecError";var Kf=class Kf{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
18
- `).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new Kf(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
18
+ `),this.code=this.name=yn.code,this.data={remote:s}}},c(yn,"ho"),yn);h(ge,"NoRefspecError");var Ie=ge;Ie.code="NoRefspecError";var xe=(wn=class{constructor(s){if(this.refs=new Map,this.parsedConfig=[],s){let u=null;this.parsedConfig=s.trim().split(`
19
+ `).map(d=>{if(/^\s*#/.test(d))return{line:d,comment:!0};let w=d.indexOf(" ");if(d.startsWith("^")){let _=d.slice(1);return this.refs.set(u+"^{}",_),{line:d,ref:u,peeled:_}}else{let _=d.slice(0,w);return u=d.slice(w+1),this.refs.set(u,_),{line:d,ref:u,oid:_}}})}return this}static from(s){return new wn(s)}delete(s){this.parsedConfig=this.parsedConfig.filter(u=>u.ref!==s),this.refs.delete(s)}toString(){return this.parsedConfig.map(({line:s})=>s).join(`
19
20
  `)+`
20
- `}};l(Kf,"GitPackedRefs");var Df=Kf,Xf=class Xf{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),f=r==="+",c=n==="*";if(c!==(o==="*"))throw new z("Invalid refspec");return new Xf({remotePath:i,localPath:s,force:f,matchPrefix:c})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}};l(Xf,"GitRefSpec");var Cf=Xf,Yf=class Yf{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Cf.from(i));return new Yf(r)}add(e){let r=Cf.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};l(Yf,"GitRefSpecSet");var vw=Yf;function pL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}l(pL,"compareRefNames");function mL(t,e){let r="",i=0,n=-1,s=0,o="\0";for(let f=0;f<=t.length;++f){if(f<t.length)o=t[f];else{if(o==="/")break;o="/"}if(o==="/"){if(!(n===f-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let c=r.lastIndexOf("/");c===-1?(r="",i=0):(r=r.slice(0,c),i=r.length-1-r.lastIndexOf("/")),n=f,s=0;continue}else if(r.length!==0){r="",i=0,n=f,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,f):r=t.slice(n+1,f),i=f-n-1;n=f,s=0}else o==="."&&s!==-1?++s:s=-1}return r}l(mL,"normalizeString");function wL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=mL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}l(wL,"normalize");function C(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":wL(e)}l(C,"join");var yL=l(t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},"num"),$a=l(t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},"bool"),kT={core:{filemode:$a,bare:$a,logallrefupdates:$a,symlinks:$a,ignorecase:$a,bigFileThreshold:yL}},gL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,bL=/^[A-Za-z0-9-.]+$/,_L=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,SL=/^[A-Za-z][A-Za-z-]*$/,vL=/^(.*?)( *[#;].*)$/,EL=l(t=>{let e=gL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},"extractSectionLine"),FL=l(t=>{let e=_L.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=TL(i),s=kL(n);return[r,s]}return null},"extractVariableLine"),TL=l(t=>{let e=vL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return RT(r)&&RT(i)?`${r}${i}`:r},"removeComments"),RT=l(t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),kL=l(t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",o=r==="\\"&&n[i+1]==='"';return s||o?e:e+r},""),"removeQuotes"),OT=l(t=>t!=null?t.toLowerCase():null,"lower"),Ew=l((t,e,r)=>[OT(t),e,OT(r)].filter(i=>i!=null).join("."),"getPath"),xT=l(t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Ew(r,n,i),sectionPath:Ew(r,n,null),isSection:!!r}},"normalizePath"),RL=l((t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),"findLastIndex"),Zf=class Zf{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
21
- `).map(n=>{let s=null,o=null,f=n.trim(),c=EL(f),a=c!=null;if(a)[r,i]=c;else{let h=FL(f);h!=null&&([s,o]=h)}let u=Ew(r,i,s);return{line:n,isSection:a,section:r,subsection:i,name:s,value:o,path:u}}):[]}static from(e){return new Zf(e)}async get(e,r=!1){let i=xT(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:o,value:f})=>{let c=kT[s]&&kT[s][o];return c?c(f):f});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:o,path:f,sectionPath:c,isSection:a}=xT(e),u=RL(this.parsedConfig,h=>h.path===f);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let h=this.parsedConfig[u],d=Object.assign({},h,{name:o,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let h=this.parsedConfig.findIndex(p=>p.path===c),d={section:n,subsection:s,name:o,value:r,modified:!0,path:f};if(bL.test(n)&&SL.test(o))if(h>=0)this.parsedConfig.splice(h+1,0,d);else{let p={isSection:a,section:n,subsection:s,modified:!0,path:c};this.parsedConfig.push(p,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:o=!1})=>o?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
22
- `)}};l(Zf,"GitConfig");var Fw=Zf,Uw=class Uw{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Fw.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}};l(Uw,"GitConfigManager");var Se=Uw,xf=l(t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],"refpaths"),OL=["config","description","index","shallow","commondir"],uw;async function si(t,e){return uw===void 0&&(uw=new Ma),uw.acquire(t,e)}l(si,"acquireLock");var Oe=class Oe{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:o,refspecs:f=void 0,prune:c=!1,pruneTags:a=!1}){for(let y of n.values())if(!y.match(/[0-9a-f]{40}/))throw new ci(y);let u=await Se.get({fs:e,gitdir:r});if(!f){if(f=await u.getall(`remote.${i}.fetch`),f.length===0)throw new qa(i);f.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let h=vw.from(f),d=new Map;if(a){let y=await Oe.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await Oe.deleteRefs({fs:e,gitdir:r,refs:y.map(b=>`refs/tags/${b}`)})}if(o){for(let y of n.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await Oe.exists({fs:e,gitdir:r,ref:y})){let b=n.get(y);d.set(y,b)}}let p=h.translate([...n.keys()]);for(let[y,b]of p){let _=n.get(y);d.set(b,_)}let m=h.translate([...s.keys()]);for(let[y,b]of m){let _=s.get(y),F=h.translateOne(_);F&&d.set(b,`ref: ${F}`)}let w=[];if(c){for(let y of h.localNamespaces()){let b=(await Oe.listRefs({fs:e,gitdir:r,filepath:y})).map(_=>`${y}/${_}`);for(let _ of b)d.has(_)||w.push(_)}w.length>0&&await Oe.deleteRefs({fs:e,gitdir:r,refs:w})}for(let[y,b]of d)await si(y,async()=>e.write(C(r,y),`${b.trim()}
23
- `,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new ci(n);await si(i,async()=>e.write(C(r,i),`${n.trim()}
24
- `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await si(i,async()=>e.write(C(r,i),`ref: ${n.trim()}
25
- `,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return Oe.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(f=>e.rm(C(r,f))));let n=await si("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Df.from(n),o=s.refs.size;for(let f of i)s.refs.has(f)&&s.delete(f);s.refs.size<o&&(n=s.toString(),await si("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),Oe.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await Oe.packedRefs({fs:e,gitdir:r}),o=xf(i).filter(f=>!OL.includes(f));for(let f of o){let c=await si(f,async()=>await e.read(`${r}/${f}`,{encoding:"utf8"})||s.get(f));if(c)return Oe.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n})}throw new le(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await Oe.expand({fs:e,gitdir:r,ref:i}),!0}catch{return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await Oe.packedRefs({fs:e,gitdir:r}),s=xf(i);for(let o of s)if(await si(o,async()=>e.exists(`${r}/${o}`))||n.has(o))return o;throw new le(i)}static async expandAgainstMap({ref:e,map:r}){let i=xf(e);for(let n of i)if(await r.has(n))return n;throw new le(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),Oe.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=xf(e);for(let o of s){let f=n.get(o);if(f)return Oe.resolveAgainstMap({ref:f.trim(),fullref:o,depth:i,map:n})}throw new le(e)}static async packedRefs({fs:e,gitdir:r}){let i=await si("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Df.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=Oe.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(o=>o.replace(`${r}/${i}/`,""))}catch{s=[]}for(let o of(await n).keys())o.startsWith(i)&&(o=o.replace(i+"/",""),s.includes(o)||s.push(o));return s.sort(pL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?Oe.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):Oe.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await Oe.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};l(Oe,"GitRefManager");var $=Oe;function xL(t,e){return ku(AT(t),AT(e))}l(xL,"compareTreeEntryPath");function AT(t){return t.mode==="040000"?t.path+"/":t.path}l(AT,"appendSlashIfDir");function ZT(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new z(`Unexpected GitTree entry mode: ${t}`)}l(ZT,"mode2type$1");function AL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new z(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new z(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let o=ZT(s),f=t.slice(i+1,n).toString("utf8");if(f.includes("\\")||f.includes("/"))throw new qs(f);let c=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:f,oid:c,type:o})}return e}l(AL,"parseBuffer");function PL(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new z(`Could not understand file mode: ${t}`)}l(PL,"limitModeToAllowed");function NL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=PL(t.mode),t.type||(t.type=ZT(t.mode)),t}l(NL,"nudgeIntoShape");var Qf=class Qf{constructor(e){if(Buffer.isBuffer(e))this._entries=AL(e);else if(Array.isArray(e))this._entries=e.map(NL);else throw new z("invalid type passed to GitTree constructor");this._entries.sort(JT)}static from(e){return new Qf(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
26
- `)}toObject(){let e=[...this._entries];return e.sort(xL),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),o=Buffer.from([0]),f=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,o,f])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}};l(Qf,"GitTree");var pt=Qf,Ww=class Ww{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,o=new Uint8Array(s);for(let f=0;f<n;f++)o[f]=i.charCodeAt(f);return o.set(r,n),o}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),o=e.length-(i+1);if(parseInt(s)!==o)throw new z(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};l(Ww,"GitObject");var li=Ww;async function QT({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}l(QT,"readObjectLoose");function DL(t,e){let r=new $t(t),i=PT(r);if(i!==e.byteLength)throw new z(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=PT(r),s,o=DT(r,e);if(o.byteLength===n)s=o;else{s=Buffer.alloc(n);let f=new $t(s);for(f.copy(o);!r.eof();)f.copy(DT(r,e));let c=f.tell();if(n!==c)throw new z(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${c} bytes`)}return s}l(DL,"applyDelta");function PT(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}l(PT,"readVarIntLE");function NT(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}l(NT,"readCompactLE");function DT(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let o=NT(t,r&n,4),f=NT(t,(r&s)>>4,3);return f===0&&(f=65536),e.slice(o,o+f)}else return t.slice(r)}l(DT,"readOp");function CL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(CL,"fromValue");function e1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:CL(t)}l(e1,"getIterator");var zw=class zw{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=e1(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>IL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};l(zw,"StreamReader");var If=zw;function IL(t){return t.reduce((e,r)=>e+r.length,0)}l(IL,"lengthBuffers");async function $L(t,e){let r=new If(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new z(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new z(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let o=r.tell(),{type:f,length:c,ofs:a,reference:u}=await BL(r),h=new Nw.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new z(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==c)throw new z("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-h.strm.avail_in);let p=r.tell();await e({data:h.result,type:f,num:s,offset:o,end:p,reference:u,ofs:a})}}}}l($L,"listpack");async function BL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let o=4;do e=await t.byte(),i|=(e&127)<<o,o+=7;while(e&128)}let n,s;if(r===6){let o=0;n=0;let f=[];do e=await t.byte(),n|=(e&127)<<o,o+=7,f.push(e);while(e&128);s=Buffer.from(f)}return r===7&&(s=await t.read(20)),{type:r,length:i,ofs:n,reference:s}}l(BL,"parseHeader");var hw=!1;async function t1(t){return hw===null&&(hw=LL()),hw?ML(t):Nw.inflate(t)}l(t1,"inflate");async function ML(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(ML,"browserInflate");function LL(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}l(LL,"testDecompressionStream");function jL(t){let e=[],r=0,i=0;do{r=t.readUInt8();let n=r&127;e.push(n),i=r&128}while(i);return e.reduce((n,s)=>n+1<<7|s,-1)}l(jL,"decodeVarInt");function qL(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<<i,i+=7;while(n&128);return r}l(qL,"otherVarIntDecode");var Ba=class Ba{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new $t(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new z(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new z("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);let o=i.readUInt32BE(),f=[];for(let u=0;u<o;u++){let h=i.slice(20).toString("hex");f[u]=h}i.seek(i.tell()+4*o);let c=new Map;for(let u=0;u<o;u++)c.set(f[u],i.readUInt32BE());let a=i.slice(20).toString("hex");return new Ba({hashes:f,crcs:{},offsets:c,packfileSha:a,getExternalRefDelta:r})}static async fromPack({pack:e,getExternalRefDelta:r,onProgress:i}){let n={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},o=e.slice(-20).toString("hex"),f=[],c={},a=new Map,u=null,h=null;await $L([e],async({data:y,type:b,reference:_,offset:F,num:E})=>{u===null&&(u=E);let R=Math.floor((u-E)*100/u);R!==h&&i&&await i({phase:"Receiving objects",loaded:u-E,total:u}),h=R,b=n[b],["commit","tree","blob","tag"].includes(b)?s[F]={type:b,offset:F}:b==="ofs-delta"?s[F]={type:b,offset:F}:b==="ref-delta"&&(s[F]={type:b,offset:F})});let d=Object.keys(s).map(Number);for(let[y,b]of d.entries()){let _=y+1===d.length?e.byteLength-20:d[y+1],F=s[b],E=rL.buf(e.slice(b,_))>>>0;F.end=_,F.crc=E}let p=new Ba({pack:Promise.resolve(e),packfileSha:o,crcs:c,hashes:f,offsets:a,getExternalRefDelta:r});h=null;let m=0,w=[0,0,0,0,0,0,0,0,0,0,0,0];for(let y in s){y=Number(y);let b=Math.floor(m*100/u);b!==h&&i&&await i({phase:"Resolving deltas",loaded:m,total:u}),m++,h=b;let _=s[y];if(!_.oid)try{p.readDepth=0,p.externalReadDepth=0;let{type:F,object:E}=await p.readSlice({start:y});w[p.readDepth]+=1;let R=await Mr(li.wrap({type:F,object:E}));_.oid=R,f.push(R),a.set(R,y),c[R]=_.crc}catch{continue}}return f.sort(),p}async toBuffer(){let e=[],r=l((a,u)=>{e.push(Buffer.from(a,u))},"write");r("ff744f63","hex"),r("00000002","hex");let i=new $t(Buffer.alloc(256*4));for(let a=0;a<256;a++){let u=0;for(let h of this.hashes)parseInt(h.slice(0,2),16)<=a&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let a of this.hashes)r(a,"hex");let n=new $t(Buffer.alloc(this.hashes.length*4));for(let a of this.hashes)n.writeUInt32BE(this.crcs[a]);e.push(n.buffer);let s=new $t(Buffer.alloc(this.hashes.length*4));for(let a of this.hashes)s.writeUInt32BE(this.offsets.get(a));e.push(s.buffer),r(this.packfileSha,"hex");let o=Buffer.concat(e),f=await Mr(o),c=Buffer.alloc(20);return c.write(f,"hex"),Buffer.concat([o,c])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new z(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new z("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new $t(i),s=n.readUInt8(),o=s&112,f=r[o];if(f===void 0)throw new z("Unrecognized type: 0b"+o.toString(2));let c=s&15,a=c;s&128&&(a=qL(n,c));let h=null,d=null;if(f==="ofs_delta"){let m=jL(n),w=e-m;({object:h,type:f}=await this.readSlice({start:w}))}if(f==="ref_delta"){let m=n.slice(20).toString("hex");({object:h,type:f}=await this.read({oid:m}))}let p=i.slice(n.tell());if(d=Buffer.from(await t1(p)),d.byteLength!==a)throw new z(`Packfile told us object would have length ${a} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(DL(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:d}),{type:f,format:"content",object:d}}};l(Ba,"GitPackIndex");var Ua=Ba,Af=Symbol("PackfileCache");async function UL({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return Ua.fromIdx({idx:s,getExternalRefDelta:r})}l(UL,"loadPackIndex");function Dw({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[Af]||(e[Af]=new Map);let o=e[Af].get(r);return o||(o=UL({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[Af].set(r,o)),o}l(Dw,"readPackIndex");async function WL({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let o=await t.readdir(C(r,"objects/pack"));o=o.filter(f=>f.endsWith(".idx"));for(let f of o){let c=`${r}/objects/pack/${f}`,a=await Dw({fs:t,cache:e,filename:c,getExternalRefDelta:s});if(a.error)throw new z(a.error);if(a.offsets.has(i)){if(!a.pack){let h=c.replace(/idx$/,"pack");a.pack=t.read(h)}let u=await a.read({oid:i,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${f.replace(/idx$/,"pack")}`,u}}return null}l(WL,"readObjectPacked");async function he({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(u=>he({fs:t,cache:e,gitdir:r,oid:u}),"getExternalRefDelta"),o;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:Buffer.from("tree 0\0")}),o||(o=await QT({fs:t,gitdir:r,oid:i})),!o){if(o=await WL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!o)throw new le(i);return o}if(n==="deflated"||(o.format==="deflated"&&(o.object=Buffer.from(await t1(o.object)),o.format="wrapped"),n==="wrapped"))return o;let f=await Mr(o.object);if(f!==i)throw new z(`SHA check failed! Expected ${i}, computed ${f}`);let{object:c,type:a}=li.unwrap(o.object);if(o.type=a,o.object=c,o.format="content",n==="content")return o;throw new z(`invalid requested format "${n}"`)}l(he,"_readObject");var eu=class eu extends ee{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=eu.code,this.data={noun:e,where:r,canForce:i}}};l(eu,"AlreadyExistsError");var Yt=eu;Yt.code="AlreadyExistsError";var tu=class tu extends ee{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=tu.code,this.data={nouns:e,short:r,matches:i}}};l(tu,"AmbiguousError");var Wa=tu;Wa.code="AmbiguousError";var ru=class ru extends ee{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=ru.code,this.data={filepaths:e}}};l(ru,"CheckoutConflictError");var za=ru;za.code="CheckoutConflictError";var iu=class iu extends ee{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=iu.code,this.data={ref:e,oid:r}}};l(iu,"CommitNotFetchedError");var Ha=iu;Ha.code="CommitNotFetchedError";var nu=class nu extends ee{constructor(){super("Empty response from git server."),this.code=this.name=nu.code,this.data={}}};l(nu,"EmptyServerResponseError");var Va=nu;Va.code="EmptyServerResponseError";var su=class su extends ee{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=su.code,this.data={}}};l(su,"FastForwardError");var Ga=su;Ga.code="FastForwardError";var ou=class ou extends ee{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=ou.code,this.data={prettyDetails:e,result:r}}};l(ou,"GitPushError");var Ja=ou;Ja.code="GitPushError";var au=class au extends ee{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=au.code,this.data={statusCode:e,statusMessage:r,response:i}}};l(au,"HttpError");var zs=au;zs.code="HttpError";var cu=class cu extends ee{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=cu.code,this.data={reason:e}}};l(cu,"InvalidFilepathError");var fi=cu;fi.code="InvalidFilepathError";var lu=class lu extends ee{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=lu.code,this.data={ref:e,suggestion:r}}};l(lu,"InvalidRefNameError");var Zt=lu;Zt.code="InvalidRefNameError";var fu=class fu extends ee{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=fu.code,this.data={depth:e}}};l(fu,"MaxDepthError");var Ka=fu;Ka.code="MaxDepthError";var uu=class uu extends ee{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=uu.code,this.data={}}};l(uu,"MergeNotSupportedError");var Hs=uu;Hs.code="MergeNotSupportedError";var hu=class hu extends ee{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=hu.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};l(hu,"MergeConflictError");var Vs=hu;Vs.code="MergeConflictError";var du=class du extends ee{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=du.code,this.data={role:e}}};l(du,"MissingNameError");var Ye=du;Ye.code="MissingNameError";var pu=class pu extends ee{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=pu.code,this.data={parameter:e}}};l(pu,"MissingParameterError");var dt=pu;dt.code="MissingParameterError";var mu=class mu extends ee{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=mu.code,this.data={errors:e},this.errors=e}};l(mu,"MultipleGitError");var Xa=mu;Xa.code="MultipleGitError";var wu=class wu extends ee{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=wu.code,this.data={expected:e,actual:r}}};l(wu,"ParseError");var Zi=wu;Zi.code="ParseError";var yu=class yu extends ee{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=yu.code,this.data={reason:e}}};l(yu,"PushRejectedError");var Gs=yu;Gs.code="PushRejectedError";var gu=class gu extends ee{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=gu.code,this.data={capability:e,parameter:r}}};l(gu,"RemoteCapabilityError");var ai=gu;ai.code="RemoteCapabilityError";var bu=class bu extends ee{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=bu.code,this.data={preview:e,response:r}}};l(bu,"SmartHttpError");var Ya=bu;Ya.code="SmartHttpError";var _u=class _u extends ee{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=_u.code,this.data={url:e,transport:r,suggestion:i}}};l(_u,"UnknownTransportError");var Za=_u;Za.code="UnknownTransportError";var Su=class Su extends ee{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=Su.code,this.data={url:e}}};l(Su,"UrlParseError");var Qa=Su;Qa.code="UrlParseError";var vu=class vu extends ee{constructor(){super("The operation was canceled."),this.code=this.name=vu.code,this.data={}}};l(vu,"UserCanceledError");var Js=vu;Js.code="UserCanceledError";var Eu=class Eu extends ee{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=Eu.code,this.data={filepath:e}}};l(Eu,"IndexResetError");var ec=Eu;ec.code="IndexResetError";var Fu=class Fu extends ee{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=Fu.code,this.data={ref:e}}};l(Fu,"NoCommitError");var tc=Fu;tc.code="NoCommitError";var r1=Object.freeze({__proto__:null,AlreadyExistsError:Yt,AmbiguousError:Wa,CheckoutConflictError:za,CommitNotFetchedError:Ha,EmptyServerResponseError:Va,FastForwardError:Ga,GitPushError:Ja,HttpError:zs,InternalError:z,InvalidFilepathError:fi,InvalidOidError:ci,InvalidRefNameError:Zt,MaxDepthError:Ka,MergeNotSupportedError:Hs,MergeConflictError:Vs,MissingNameError:Ye,MissingParameterError:dt,MultipleGitError:Xa,NoRefspecError:qa,NotFoundError:le,ObjectTypeError:ot,ParseError:Zi,PushRejectedError:Gs,RemoteCapabilityError:ai,SmartHttpError:Ya,UnknownTransportError:Za,UnsafeFilepathError:qs,UrlParseError:Qa,UserCanceledError:Js,UnmergedPathsError:ja,IndexResetError:ec,NoCommitError:tc});function Tw({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=zL(i),`${t} <${e}> ${r} ${i}`}l(Tw,"formatAuthor");function zL(t){let e=HL(VL(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}l(zL,"formatTimezoneOffset");function HL(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}l(HL,"simpleSign");function VL(t){return t===0?t:-t}l(VL,"negateExceptForZero");function Br(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
27
- `,t}l(Br,"normalizeNewlines");function $f(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:GL(n)}}l($f,"parseAuthor");function GL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),JL(i)}l(GL,"parseTimezoneOffset");function JL(t){return t===0?t:-t}l(JL,"negateExceptForZero$1");var Ms=class Ms{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=Ms.render(e);else throw new z("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new Ms(e)}static render(e){return`object ${e.object}
28
- type ${e.type}
29
- tag ${e.tag}
30
- tagger ${Tw(e.tagger)}
31
-
32
- ${e.message}
33
- ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
34
-
35
- `))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
36
-
37
- `)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
38
- `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
39
- `+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),o=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(o):i[s]=o}return i.tagger&&(i.tagger=$f(i.tagger)),i.committer&&(i.committer=$f(i.committer)),i}withoutSignature(){let e=Br(this._tag);return e.indexOf(`
40
- -----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
21
+ `}},c(wn,"po"),wn);h(xe,"GitPackedRefs");var Ye=xe,kt=(bn=class{constructor({remotePath:s,localPath:u,force:d,matchPrefix:w}){Object.assign(this,{remotePath:s,localPath:u,force:d,matchPrefix:w})}static from(s){let[u,d,w,_,E]=s.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),k=u==="+",I=w==="*";if(I!==(E==="*"))throw new T("Invalid refspec");return new bn({remotePath:d,localPath:_,force:k,matchPrefix:I})}translate(s){if(this.matchPrefix){if(s.startsWith(this.remotePath))return this.localPath+s.replace(this.remotePath,"")}else if(s===this.remotePath)return this.localPath;return null}reverseTranslate(s){if(this.matchPrefix){if(s.startsWith(this.localPath))return this.remotePath+s.replace(this.localPath,"")}else if(s===this.localPath)return this.remotePath;return null}},c(bn,"mo"),bn);h(kt,"GitRefSpec");var Gt=kt,gt=(_n=class{constructor(s=[]){this.rules=s}static from(s){let u=[];for(let d of s)u.push(Gt.from(d));return new _n(u)}add(s){let u=Gt.from(s);this.rules.push(u)}translate(s){let u=[];for(let d of this.rules)for(let w of s){let _=d.translate(w);_&&u.push([w,_])}return u}translateOne(s){let u=null;for(let d of this.rules){let w=d.translate(s);w&&(u=w)}return u}localNamespaces(){return this.rules.filter(s=>s.matchPrefix).map(s=>s.localPath.replace(/\/$/,""))}},c(_n,"wo"),_n);h(gt,"GitRefSpecSet");var _t=gt;function St(p,s){let u=p.replace(/\^\{\}$/,""),d=s.replace(/\^\{\}$/,""),w=-(u<d)||+(u>d);return w===0?p.endsWith("^{}")?1:-1:w}c(St,"B1"),h(St,"compareRefNames");function Pt(p,s){let u="",d=0,w=-1,_=0,E="\0";for(let k=0;k<=p.length;++k){if(k<p.length)E=p[k];else{if(E==="/")break;E="/"}if(E==="/"){if(!(w===k-1||_===1))if(_===2){if(u.length<2||d!==2||u.at(-1)!=="."||u.at(-2)!=="."){if(u.length>2){let I=u.lastIndexOf("/");I===-1?(u="",d=0):(u=u.slice(0,I),d=u.length-1-u.lastIndexOf("/")),w=k,_=0;continue}else if(u.length!==0){u="",d=0,w=k,_=0;continue}}s&&(u+=u.length>0?"/..":"..",d=2)}else u.length>0?u+="/"+p.slice(w+1,k):u=p.slice(w+1,k),d=k-w-1;w=k,_=0}else E==="."&&_!==-1?++_:_=-1}return u}c(Pt,"N1"),h(Pt,"normalizeString");function B(p){if(!p.length)return".";let s=p[0]==="/",u=p.at(-1)==="/";return p=Pt(p,!s),p.length?(u&&(p+="/"),s?`/${p}`:p):s?"/":u?"./":"."}c(B,"$1"),h(B,"normalize");function Y(...p){if(p.length===0)return".";let s;for(let u=0;u<p.length;++u){let d=p[u];d.length>0&&(s===void 0?s=d:s+="/"+d)}return s===void 0?".":B(s)}c(Y,"D"),h(Y,"join");var Ne=h(p=>{if(typeof p=="number")return p;p=p.toLowerCase();let s=parseInt(p);return p.endsWith("k")&&(s*=1024),p.endsWith("m")&&(s*=1024*1024),p.endsWith("g")&&(s*=1024*1024*1024),s},"num"),et=h(p=>{if(typeof p=="boolean")return p;if(p=p.trim().toLowerCase(),p==="true"||p==="yes"||p==="on")return!0;if(p==="false"||p==="no"||p==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${p}`)},"bool"),re={core:{filemode:et,bare:et,logallrefupdates:et,symlinks:et,ignorecase:et,bigFileThreshold:Ne}},be=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,A=/^[A-Za-z0-9-.]+$/,Ce=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,dt=/^[A-Za-z][A-Za-z-]*$/,v=/^(.*?)( *[#;].*)$/,ue=h(p=>{let s=be.exec(p);if(s!=null){let[u,d]=s.slice(1);return[u,d]}return null},"extractSectionLine"),de=h(p=>{let s=Ce.exec(p);if(s!=null){let[u,d="true"]=s.slice(1),w=N(d),_=fe(w);return[u,_]}return null},"extractVariableLine"),N=h(p=>{let s=v.exec(p);if(s==null)return p;let[u,d]=s.slice(1);return Z(u)&&Z(d)?`${u}${d}`:u},"removeComments"),Z=h(p=>(p.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),fe=h(p=>p.split("").reduce((s,u,d,w)=>{let _=u==='"'&&w[d-1]!=="\\",E=u==="\\"&&w[d+1]==='"';return _||E?s:s+u},""),"removeQuotes"),st=h(p=>p!=null?p.toLowerCase():null,"lower"),Xe=h((p,s,u)=>[st(p),s,st(u)].filter(d=>d!=null).join("."),"getPath"),D=h(p=>{let s=p.split("."),u=s.shift(),d=s.pop(),w=s.length?s.join("."):void 0;return{section:u,subsection:w,name:d,path:Xe(u,w,d),sectionPath:Xe(u,w,null),isSection:!!u}},"normalizePath"),W=h((p,s)=>p.reduce((u,d,w)=>s(d)?w:u,-1),"findLastIndex"),Me=(vn=class{constructor(s){let u=null,d=null;this.parsedConfig=s?s.split(`
22
+ `).map(w=>{let _=null,E=null,k=w.trim(),I=ue(k),O=I!=null;if(O)[u,d]=I;else{let L=de(k);L!=null&&([_,E]=L)}let x=Xe(u,d,_);return{line:w,isSection:O,section:u,subsection:d,name:_,value:E,path:x}}):[]}static from(s){return new vn(s)}async get(s,u=!1){let d=D(s).path,w=this.parsedConfig.filter(_=>_.path===d).map(({section:_,name:E,value:k})=>{let I=re[_]&&re[_][E];return I?I(k):k});return u?w:w.pop()}async getall(s){return this.get(s,!0)}async getSubsections(s){return this.parsedConfig.filter(u=>u.isSection&&u.section===s).map(u=>u.subsection)}async deleteSection(s,u){this.parsedConfig=this.parsedConfig.filter(d=>!(d.section===s&&d.subsection===u))}async append(s,u){return this.set(s,u,!0)}async set(s,u,d=!1){let{section:w,subsection:_,name:E,path:k,sectionPath:I,isSection:O}=D(s),x=W(this.parsedConfig,L=>L.path===k);if(u==null)x!==-1&&this.parsedConfig.splice(x,1);else if(x!==-1){let L=this.parsedConfig[x],q=Object.assign({},L,{name:E,value:u,modified:!0});d?this.parsedConfig.splice(x+1,0,q):this.parsedConfig[x]=q}else{let L=this.parsedConfig.findIndex(ae=>ae.path===I),q={section:w,subsection:_,name:E,value:u,modified:!0,path:k};if(A.test(w)&&dt.test(E))if(L>=0)this.parsedConfig.splice(L+1,0,q);else{let ae={isSection:O,section:w,subsection:_,modified:!0,path:I};this.parsedConfig.push(ae,q)}}}toString(){return this.parsedConfig.map(({line:s,section:u,subsection:d,name:w,value:_,modified:E=!1})=>E?w!=null&&_!=null?typeof _=="string"&&/[#;]/.test(_)?` ${w} = "${_}"`:` ${w} = ${_}`:d!=null?`[${u} "${d}"]`:`[${u}]`:s).join(`
23
+ `)}},c(vn,"go"),vn);h(Me,"GitConfig");var Le=Me,Ue=(ks=class{static async get({fs:s,gitdir:u}){let d=await s.read(`${u}/config`,{encoding:"utf8"});return Le.from(d)}static async save({fs:s,gitdir:u,config:d}){await s.write(`${u}/config`,d.toString(),{encoding:"utf8"})}},c(ks,"Hc"),ks);h(Ue,"GitConfigManager");var ut=Ue,vt=h(p=>[`${p}`,`refs/${p}`,`refs/tags/${p}`,`refs/heads/${p}`,`refs/remotes/${p}`,`refs/remotes/${p}/HEAD`],"refpaths"),Lt=["config","description","index","shallow","commondir"],Zr;async function fr(p,s){return Zr===void 0&&(Zr=new t),Zr.acquire(p,s)}c(fr,"Zt"),h(fr,"acquireLock");var Ct=(Ut=class{static async updateRemoteRefs({fs:s,gitdir:u,remote:d,refs:w,symrefs:_,tags:E,refspecs:k=void 0,prune:I=!1,pruneTags:O=!1}){for(let Be of w.values())if(!Be.match(/[0-9a-f]{40}/))throw new Q(Be);let x=await ut.get({fs:s,gitdir:u});if(!k){if(k=await x.getall(`remote.${d}.fetch`),k.length===0)throw new Ie(d);k.unshift(`+HEAD:refs/remotes/${d}/HEAD`)}let L=_t.from(k),q=new Map;if(O){let Be=await Ut.listRefs({fs:s,gitdir:u,filepath:"refs/tags"});await Ut.deleteRefs({fs:s,gitdir:u,refs:Be.map(qe=>`refs/tags/${qe}`)})}if(E){for(let Be of w.keys())if(Be.startsWith("refs/tags")&&!Be.endsWith("^{}")&&!await Ut.exists({fs:s,gitdir:u,ref:Be})){let qe=w.get(Be);q.set(Be,qe)}}let ae=L.translate([...w.keys()]);for(let[Be,qe]of ae){let We=w.get(Be);q.set(qe,We)}let ce=L.translate([..._.keys()]);for(let[Be,qe]of ce){let We=_.get(Be),Qe=L.translateOne(We);Qe&&q.set(qe,`ref: ${Qe}`)}let Re=[];if(I){for(let Be of L.localNamespaces()){let qe=(await Ut.listRefs({fs:s,gitdir:u,filepath:Be})).map(We=>`${Be}/${We}`);for(let We of qe)q.has(We)||Re.push(We)}Re.length>0&&await Ut.deleteRefs({fs:s,gitdir:u,refs:Re})}for(let[Be,qe]of q)await fr(Be,async()=>s.write(Y(u,Be),`${qe.trim()}
24
+ `,"utf8"));return{pruned:Re}}static async writeRef({fs:s,gitdir:u,ref:d,value:w}){if(!w.match(/[0-9a-f]{40}/))throw new Q(w);await fr(d,async()=>s.write(Y(u,d),`${w.trim()}
25
+ `,"utf8"))}static async writeSymbolicRef({fs:s,gitdir:u,ref:d,value:w}){await fr(d,async()=>s.write(Y(u,d),`ref: ${w.trim()}
26
+ `,"utf8"))}static async deleteRef({fs:s,gitdir:u,ref:d}){return Ut.deleteRefs({fs:s,gitdir:u,refs:[d]})}static async deleteRefs({fs:s,gitdir:u,refs:d}){await Promise.all(d.map(k=>s.rm(Y(u,k))));let w=await fr("packed-refs",async()=>s.read(`${u}/packed-refs`,{encoding:"utf8"})),_=Ye.from(w),E=_.refs.size;for(let k of d)_.refs.has(k)&&_.delete(k);_.refs.size<E&&(w=_.toString(),await fr("packed-refs",async()=>s.write(`${u}/packed-refs`,w,{encoding:"utf8"})))}static async resolve({fs:s,gitdir:u,ref:d,depth:w=void 0}){if(w!==void 0&&(w--,w===-1))return d;if(d.startsWith("ref: "))return d=d.slice(5),Ut.resolve({fs:s,gitdir:u,ref:d,depth:w});if(d.length===40&&/[0-9a-f]{40}/.test(d))return d;let _=await Ut.packedRefs({fs:s,gitdir:u}),E=vt(d).filter(k=>!Lt.includes(k));for(let k of E){let I=await fr(k,async()=>await s.read(`${u}/${k}`,{encoding:"utf8"})||_.get(k));if(I)return Ut.resolve({fs:s,gitdir:u,ref:I.trim(),depth:w})}throw new se(d)}static async exists({fs:s,gitdir:u,ref:d}){try{return await Ut.expand({fs:s,gitdir:u,ref:d}),!0}catch{return!1}}static async expand({fs:s,gitdir:u,ref:d}){if(d.length===40&&/[0-9a-f]{40}/.test(d))return d;let w=await Ut.packedRefs({fs:s,gitdir:u}),_=vt(d);for(let E of _)if(await fr(E,async()=>s.exists(`${u}/${E}`))||w.has(E))return E;throw new se(d)}static async expandAgainstMap({ref:s,map:u}){let d=vt(s);for(let w of d)if(await u.has(w))return w;throw new se(s)}static resolveAgainstMap({ref:s,fullref:u=s,depth:d=void 0,map:w}){if(d!==void 0&&(d--,d===-1))return{fullref:u,oid:s};if(s.startsWith("ref: "))return s=s.slice(5),Ut.resolveAgainstMap({ref:s,fullref:u,depth:d,map:w});if(s.length===40&&/[0-9a-f]{40}/.test(s))return{fullref:u,oid:s};let _=vt(s);for(let E of _){let k=w.get(E);if(k)return Ut.resolveAgainstMap({ref:k.trim(),fullref:E,depth:d,map:w})}throw new se(s)}static async packedRefs({fs:s,gitdir:u}){let d=await fr("packed-refs",async()=>s.read(`${u}/packed-refs`,{encoding:"utf8"}));return Ye.from(d).refs}static async listRefs({fs:s,gitdir:u,filepath:d}){let w=Ut.packedRefs({fs:s,gitdir:u}),_=null;try{_=await s.readdirDeep(`${u}/${d}`),_=_.map(E=>E.replace(`${u}/${d}/`,""))}catch{_=[]}for(let E of(await w).keys())E.startsWith(d)&&(E=E.replace(d+"/",""),_.includes(E)||_.push(E));return _.sort(St),_}static async listBranches({fs:s,gitdir:u,remote:d}){return d?Ut.listRefs({fs:s,gitdir:u,filepath:`refs/remotes/${d}`}):Ut.listRefs({fs:s,gitdir:u,filepath:"refs/heads"})}static async listTags({fs:s,gitdir:u}){return(await Ut.listRefs({fs:s,gitdir:u,filepath:"refs/tags"})).filter(d=>!d.endsWith("^{}"))}},c(Ut,"he"),Ut);h(Ct,"GitRefManager");var ze=Ct;function Mt(p,s){return C(sr(p),sr(s))}c(Mt,"Y1"),h(Mt,"compareTreeEntryPath");function sr(p){return p.mode==="040000"?p.path+"/":p.path}c(sr,"pw"),h(sr,"appendSlashIfDir");function Qt(p){switch(p){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new T(`Unexpected GitTree entry mode: ${p}`)}c(Qt,"Nw"),h(Qt,"mode2type$1");function Mr(p){let s=[],u=0;for(;u<p.length;){let d=p.indexOf(32,u);if(d===-1)throw new T(`GitTree: Error parsing buffer at byte location ${u}: Could not find the next space character.`);let w=p.indexOf(0,u);if(w===-1)throw new T(`GitTree: Error parsing buffer at byte location ${u}: Could not find the next null character.`);let _=p.slice(u,d).toString("utf8");_==="40000"&&(_="040000");let E=Qt(_),k=p.slice(d+1,w).toString("utf8");if(k.includes("\\")||k.includes("/"))throw new $(k);let I=p.slice(w+1,w+21).toString("hex");u=w+21,s.push({mode:_,path:k,oid:I,type:E})}return s}c(Mr,"X1"),h(Mr,"parseBuffer");function oi(p){if(typeof p=="number"&&(p=p.toString(8)),p.match(/^0?4.*/))return"040000";if(p.match(/^1006.*/))return"100644";if(p.match(/^1007.*/))return"100755";if(p.match(/^120.*/))return"120000";if(p.match(/^160.*/))return"160000";throw new T(`Could not understand file mode: ${p}`)}c(oi,"J1"),h(oi,"limitModeToAllowed");function $r(p){return!p.oid&&p.sha&&(p.oid=p.sha),p.mode=oi(p.mode),p.type||(p.type=Qt(p.mode)),p}c($r,"Q1"),h($r,"nudgeIntoShape");var cg=(Sn=class{constructor(s){if(Buffer.isBuffer(s))this._entries=Mr(s);else if(Array.isArray(s))this._entries=s.map($r);else throw new T("invalid type passed to GitTree constructor");this._entries.sort(U)}static from(s){return new Sn(s)}render(){return this._entries.map(s=>`${s.mode} ${s.type} ${s.oid} ${s.path}`).join(`
27
+ `)}toObject(){let s=[...this._entries];return s.sort(Mt),Buffer.concat(s.map(u=>{let d=Buffer.from(u.mode.replace(/^0/,"")),w=Buffer.from(" "),_=Buffer.from(u.path,"utf8"),E=Buffer.from([0]),k=Buffer.from(u.oid,"hex");return Buffer.concat([d,w,_,E,k])}))}entries(){return this._entries}*[Symbol.iterator](){for(let s of this._entries)yield s}},c(Sn,"yo"),Sn);h(cg,"GitTree");var Lr=cg,fg=(Rs=class{static wrap({type:s,object:u}){let d=`${s} ${u.length}\0`,w=d.length,_=w+u.length,E=new Uint8Array(_);for(let k=0;k<w;k++)E[k]=d.charCodeAt(k);return E.set(u,w),E}static unwrap(s){let u=s.indexOf(32),d=s.indexOf(0),w=s.slice(0,u).toString("utf8"),_=s.slice(u+1,d).toString("utf8"),E=s.length-(d+1);if(parseInt(_)!==E)throw new T(`Length mismatch: expected ${_} bytes but got ${E} instead.`);return{type:w,object:Buffer.from(s.slice(d+1))}}},c(Rs,"qc"),Rs);h(fg,"GitObject");var ds=fg;async function nh({fs:p,gitdir:s,oid:u}){let d=`objects/${u.slice(0,2)}/${u.slice(2)}`,w=await p.read(`${s}/${d}`);return w?{object:w,format:"deflated",source:d}:null}c(nh,"$w"),h(nh,"readObjectLoose");function hg(p,s){let u=new M(p),d=sh(u);if(d!==s.byteLength)throw new T(`applyDelta expected source buffer to be ${d} bytes but the provided buffer was ${s.length} bytes`);let w=sh(u),_,E=oh(u,s);if(E.byteLength===w)_=E;else{_=Buffer.alloc(w);let k=new M(_);for(k.copy(E);!u.eof();)k.copy(oh(u,s));let I=k.tell();if(w!==I)throw new T(`applyDelta expected target buffer to be ${w} bytes but the resulting buffer was ${I} bytes`)}return _}c(hg,"ek"),h(hg,"applyDelta");function sh(p){let s=0,u=0,d=null;do d=p.readUInt8(),s|=(d&127)<<u,u+=7;while(d&128);return s}c(sh,"mw"),h(sh,"readVarIntLE");function ah(p,s,u){let d=0,w=0;for(;u--;)s&1&&(d|=p.readUInt8()<<w),s>>=1,w+=8;return d}c(ah,"ww"),h(ah,"readCompactLE");function oh(p,s){let u=p.readUInt8(),d=128,w=15,_=112;if(u&d){let E=ah(p,u&w,4),k=ah(p,(u&_)>>4,3);return k===0&&(k=65536),s.slice(E,E+k)}else return p.slice(u)}c(oh,"gw"),h(oh,"readOp");function ug(p){let s=[p];return{next(){return Promise.resolve({done:s.length===0,value:s.pop()})},return(){return s=[],{}},[Symbol.asyncIterator](){return this}}}c(ug,"tk"),h(ug,"fromValue");function lh(p){return p[Symbol.asyncIterator]?p[Symbol.asyncIterator]():p[Symbol.iterator]?p[Symbol.iterator]():p.next?p:ug(p)}c(lh,"Lw"),h(lh,"getIterator");var dg=(Ts=class{constructor(s){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=lh(s),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(s){if(!this.eof())return this.started||await this._init(),this.cursor+s>this.buffer.length&&(this._trim(),await this._accumulate(s)),this._moveCursor(s),this.buffer.slice(this.undoCursor,this.cursor)}async skip(s){this.eof()||(this.started||await this._init(),this.cursor+s>this.buffer.length&&(this._trim(),await this._accumulate(s)),this._moveCursor(s))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:s,value:u}=await this.stream.next();return s&&(this._ended=!0,!u)?Buffer.alloc(0):(u&&(u=Buffer.from(u)),u)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(s){this.undoCursor=this.cursor,this.cursor+=s,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(s){if(this._ended)return;let u=[this.buffer];for(;this.cursor+s>mg(u);){let d=await this._next();if(this._ended)break;u.push(d)}this.buffer=Buffer.concat(u)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}},c(Ts,"Uc"),Ts);h(dg,"StreamReader");var pg=dg;function mg(p){return p.reduce((s,u)=>s+u.length,0)}c(mg,"rk"),h(mg,"lengthBuffers");async function gg(p,s){let u=new pg(p),d=await u.read(4);if(d=d.toString("utf8"),d!=="PACK")throw new T(`Invalid PACK header '${d}'`);let w=await u.read(4);if(w=w.readUInt32BE(0),w!==2)throw new T(`Invalid packfile version: ${w}`);let _=await u.read(4);if(_=_.readUInt32BE(0),!(_<1))for(;!u.eof()&&_--;){let E=u.tell(),{type:k,length:I,ofs:O,reference:x}=await yg(u),L=new o.Inflate;for(;!L.result;){let q=await u.chunk();if(!q)break;if(L.push(q,!1),L.err)throw new T(`Pako error: ${L.msg}`);if(L.result){if(L.result.length!==I)throw new T("Inflated object size is different from that stated in packfile.");await u.undo(),await u.read(q.length-L.strm.avail_in);let ae=u.tell();await s({data:L.result,type:k,num:_,offset:E,end:ae,reference:x,ofs:O})}}}}c(gg,"ik"),h(gg,"listpack");async function yg(p){let s=await p.byte(),u=s>>4&7,d=s&15;if(s&128){let E=4;do s=await p.byte(),d|=(s&127)<<E,E+=7;while(s&128)}let w,_;if(u===6){let E=0;w=0;let k=[];do s=await p.byte(),w|=(s&127)<<E,E+=7,k.push(s);while(s&128);_=Buffer.from(k)}return u===7&&(_=await p.read(20)),{type:u,length:d,ofs:w,reference:_}}c(yg,"nk"),h(yg,"parseHeader");var ch=!1;async function fh(p){return ch===null&&(ch=bg()),ch?wg(p):o.inflate(p)}c(fh,"Mw"),h(fh,"inflate");async function wg(p){let s=new DecompressionStream("deflate"),u=new Blob([p]).stream().pipeThrough(s);return new Uint8Array(await new Response(u).arrayBuffer())}c(wg,"ak"),h(wg,"browserInflate");function bg(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}c(bg,"ok"),h(bg,"testDecompressionStream");function _g(p){let s=[],u=0,d=0;do{u=p.readUInt8();let w=u&127;s.push(w),d=u&128}while(d);return s.reduce((w,_)=>w+1<<7|_,-1)}c(_g,"sk"),h(_g,"decodeVarInt");function vg(p,s){let u=s,d=4,w=null;do w=p.readUInt8(),u|=(w&127)<<d,d+=7;while(w&128);return u}c(vg,"lk"),h(vg,"otherVarIntDecode");var Sg=($i=class{constructor(s){Object.assign(this,s),this.offsetCache={}}static async fromIdx({idx:s,getExternalRefDelta:u}){let d=new M(s);if(d.slice(4).toString("hex")!=="ff744f63")return;let w=d.readUInt32BE();if(w!==2)throw new T(`Unable to read version ${w} packfile IDX. (Only version 2 supported)`);if(s.byteLength>2048*1024*1024)throw new T("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");d.seek(d.tell()+4*255);let _=d.readUInt32BE(),E=[];for(let O=0;O<_;O++){let x=d.slice(20).toString("hex");E[O]=x}d.seek(d.tell()+4*_);let k=new Map;for(let O=0;O<_;O++)k.set(E[O],d.readUInt32BE());let I=d.slice(20).toString("hex");return new $i({hashes:E,crcs:{},offsets:k,packfileSha:I,getExternalRefDelta:u})}static async fromPack({pack:s,getExternalRefDelta:u,onProgress:d}){let w={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},_={},E=s.slice(-20).toString("hex"),k=[],I={},O=new Map,x=null,L=null;await gg([s],async({data:Be,type:qe,reference:We,offset:Qe,num:at})=>{x===null&&(x=at);let ot=Math.floor((x-at)*100/x);ot!==L&&d&&await d({phase:"Receiving objects",loaded:x-at,total:x}),L=ot,qe=w[qe],["commit","tree","blob","tag"].includes(qe)?_[Qe]={type:qe,offset:Qe}:qe==="ofs-delta"?_[Qe]={type:qe,offset:Qe}:qe==="ref-delta"&&(_[Qe]={type:qe,offset:Qe})});let q=Object.keys(_).map(Number);for(let[Be,qe]of q.entries()){let We=Be+1===q.length?s.byteLength-20:q[Be+1],Qe=_[qe],at=n.buf(s.slice(qe,We))>>>0;Qe.end=We,Qe.crc=at}let ae=new $i({pack:Promise.resolve(s),packfileSha:E,crcs:I,hashes:k,offsets:O,getExternalRefDelta:u});L=null;let ce=0,Re=[0,0,0,0,0,0,0,0,0,0,0,0];for(let Be in _){Be=Number(Be);let qe=Math.floor(ce*100/x);qe!==L&&d&&await d({phase:"Resolving deltas",loaded:ce,total:x}),ce++,L=qe;let We=_[Be];if(!We.oid)try{ae.readDepth=0,ae.externalReadDepth=0;let{type:Qe,object:at}=await ae.readSlice({start:Be});Re[ae.readDepth]+=1;let ot=await j(ds.wrap({type:Qe,object:at}));We.oid=ot,k.push(ot),O.set(ot,Be),I[ot]=We.crc}catch{continue}}return k.sort(),ae}async toBuffer(){let s=[],u=h((O,x)=>{s.push(Buffer.from(O,x))},"write");u("ff744f63","hex"),u("00000002","hex");let d=new M(Buffer.alloc(256*4));for(let O=0;O<256;O++){let x=0;for(let L of this.hashes)parseInt(L.slice(0,2),16)<=O&&x++;d.writeUInt32BE(x)}s.push(d.buffer);for(let O of this.hashes)u(O,"hex");let w=new M(Buffer.alloc(this.hashes.length*4));for(let O of this.hashes)w.writeUInt32BE(this.crcs[O]);s.push(w.buffer);let _=new M(Buffer.alloc(this.hashes.length*4));for(let O of this.hashes)_.writeUInt32BE(this.offsets.get(O));s.push(_.buffer),u(this.packfileSha,"hex");let E=Buffer.concat(s),k=await j(E),I=Buffer.alloc(20);return I.write(k,"hex"),Buffer.concat([E,I])}async load({pack:s}){this.pack=s}async unload(){this.pack=null}async read({oid:s}){if(!this.offsets.get(s)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(s);throw new T(`Could not read object ${s} from packfile`)}let u=this.offsets.get(s);return this.readSlice({start:u})}async readSlice({start:s}){if(this.offsetCache[s])return Object.assign({},this.offsetCache[s]);this.readDepth++;let u={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new T("Tried to read from a GitPackIndex with no packfile loaded into memory");let d=(await this.pack).slice(s),w=new M(d),_=w.readUInt8(),E=_&112,k=u[E];if(k===void 0)throw new T("Unrecognized type: 0b"+E.toString(2));let I=_&15,O=I;_&128&&(O=vg(w,I));let x=null,L=null;if(k==="ofs_delta"){let ae=_g(w),ce=s-ae;({object:x,type:k}=await this.readSlice({start:ce}))}if(k==="ref_delta"){let ae=w.slice(20).toString("hex");({object:x,type:k}=await this.read({oid:ae}))}let q=d.slice(w.tell());if(L=Buffer.from(await fh(q)),L.byteLength!==O)throw new T(`Packfile told us object would have length ${O} but it had length ${L.byteLength}`);return x&&(L=Buffer.from(hg(L,x))),this.readDepth>3&&(this.offsetCache[s]={type:k,object:L}),{type:k,format:"content",object:L}}},c($i,"yn"),$i);h(Sg,"GitPackIndex");var hh=Sg,al=Symbol("PackfileCache");async function Eg({fs:p,filename:s,getExternalRefDelta:u,emitter:d,emitterPrefix:w}){let _=await p.read(s);return hh.fromIdx({idx:_,getExternalRefDelta:u})}c(Eg,"ck"),h(Eg,"loadPackIndex");function ol({fs:p,cache:s,filename:u,getExternalRefDelta:d,emitter:w,emitterPrefix:_}){s[al]||(s[al]=new Map);let E=s[al].get(u);return E||(E=Eg({fs:p,filename:u,getExternalRefDelta:d,emitter:w,emitterPrefix:_}),s[al].set(u,E)),E}c(ol,"Rc"),h(ol,"readPackIndex");async function Fg({fs:p,cache:s,gitdir:u,oid:d,format:w="content",getExternalRefDelta:_}){let E=await p.readdir(Y(u,"objects/pack"));E=E.filter(k=>k.endsWith(".idx"));for(let k of E){let I=`${u}/objects/pack/${k}`,O=await ol({fs:p,cache:s,filename:I,getExternalRefDelta:_});if(O.error)throw new T(O.error);if(O.offsets.has(d)){if(!O.pack){let L=I.replace(/idx$/,"pack");O.pack=p.read(L)}let x=await O.read({oid:d,getExternalRefDelta:_});return x.format="content",x.source=`objects/pack/${k.replace(/idx$/,"pack")}`,x}}return null}c(Fg,"fk"),h(Fg,"readObjectPacked");async function jt({fs:p,cache:s,gitdir:u,oid:d,format:w="content"}){let _=h(x=>jt({fs:p,cache:s,gitdir:u,oid:x}),"getExternalRefDelta"),E;if(d==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(E={format:"wrapped",object:Buffer.from("tree 0\0")}),E||(E=await nh({fs:p,gitdir:u,oid:d})),!E){if(E=await Fg({fs:p,cache:s,gitdir:u,oid:d,getExternalRefDelta:_}),!E)throw new se(d);return E}if(w==="deflated"||(E.format==="deflated"&&(E.object=Buffer.from(await fh(E.object)),E.format="wrapped"),w==="wrapped"))return E;let k=await j(E.object);if(k!==d)throw new T(`SHA check failed! Expected ${d}, computed ${k}`);let{object:I,type:O}=ds.unwrap(E.object);if(E.type=O,E.object=I,E.format="content",w==="content")return E;throw new T(`invalid requested format "${w}"`)}c(jt,"Q"),h(jt,"_readObject");var kg=(En=class extends y{constructor(s,u,d=!0){super(`Failed to create ${s} at ${u} because it already exists.${d?` (Hint: use 'force: true' parameter to overwrite existing ${s}.)`:""}`),this.code=this.name=En.code,this.data={noun:s,where:u,canForce:d}}},c(En,"bo"),En);h(kg,"AlreadyExistsError");var yi=kg;yi.code="AlreadyExistsError";var Rg=(Fn=class extends y{constructor(s,u,d){super(`Found multiple ${s} matching "${u}" (${d.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=Fn.code,this.data={nouns:s,short:u,matches:d}}},c(Fn,"_o"),Fn);h(Rg,"AmbiguousError");var uh=Rg;uh.code="AmbiguousError";var Tg=(kn=class extends y{constructor(s){super(`Your local changes to the following files would be overwritten by checkout: ${s.join(", ")}`),this.code=this.name=kn.code,this.data={filepaths:s}}},c(kn,"vo"),kn);h(Tg,"CheckoutConflictError");var dh=Tg;dh.code="CheckoutConflictError";var Og=(Rn=class extends y{constructor(s,u){super(`Failed to checkout "${s}" because commit ${u} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=Rn.code,this.data={ref:s,oid:u}}},c(Rn,"Fo"),Rn);h(Og,"CommitNotFetchedError");var ph=Og;ph.code="CommitNotFetchedError";var xg=(Tn=class extends y{constructor(){super("Empty response from git server."),this.code=this.name=Tn.code,this.data={}}},c(Tn,"So"),Tn);h(xg,"EmptyServerResponseError");var mh=xg;mh.code="EmptyServerResponseError";var Ag=(On=class extends y{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=On.code,this.data={}}},c(On,"Eo"),On);h(Ag,"FastForwardError");var gh=Ag;gh.code="FastForwardError";var Pg=(xn=class extends y{constructor(s,u){super(`One or more branches were not updated: ${s}`),this.code=this.name=xn.code,this.data={prettyDetails:s,result:u}}},c(xn,"ko"),xn);h(Pg,"GitPushError");var yh=Pg;yh.code="GitPushError";var Dg=(An=class extends y{constructor(s,u,d){super(`HTTP Error: ${s} ${u}`),this.code=this.name=An.code,this.data={statusCode:s,statusMessage:u,response:d}}},c(An,"xo"),An);h(Dg,"HttpError");var ll=Dg;ll.code="HttpError";var Ng=(Pn=class extends y{constructor(s){let u="invalid filepath";s==="leading-slash"||s==="trailing-slash"?u='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':s==="directory"&&(u='"filepath" should not be a directory.'),super(u),this.code=this.name=Pn.code,this.data={reason:s}}},c(Pn,"Po"),Pn);h(Ng,"InvalidFilepathError");var ps=Ng;ps.code="InvalidFilepathError";var Cg=(Dn=class extends y{constructor(s,u){super(`"${s}" would be an invalid git reference. (Hint: a valid alternative would be "${u}".)`),this.code=this.name=Dn.code,this.data={ref:s,suggestion:u}}},c(Dn,"To"),Dn);h(Cg,"InvalidRefNameError");var wi=Cg;wi.code="InvalidRefNameError";var Ig=(Nn=class extends y{constructor(s){super(`Maximum search depth of ${s} exceeded.`),this.code=this.name=Nn.code,this.data={depth:s}}},c(Nn,"Ao"),Nn);h(Ig,"MaxDepthError");var wh=Ig;wh.code="MaxDepthError";var Bg=(Cn=class extends y{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=Cn.code,this.data={}}},c(Cn,"Oo"),Cn);h(Bg,"MergeNotSupportedError");var cl=Bg;cl.code="MergeNotSupportedError";var jg=(In=class extends y{constructor(s,u,d,w){super(`Automatic merge failed with one or more merge conflicts in the following files: ${s.toString()}. Fix conflicts then commit the result.`),this.code=this.name=In.code,this.data={filepaths:s,bothModified:u,deleteByUs:d,deleteByTheirs:w}}},c(In,"Do"),In);h(jg,"MergeConflictError");var fl=jg;fl.code="MergeConflictError";var Mg=(Bn=class extends y{constructor(s){super(`No name was provided for ${s} in the argument or in the .git/config file.`),this.code=this.name=Bn.code,this.data={role:s}}},c(Bn,"Ro"),Bn);h(Mg,"MissingNameError");var Tr=Mg;Tr.code="MissingNameError";var $g=(jn=class extends y{constructor(s){super(`The function requires a "${s}" parameter but none was provided.`),this.code=this.name=jn.code,this.data={parameter:s}}},c(jn,"Co"),jn);h($g,"MissingParameterError");var Ur=$g;Ur.code="MissingParameterError";var Lg=(Mn=class extends y{constructor(s){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=Mn.code,this.data={errors:s},this.errors=s}},c(Mn,"Io"),Mn);h(Lg,"MultipleGitError");var bh=Lg;bh.code="MultipleGitError";var Ug=($n=class extends y{constructor(s,u){super(`Expected "${s}" but received "${u}".`),this.code=this.name=$n.code,this.data={expected:s,actual:u}}},c($n,"Bo"),$n);h(Ug,"ParseError");var ho=Ug;ho.code="ParseError";var Wg=(Ln=class extends y{constructor(s){let u="";s==="not-fast-forward"?u=" because it was not a simple fast-forward":s==="tag-exists"&&(u=" because tag already exists"),super(`Push rejected${u}. Use "force: true" to override.`),this.code=this.name=Ln.code,this.data={reason:s}}},c(Ln,"No"),Ln);h(Wg,"PushRejectedError");var hl=Wg;hl.code="PushRejectedError";var qg=(Un=class extends y{constructor(s,u){super(`Remote does not support the "${s}" so the "${u}" parameter cannot be used.`),this.code=this.name=Un.code,this.data={capability:s,parameter:u}}},c(Un,"$o"),Un);h(qg,"RemoteCapabilityError");var ms=qg;ms.code="RemoteCapabilityError";var zg=(Wn=class extends y{constructor(s,u){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${s}`),this.code=this.name=Wn.code,this.data={preview:s,response:u}}},c(Wn,"Lo"),Wn);h(zg,"SmartHttpError");var _h=zg;_h.code="SmartHttpError";var Hg=(qn=class extends y{constructor(s,u,d){super(`Git remote "${s}" uses an unrecognized transport protocol: "${u}"`),this.code=this.name=qn.code,this.data={url:s,transport:u,suggestion:d}}},c(qn,"Mo"),qn);h(Hg,"UnknownTransportError");var vh=Hg;vh.code="UnknownTransportError";var Gg=(zn=class extends y{constructor(s){super(`Cannot parse remote URL: "${s}"`),this.code=this.name=zn.code,this.data={url:s}}},c(zn,"jo"),zn);h(Gg,"UrlParseError");var Sh=Gg;Sh.code="UrlParseError";var Vg=(Hn=class extends y{constructor(){super("The operation was canceled."),this.code=this.name=Hn.code,this.data={}}},c(Hn,"Ho"),Hn);h(Vg,"UserCanceledError");var ul=Vg;ul.code="UserCanceledError";var Kg=(Gn=class extends y{constructor(s){super(`Could not merge index: Entry for '${s}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=Gn.code,this.data={filepath:s}}},c(Gn,"qo"),Gn);h(Kg,"IndexResetError");var Eh=Kg;Eh.code="IndexResetError";var Jg=(Vn=class extends y{constructor(s){super(`"${s}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=Vn.code,this.data={ref:s}}},c(Vn,"Uo"),Vn);h(Jg,"NoCommitError");var Fh=Jg;Fh.code="NoCommitError";var Yg=Object.freeze({__proto__:null,AlreadyExistsError:yi,AmbiguousError:uh,CheckoutConflictError:dh,CommitNotFetchedError:ph,EmptyServerResponseError:mh,FastForwardError:gh,GitPushError:yh,HttpError:ll,InternalError:T,InvalidFilepathError:ps,InvalidOidError:Q,InvalidRefNameError:wi,MaxDepthError:wh,MergeNotSupportedError:cl,MergeConflictError:fl,MissingNameError:Tr,MissingParameterError:Ur,MultipleGitError:bh,NoRefspecError:Ie,NotFoundError:se,ObjectTypeError:_e,ParseError:ho,PushRejectedError:hl,RemoteCapabilityError:ms,SmartHttpError:_h,UnknownTransportError:vh,UnsafeFilepathError:$,UrlParseError:Sh,UserCanceledError:ul,UnmergedPathsError:S,IndexResetError:Eh,NoCommitError:Fh});function dl({name:p,email:s,timestamp:u,timezoneOffset:d}){return d=Xg(d),`${p} <${s}> ${u} ${d}`}c(dl,"Ec"),h(dl,"formatAuthor");function Xg(p){let s=Qg(Zg(p));p=Math.abs(p);let u=Math.floor(p/60);p-=u*60;let d=String(u),w=String(p);return d.length<2&&(d="0"+d),w.length<2&&(w="0"+w),(s===-1?"-":"+")+d+w}c(Xg,"uk"),h(Xg,"formatTimezoneOffset");function Qg(p){return Math.sign(p)||(Object.is(p,-0)?-1:1)}c(Qg,"dk"),h(Qg,"simpleSign");function Zg(p){return p===0?p:-p}c(Zg,"hk"),h(Zg,"negateExceptForZero");function li(p){return p=p.replace(/\r/g,""),p=p.replace(/^\n+/,""),p=p.replace(/\n+$/,"")+`
28
+ `,p}c(li,"Bt"),h(li,"normalizeNewlines");function uo(p){let[,s,u,d,w]=p.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:s,email:u,timestamp:Number(d),timezoneOffset:ey(w)}}c(uo,"eo"),h(uo,"parseAuthor");function ey(p){let[,s,u,d]=p.match(/(\+|-)(\d\d)(\d\d)/);return d=(s==="+"?1:-1)*(Number(u)*60+Number(d)),ty(d)}c(ey,"pk"),h(ey,"parseTimezoneOffset");function ty(p){return p===0?p:-p}c(ty,"mk"),h(ty,"negateExceptForZero$1");var ry=(Si=class{constructor(s){if(typeof s=="string")this._tag=s;else if(Buffer.isBuffer(s))this._tag=s.toString("utf8");else if(typeof s=="object")this._tag=Si.render(s);else throw new T("invalid type passed to GitAnnotatedTag constructor")}static from(s){return new Si(s)}static render(s){return`object ${s.object}
29
+ type ${s.type}
30
+ tag ${s.tag}
31
+ tagger ${dl(s.tagger)}
32
+
33
+ ${s.message}
34
+ ${s.gpgsig?s.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
35
+
36
+ `))}message(){let s=this.withoutSignature();return s.slice(s.indexOf(`
37
+
38
+ `)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let s=this.justHeaders().split(`
39
+ `),u=[];for(let w of s)w[0]===" "?u[u.length-1]+=`
40
+ `+w.slice(1):u.push(w);let d={};for(let w of u){let _=w.slice(0,w.indexOf(" ")),E=w.slice(w.indexOf(" ")+1);Array.isArray(d[_])?d[_].push(E):d[_]=E}return d.tagger&&(d.tagger=uo(d.tagger)),d.committer&&(d.committer=uo(d.committer)),d}withoutSignature(){let s=li(this._tag);return s.indexOf(`
41
+ -----BEGIN PGP SIGNATURE-----`)===-1?s:s.slice(0,s.lastIndexOf(`
41
42
  -----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
42
- -----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Br(e)}payload(){return this.withoutSignature()+`
43
- `}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Br(s);let o=n+s;return Ms.from(o)}};l(Ms,"GitAnnotatedTag");var Ft=Ms;function dw(t){return t.trim().split(`
44
- `).map(e=>" "+e).join(`
43
+ -----BEGIN PGP SIGNATURE-----`)===-1)return;let s=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return li(s)}payload(){return this.withoutSignature()+`
44
+ `}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(s,u,d){let w=s.payload(),{signature:_}=await u({payload:w,secretKey:d});_=li(_);let E=w+_;return Si.from(E)}},c(Si,"ci"),Si);h(ry,"GitAnnotatedTag");var ei=ry;function pl(p){return p.trim().split(`
45
+ `).map(s=>" "+s).join(`
45
46
  `)+`
46
- `}l(dw,"indent");function KL(t){return t.split(`
47
- `).map(e=>e.replace(/^ /,"")).join(`
48
- `)}l(KL,"outdent");var ht=class ht{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=ht.render(e);else throw new z("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=ht.justHeaders(e),n=ht.justMessage(e),s=Br(i+`
49
- gpgsig`+dw(r)+`
50
- `+n);return new ht(s)}static from(e){return new ht(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return ht.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Br(e.slice(e.indexOf(`
51
-
52
- `)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
53
-
54
- `))}parseHeaders(){let e=ht.justHeaders(this._commit).split(`
55
- `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
56
- `+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),o=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(o):i[s]=o}return i.author&&(i.author=$f(i.author)),i.committer&&(i.committer=$f(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
57
- `:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
58
- `,e.parent){if(e.parent.length===void 0)throw new z("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
59
- `}let i=e.author;r+=`author ${Tw(i)}
60
- `;let n=e.committer||e.author;return r+=`committer ${Tw(n)}
61
- `,e.gpgsig&&(r+="gpgsig"+dw(e.gpgsig)),r}static render(e){return ht.renderHeaders(e)+`
62
- `+Br(e.message)}render(){return this._commit}withoutSignature(){let e=Br(this._commit);if(e.indexOf(`
63
- gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
64
- gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
65
- `)+28);return Br(r+`
66
- `+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return KL(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=ht.justMessage(e._commit),{signature:o}=await r({payload:n,secretKey:i});o=Br(o);let c=ht.justHeaders(e._commit)+`
67
- gpgsig`+dw(o)+`
68
- `+s;return ht.from(c)}};l(ht,"GitCommit");var mt=ht;async function Ks({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:pt.from([]),oid:i};let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,Ks({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=mt.from(s).parse().tree,Ks({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new ot(i,n,"tree");return{tree:pt.from(s),oid:i}}l(Ks,"resolveTree");var Hw=class Hw{constructor({fs:e,gitdir:r,ref:i,cache:n}){var o;this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let f=new Map,c;try{c=await $.resolve({fs:e,gitdir:r,ref:i})}catch(u){u instanceof le&&(c="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let a=await Ks({fs:e,cache:this.cache,gitdir:r,oid:c});return a.type="tree",a.mode="40000",f.set(".",a),f})();let s=this;this.ConstructEntry=(o=class{constructor(c){this._fullpath=c,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},l(o,"TreeEntry"),o)}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,o=await this.mapPromise,f=o.get(r);if(!f)throw new Error(`No obj for ${r}`);let c=f.oid;if(!c)throw new Error(`No oid for obj ${JSON.stringify(f)}`);if(f.type!=="tree")return null;let{type:a,object:u}=await he({fs:i,cache:n,gitdir:s,oid:c});if(a!==f.type)throw new ot(c,a,f.type);let h=pt.from(u);for(let d of h)o.set(C(r,d.path),d);return h.entries().map(d=>C(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=KT(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,f=r.get(e._fullpath).oid,{type:c,object:a}=await he({fs:i,cache:n,gitdir:s,oid:f});c!=="blob"?e._content=void 0:e._content=new Uint8Array(a)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};l(Hw,"GitWalkerRepo");var kw=Hw;function Et({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Ru,{value:l(function({fs:r,gitdir:i,cache:n}){return new kw({fs:r,gitdir:i,ref:t,cache:n})},"value")}),Object.freeze(e),e}l(Et,"TREE");var Vw=class Vw{constructor({fs:e,dir:r,gitdir:i,cache:n}){var o;this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=(o=class{constructor(c){this._fullpath=c,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},l(o,"WorkdirEntry"),o)}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(C(n,r));return s===null?null:s.map(o=>C(r,o))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Us(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf"),f=await r.read(`${i}/${e._fullpath}`,{autocrlf:o});e._actualSize=f.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(f)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,o;await Ee.acquire({fs:i,gitdir:n,cache:s},async function(f){let c=f.entriesMap.get(e._fullpath),a=await e.stat(),h=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!c||Pf(a,c,h,d)){let p=await e.content();p===void 0?o=void 0:(o=await Mr(li.wrap({type:"blob",object:p})),c&&o===c.oid&&(!h||a.mode===c.mode)&&Pf(a,c,h,d)&&f.insert({filepath:e._fullpath,stats:a,oid:o}))}else o=c.oid}),e._oid=o}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await Se.get({fs:e,gitdir:r}),this.config)}};l(Vw,"GitWalkerFs");var Rw=Vw;function to(){let t=Object.create(null);return Object.defineProperty(t,Ru,{value:l(function({fs:e,dir:r,gitdir:i,cache:n}){return new Rw({fs:e,dir:r,gitdir:i,cache:n})},"value")}),Object.freeze(t),t}l(to,"WORKDIR");function XL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}l(XL,"arrayRange");var i1=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Gw=class Gw{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};l(Gw,"RunningMinimum");var Ow=Gw;function*YL(t){let e=new Ow,r,i=[],n=t.length;for(let s=0;s<n;s++)i[s]=t[s].next().value,i[s]!==void 0&&e.consider(i[s]);if(e.value!==null)for(;;){let s=[];r=e.value,e.reset();for(let o=0;o<n;o++)i[o]!==void 0&&i[o]===r?(s[o]=i[o],i[o]=t[o].next().value):s[o]=null,i[o]!==void 0&&e.consider(i[o]);if(yield s,e.value===null)return}}l(YL,"unionOfIterators");async function ui({fs:t,cache:e,dir:r,gitdir:i,trees:n,map:s=l(async(c,a)=>a,"map"),reduce:o=l(async(c,a)=>{let u=i1(a);return c!==void 0&&u.unshift(c),u},"reduce"),iterate:f=l((c,a)=>Promise.all([...a].map(c)),"iterate")}){let c=n.map(p=>p[Ru]({fs:t,dir:r,gitdir:i,cache:e})),a=new Array(c.length).fill("."),u=XL(0,c.length),h=l(async p=>{u.forEach(y=>{let b=p[y];p[y]=b&&new c[y].ConstructEntry(b)});let w=(await Promise.all(u.map(y=>{let b=p[y];return b?c[y].readdir(b):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:p,children:YL(w)}},"unionWalkerFromReaddir"),d=l(async p=>{let{entries:m,children:w}=await h(p),y=m.find(_=>_&&_._fullpath)._fullpath,b=await s(y,m);if(b!==null){let _=await f(d,w);return _=_.filter(F=>F!==void 0),o(b,_)}},"walk");return d(a)}l(ui,"_walk");async function xw(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=C(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?xw(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}l(xw,"rmRecursive");function ZL(t){return QL(t)&&CT(t.then)&&CT(t.catch)}l(ZL,"isPromiseLike");function QL(t){return t&&typeof t=="object"}l(QL,"isObject");function CT(t){return typeof t=="function"}l(CT,"isFunction");function IT(t){return ZL(l(r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}},"test")(t))}l(IT,"isPromiseFs");var $T=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function BT(t,e){if(IT(e))for(let r of $T)t[`_${r}`]=e[r].bind(e);else for(let r of $T)t[`_${r}`]=aw(e[r].bind(e));IT(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=xw.bind(null,t):e.rm?t._rm=aw(e.rm.bind(e)):e.rmdir.length>2?t._rm=aw(e.rmdir.bind(e)):t._rm=xw.bind(null,t)}l(BT,"bindFs");var Jw=class Jw{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?BT(this,e.promises):BT(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,`
69
- `),i=new TextEncoder().encode(i)}catch{}return typeof i!="string"&&(i=Buffer.from(i)),i}catch{return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch{await this.mkdir(Ws(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Ws(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(ku),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};l(Jw,"FileSystem");var L=Jw;function k(t,e){if(e===void 0)throw new dt(t)}l(k,"assertParameter");async function Bf(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}l(Bf,"modified");async function n1({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i="HEAD",cache:n={}}){try{k("fs",t),k("dir",e),k("gitdir",r);let s=new L(t),o=[Et({ref:i}),to(),tn()],f=[];await Ee.acquire({fs:s,gitdir:r,cache:n},async function(a){f=a.unmergedPaths});let c=await ui({fs:s,cache:n,dir:e,gitdir:r,trees:o,map:l(async function(a,[u,h,d]){let p=!await Bf(h,d),m=f.includes(a),w=!await Bf(d,u);if(p||m)return u?{path:a,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(w)return!1;throw new ec(a)},"map")});await Ee.acquire({fs:s,gitdir:r,cache:n},async function(a){for(let u of c)if(u!==!1){if(!u){await s.rmdir(`${e}/${u.path}`,{recursive:!0}),a.delete({filepath:u.path});continue}if(u.type==="blob"){let h=new TextDecoder().decode(u.content);await s.write(`${e}/${u.path}`,h,{mode:u.mode}),a.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}l(n1,"abortMerge");var Kw=class Kw{static async isIgnored({fs:e,dir:r,gitdir:i=C(r,".git"),filepath:n}){if(Nf(n)===".git")return!0;if(n===".")return!1;let s="",o=C(i,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let f=[{gitignore:C(r,".gitignore"),filepath:n}],c=n.split("/").filter(Boolean);for(let u=1;u<c.length;u++){let h=c.slice(0,u).join("/"),d=c.slice(u).join("/");f.push({gitignore:C(r,h,".gitignore"),filepath:d})}let a=!1;for(let u of f){let h;try{h=await e.read(u.gitignore,"utf8")}catch(m){if(m.code==="NOENT")continue}let d=iL().add(s);d.add(h);let p=Ws(u.filepath);if(p!=="."&&d.ignores(p))return!0;a?a=!d.test(u.filepath).unignored:a=d.test(u.filepath).ignored}return a}};l(Kw,"GitIgnoreManager");var hi=Kw;async function ej({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new z("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,o=`${e}/${s}`;await t.exists(o)||await t.write(o,r)}l(ej,"writeObjectLoose");var pw=null;async function s1(t){return pw===null&&(pw=rj()),pw?tj(t):Nw.deflate(t)}l(s1,"deflate");async function tj(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(tj,"browserDeflate");function rj(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}l(rj,"testCompressionStream");async function wt({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:o=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=li.wrap({type:r,object:i})),s=await Mr(i),i=Buffer.from(await s1(i))),o||await ej({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}l(wt,"_writeObject");function o1(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}l(o1,"posixifyPathBuffer");async function a1({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:o=!0}){try{k("fs",t),k("dir",e),k("gitdir",r),k("filepath",i);let f=new L(t);await Ee.acquire({fs:f,gitdir:r,cache:n},async c=>{let u=await(await Se.get({fs:f,gitdir:r})).get("core.autocrlf");return Aw({dir:e,gitdir:r,fs:f,filepath:i,index:c,force:s,parallel:o,autocrlf:u})})}catch(f){throw f.caller="git.add",f}}l(a1,"add");async function Aw({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:o,autocrlf:f}){i=Array.isArray(i)?i:[i];let c=i.map(async d=>{if(!s&&await hi.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(C(t,d));if(!p)throw new le(d);if(p.isDirectory()){let m=await r.readdir(C(t,d));if(o){let w=m.map(y=>Aw({dir:t,gitdir:e,fs:r,filepath:[C(d,y)],index:n,force:s,parallel:o,autocrlf:f}));await Promise.all(w)}else for(let w of m)await Aw({dir:t,gitdir:e,fs:r,filepath:[C(d,w)],index:n,force:s,parallel:o,autocrlf:f})}else{let m=p.isSymbolicLink()?await r.readlink(C(t,d)).then(o1):await r.read(C(t,d),{autocrlf:f});if(m===null)throw new le(d);let w=await wt({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:p,oid:w})}}),a=await Promise.allSettled(c),u=a.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new Xa(u);if(u.length===1)throw u[0];return a.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}l(Aw,"addToIndex");async function rc({fs:t,gitdir:e,path:r}){return(await Se.get({fs:t,gitdir:e})).get(r)}l(rc,"_getConfig");function c1(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}l(c1,"assignDefined");async function di({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await rc({fs:t,gitdir:e,path:"user.name"}),email:await rc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},o=c1({},s,i?i.author:void 0,r);if(o.name!==void 0)return o}l(di,"normalizeAuthorObject");async function Xs({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),o={name:await rc({fs:t,gitdir:e,path:"user.name"}),email:await rc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},f=c1({},o,n?n.committer:void 0,r,i);if(f.name!==void 0)return f}l(Xs,"normalizeCommitterObject");async function l1({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,l1({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new ot(i,n,"commit");return{commit:mt.from(s),oid:i}}l(l1,"resolveCommit");async function Ys({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await l1({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}l(Ys,"_readCommit");async function Ou({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:o,signingKey:f,amend:c=!1,dryRun:a=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p}){let m=!1;h||(h=await $.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,y;try{w=await $.resolve({fs:t,gitdir:i,ref:h}),y=await Ys({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(c&&m)throw new tc(h);let b=c?await di({fs:t,gitdir:i,author:s,commit:y.commit}):await di({fs:t,gitdir:i,author:s});if(!b)throw new Ye("author");let _=c?await Xs({fs:t,gitdir:i,author:b,committer:o,commit:y.commit}):await Xs({fs:t,gitdir:i,author:b,committer:o});if(!_)throw new Ye("committer");return Ee.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(F){let R=YT(F.entries).get(".");if(p||(p=await f1({fs:t,gitdir:i,inode:R,dryRun:a})),d?d=await Promise.all(d.map(O=>$.resolve({fs:t,gitdir:i,ref:O}))):c?d=y.commit.parent:d=w?[w]:[],!n)if(c)n=y.commit.message;else throw new dt("message");let D=mt.from({tree:p,parent:d,author:b,committer:_,message:n});f&&(D=await mt.sign(D,r,f));let S=await wt({fs:t,gitdir:i,type:"commit",object:D.toObject(),dryRun:a});return!u&&!a&&await $.writeRef({fs:t,gitdir:i,ref:h,value:S}),S})}l(Ou,"_commit");async function f1({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let c of n)c.type==="tree"&&(c.metadata.mode="040000",c.metadata.oid=await f1({fs:t,gitdir:e,inode:c,dryRun:i}));let s=n.map(c=>({mode:c.metadata.mode,path:c.basename,oid:c.metadata.oid,type:c.type})),o=pt.from(s);return await wt({fs:t,gitdir:e,type:"tree",object:o.toObject(),dryRun:i})}l(f1,"constructTree");async function nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new fi("leading-slash");if(n.endsWith("/"))throw new fi("trailing-slash");let s=i,o=await Ks({fs:t,cache:e,gitdir:r,oid:i}),f=o.tree;if(n==="")i=o.oid;else{let c=n.split("/");i=await u1({fs:t,cache:e,gitdir:r,tree:f,pathArray:c,oid:s,filepath:n})}return i}l(nc,"resolveFilepath");async function u1({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:o}){let f=n.shift();for(let c of i)if(c.path===f){if(n.length===0)return c.oid;{let{type:a,object:u}=await he({fs:t,cache:e,gitdir:r,oid:c.oid});if(a!=="tree")throw new ot(s,a,"tree",o);return i=pt.from(u),u1({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:o})}}throw new le(`file or directory found at "${s}:${o}"`)}l(u1,"_resolveFilepath");async function ro({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:o}=await Ks({fs:t,cache:e,gitdir:r,oid:i});return{oid:o,tree:s.entries()}}l(ro,"_readTree");async function sc({fs:t,gitdir:e,tree:r}){let i=pt.from(r).toObject();return await wt({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}l(sc,"_writeTree");async function ij({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:o,force:f,author:c,committer:a,signingKey:u}){let h;try{h=await $.resolve({gitdir:i,fs:t,ref:n})}catch(b){if(!(b instanceof le))throw b}let p=(await ro({fs:t,cache:e,gitdir:i,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(f)p=p.filter(b=>b.path!==s);else for(let b of p)if(b.path===s)throw new Yt("note",s);typeof o=="string"&&(o=Buffer.from(o,"utf8"));let m=await wt({fs:t,gitdir:i,type:"blob",object:o,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await sc({fs:t,gitdir:i,tree:p});return await Ou({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:w,parent:h&&[h],message:`Note added by 'isomorphic-git addNote'
70
- `,author:c,committer:a,signingKey:u})}l(ij,"_addNote");async function h1({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n="refs/notes/commits",oid:s,note:o,force:f,author:c,committer:a,signingKey:u,cache:h={}}){try{k("fs",t),k("gitdir",i),k("oid",s),k("note",o),u&&k("onSign",e);let d=new L(t),p=await di({fs:d,gitdir:i,author:c});if(!p)throw new Ye("author");let m=await Xs({fs:d,gitdir:i,author:p,committer:a});if(!m)throw new Ye("committer");return await ij({fs:new L(d),cache:h,onSign:e,gitdir:i,ref:n,oid:s,note:o,force:f,author:p,committer:m,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}l(h1,"addNote");var nj=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function ic(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!nj.test(t)&&(!!e||t.includes("/"))}l(ic,"isValidRef");async function d1({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!ic(r,!0))throw new Zt(r,La.clean(r));let s=await Se.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Yt("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Se.save({fs:t,gitdir:e,config:s})}l(d1,"_addRemote");async function p1({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i,url:n,force:s=!1}){try{return k("fs",t),k("gitdir",r),k("remote",i),k("url",n),await d1({fs:new L(t),gitdir:r,remote:i,url:n,force:s})}catch(o){throw o.caller="git.addRemote",o}}l(p1,"addRemote");async function sj({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:o=n,gpgsig:f,object:c,signingKey:a,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await $.exists({fs:t,gitdir:i,ref:n}))throw new Yt("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:c||"HEAD"}),{type:d}=await he({fs:t,cache:e,gitdir:i,oid:h}),p=Ft.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:o,gpgsig:f});a&&(p=await Ft.sign(p,r,a));let m=await wt({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}l(sj,"_annotatedTag");async function m1({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n,tagger:s,message:o=n,gpgsig:f,object:c,signingKey:a,force:u=!1,cache:h={}}){try{k("fs",t),k("gitdir",i),k("ref",n),a&&k("onSign",e);let d=new L(t),p=await di({fs:d,gitdir:i,author:s});if(!p)throw new Ye("tagger");return await sj({fs:d,cache:h,onSign:e,gitdir:i,ref:n,tagger:p,message:o,gpgsig:f,object:c,signingKey:a,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}l(m1,"annotatedTag");async function oj({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!ic(r,!0))throw new Zt(r,La.clean(r));let o=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:o}))throw new Yt("branch",r,!1);let f;try{f=await $.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch{}f&&await $.writeRef({fs:t,gitdir:e,ref:o,value:f}),n&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}l(oj,"_branch");async function w1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,object:n,checkout:s=!1,force:o=!1}){try{return k("fs",t),k("gitdir",r),k("ref",i),await oj({fs:new L(t),gitdir:r,ref:i,object:n,checkout:s,force:o})}catch(f){throw f.caller="git.branch",f}}l(w1,"branch");var y1=l((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function Cw({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:o,ref:f,filepaths:c,noCheckout:a,noUpdateHead:u,dryRun:h,force:d,track:p=!0,nonBlocking:m=!1,batchSize:w=100}){let y;if(i)try{y=await $.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{y="0000000000000000000000000000000000000000"}let b;try{b=await $.resolve({fs:t,gitdir:s,ref:f})}catch(_){if(f==="HEAD")throw _;let F=`${o}/${f}`;if(b=await $.resolve({fs:t,gitdir:s,ref:F}),p){let E=await Se.get({fs:t,gitdir:s});await E.set(`branch.${f}.remote`,o),await E.set(`branch.${f}.merge`,`refs/heads/${f}`),await Se.save({fs:t,gitdir:s,config:E})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${f}`,value:b})}if(!a){let _;try{_=await aj({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:f,force:d,filepaths:c})}catch(S){throw S instanceof le&&S.data.what===b?new Ha(f,b):S}let F=_.filter(([S])=>S==="conflict").map(([S,O])=>O);if(F.length>0)throw new za(F);let E=_.filter(([S])=>S==="error").map(([S,O])=>O);if(E.length>0)throw new z(E.join(", "));if(h){i&&await i({previousHead:y,newHead:b,type:c!=null&&c.length>0?"file":"branch"});return}let R=0,D=_.length;if(await Ee.acquire({fs:t,gitdir:s,cache:e},async function(S){await Promise.all(_.filter(([O])=>O==="delete"||O==="delete-index").map(async function([O,v]){let A=`${n}/${v}`;O==="delete"&&await t.rm(A),S.delete({filepath:v}),r&&await r({phase:"Updating workdir",loaded:++R,total:D})}))}),await Ee.acquire({fs:t,gitdir:s,cache:e},async function(S){for(let[O,v]of _)if(O==="rmdir"||O==="rmdir-index"){let A=`${n}/${v}`;try{O==="rmdir"&&await t.rmdir(A),S.delete({filepath:v}),r&&await r({phase:"Updating workdir",loaded:++R,total:D})}catch(x){if(x.code==="ENOTEMPTY")console.log(`Did not delete ${v} because directory is not empty`);else throw x}}}),await Promise.all(_.filter(([S])=>S==="mkdir"||S==="mkdir-index").map(async function([S,O]){let v=`${n}/${O}`;await t.mkdir(v),r&&await r({phase:"Updating workdir",loaded:++R,total:D})})),m){let S=_.filter(([v])=>v==="create"||v==="create-index"||v==="update"||v==="mkdir-index"),O=await MT("Update Working Dir",S.map(([v,A,x,I,M])=>()=>lj({fs:t,cache:e,gitdir:s,dir:n},[v,A,x,I,M])),r,w);await Ee.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await MT("Update Index",O.map(([A,x,I])=>()=>cj({index:v,fullpath:A,oid:x,stats:I})),r,w)})}else await Ee.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(S){await Promise.all(_.filter(([O])=>O==="create"||O==="create-index"||O==="update"||O==="mkdir-index").map(async function([O,v,A,x,I]){let M=`${n}/${v}`;try{if(O!=="create-index"&&O!=="mkdir-index"){let{object:Te}=await he({fs:t,cache:e,gitdir:s,oid:A});if(I&&await t.rm(M),x===33188)await t.write(M,Te);else if(x===33261)await t.write(M,Te,{mode:511});else if(x===40960)await t.writelink(M,Te);else throw new z(`Invalid mode 0o${x.toString(8)} detected in blob ${A}`)}let H=await t.lstat(M);x===33261&&(H.mode=493),O==="mkdir-index"&&(H.mode=57344),S.insert({filepath:v,stats:H,oid:A}),r&&await r({phase:"Updating workdir",loaded:++R,total:D})}catch(H){console.log(H)}}))});i&&await i({previousHead:y,newHead:b,type:c!=null&&c.length>0?"file":"branch"})}if(!u){let _=await $.expand({fs:t,gitdir:s,ref:f});_.startsWith("refs/heads")?await $.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:_}):await $.writeRef({fs:t,gitdir:s,ref:"HEAD",value:b})}}l(Cw,"_checkout");async function aj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:o,filepaths:f}){let c=0;return ui({fs:t,cache:e,dir:i,gitdir:n,trees:[Et({ref:s}),to(),tn()],map:l(async function(a,[u,h,d]){if(a===".")return;if(f&&!f.some(m=>y1(a,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++c}),[!!d,!!u,!!h].map(Number).join("")){case"000":return;case"001":return o&&f&&f.includes(a)?["delete",a]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",a];case"blob":return["create",a,await u.oid(),await u.mode()];case"commit":return["mkdir-index",a,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await h.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",a];case"blob-blob":return await u.oid()!==await h.oid()?o?["update",a,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",a]:await u.mode()!==await h.mode()?o?["update",a,await u.oid(),await u.mode(),!0]:["conflict",a]:["create-index",a,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",a];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",a];case"101":switch(await d.type()){case"tree":return["rmdir-index",a];case"blob":return await d.oid()!==await h.oid()?o?["delete",a]:["conflict",a]:["delete",a];case"commit":return["rmdir-index",a];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!o)return;if(h){if(await h.oid()!==await d.oid()&&await h.oid()!==await u.oid())return o?["update",a,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",a]}else if(o)return["update",a,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",a,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",a,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",a,await u.oid()];case"blob-tree":return["update-blob-to-tree",a];case"commit-commit":return["mkdir-index",a,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},"map"),reduce:l(async function(a,u){return u=i1(u),a?a&&a[0]==="rmdir"?(u.push(a),u):(u.unshift(a),u):u},"reduce")})}l(aj,"analyze");async function cj({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}l(cj,"updateIndex");async function lj({fs:t,cache:e,gitdir:r,dir:i},[n,s,o,f,c]){let a=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:h}=await he({fs:t,cache:e,gitdir:r,oid:o});if(c&&await t.rm(a),f===33188)await t.write(a,h);else if(f===33261)await t.write(a,h,{mode:511});else if(f===40960)await t.writelink(a,h);else throw new z(`Invalid mode 0o${f.toString(8)} detected in blob ${o}`)}let u=await t.lstat(a);return f===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,o,u]}l(lj,"updateWorkingDir");async function MT(t,e,r,i){let n=[];try{for(let s=0;s<e.length;s+=i){let o=e.slice(s,s+i).map(c=>c());(await Promise.allSettled(o)).forEach(c=>{c.status==="fulfilled"&&n.push(c.value)}),r&&await r({phase:"Updating workdir",loaded:s+o.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}l(MT,"batchAllSettled");async function Iw({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=C(i,".git"),remote:s="origin",ref:o,filepaths:f,noCheckout:c=!1,noUpdateHead:a=o===void 0,dryRun:u=!1,force:h=!1,track:d=!0,cache:p={},nonBlocking:m=!1,batchSize:w=100}){try{k("fs",t),k("dir",i),k("gitdir",n);let y=o||"HEAD";return await Cw({fs:new L(t),cache:p,onProgress:e,onPostCheckout:r,dir:i,gitdir:n,remote:s,ref:y,filepaths:f,noCheckout:c,noUpdateHead:a,dryRun:u,force:h,track:d,nonBlocking:m,batchSize:w})}catch(y){throw y.caller="git.checkout",y}}l(Iw,"checkout");var fj=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Yi(t){let e=fj.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}l(Yi,"abbreviateRef");async function mi({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await $.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await $.resolve({fs:t,gitdir:e,ref:n})}catch{return}if(n.startsWith("refs/"))return r?n:Yi(n)}l(mi,"_currentBranch");function uj(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}l(uj,"translateSSHtoHTTP");function g1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}l(g1,"calculateBasicAuthHeader");async function oc(t,e){let r=e1(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(oc,"forAwait");async function Mf(t){let e=0,r=[];await oc(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(Mf,"collect");function LT(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}l(LT,"extractAuthFromUrl");function Pw(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}l(Pw,"padHex");var Xw=class Xw{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let r=e.length+4,i=Pw(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new If(e);return l(async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s??!0}catch(n){return e.error=n,!0}},"read")}};l(Xw,"GitPktLine");var be=Xw;async function jT(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}l(jT,"parseCapabilitiesV2");async function qT(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=be.streamReader(t),o=await s();for(;o===null;)o=await s();if(o===!0)throw new Va;if(o.includes("version 2"))return jT(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Zi(`# service=${e}\\n`,o.toString("utf8"));let f=await s();for(;f===null;)f=await s();if(f===!0)return{capabilities:r,refs:i,symrefs:n};if(f=f.toString("utf8"),f.includes("version 2"))return jT(s);let[c,a]=mw(f,"\0","\\x00");if(a.split(" ").map(u=>r.add(u)),c!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,h]=mw(c," "," ");for(i.set(h,u);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=mw(d.toString("utf8")," "," ");i.set(m,p)}}}for(let u of r)if(u.startsWith("symref=")){let h=u.match(/symref=([^:]+):(.*)/);h.length===3&&n.set(h[1],h[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}l(qT,"parseRefsAdResponse");function mw(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Zi(`Two strings separated by '${r}'`,t.toString("utf8"));return i}l(mw,"splitAndAssert");var UT=l((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),WT=l((t,e)=>{(e.username||e.password)&&(t.Authorization=g1(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),ww=l(async t=>{try{let e=Buffer.from(await Mf(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),Yw=class Yw{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:o,service:f,url:c,headers:a,protocolVersion:u}){let{url:h,auth:d}=LT(c),p=o?UT(o,h):h;(d.username||d.password)&&(a.Authorization=g1(d)),u===2&&(a["Git-Protocol"]="version=2");let m,w,y=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${p}/info/refs?service=${f}`,headers:a}),w=!1,m.statusCode===401||m.statusCode===203){let b=y?s:i;if(b){if(d=await b(h,{...d,headers:{...a}}),d&&d.cancel)throw new Js;d&&(WT(a,d),y=!0,w=!0)}}else m.statusCode===200&&y&&n&&await n(h,d);while(w);if(m.statusCode!==200){let{response:b}=await ww(m);throw new zs(m.statusCode,m.statusMessage,b)}if(m.headers["content-type"]===`application/x-${f}-advertisement`){let b=await qT(m.body,{service:f});return b.auth=d,b}else{let{preview:b,response:_,data:F}=await ww(m);try{let E=await qT([F],{service:f});return E.auth=d,E}catch{throw new Ya(b,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:o,body:f,headers:c}){let a=LT(s);a&&(s=a.url),i&&(s=UT(i,s)),c["content-type"]=`application/x-${n}-request`,c.accept=`application/x-${n}-result`,WT(c,o);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:f,headers:c});if(u.statusCode!==200){let{response:h}=ww(u);throw new zs(u.statusCode,u.statusMessage,h)}return u}};l(Yw,"GitRemoteHTTP");var Zs=Yw,Zw=class Zw{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Zs),r.set("https",Zs);let i=hj({url:e});if(!i)throw new Qa(e);if(r.has(i.transport))return r.get(i.transport);throw new Za(e,i.transport,i.transport==="ssh"?uj(e):void 0)}};l(Zw,"GitRemoteManager");var Qs=Zw;function hj({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}l(hj,"parseRemoteUrl");var Xi=null,Qw=class Qw{static async read({fs:e,gitdir:r}){Xi===null&&(Xi=new Ma);let i=C(r,"shallow"),n=new Set;return await Xi.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
71
- `).map(o=>n.add(o))}),n}static async write({fs:e,gitdir:r,oids:i}){Xi===null&&(Xi=new Ma);let n=C(r,"shallow");if(i.size>0){let s=[...i].join(`
47
+ `}c(pl,"dc"),h(pl,"indent");function iy(p){return p.split(`
48
+ `).map(s=>s.replace(/^ /,"")).join(`
49
+ `)}c(iy,"wk"),h(iy,"outdent");var ny=(hr=class{constructor(s){if(typeof s=="string")this._commit=s;else if(Buffer.isBuffer(s))this._commit=s.toString("utf8");else if(typeof s=="object")this._commit=hr.render(s);else throw new T("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:s,signature:u}){let d=hr.justHeaders(s),w=hr.justMessage(s),_=li(d+`
50
+ gpgsig`+pl(u)+`
51
+ `+w);return new hr(_)}static from(s){return new hr(s)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return hr.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(s){return li(s.slice(s.indexOf(`
52
+
53
+ `)+2))}static justHeaders(s){return s.slice(0,s.indexOf(`
54
+
55
+ `))}parseHeaders(){let s=hr.justHeaders(this._commit).split(`
56
+ `),u=[];for(let w of s)w[0]===" "?u[u.length-1]+=`
57
+ `+w.slice(1):u.push(w);let d={parent:[]};for(let w of u){let _=w.slice(0,w.indexOf(" ")),E=w.slice(w.indexOf(" ")+1);Array.isArray(d[_])?d[_].push(E):d[_]=E}return d.author&&(d.author=uo(d.author)),d.committer&&(d.committer=uo(d.committer)),d}static renderHeaders(s){let u="";if(s.tree?u+=`tree ${s.tree}
58
+ `:u+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
59
+ `,s.parent){if(s.parent.length===void 0)throw new T("commit 'parent' property should be an array");for(let _ of s.parent)u+=`parent ${_}
60
+ `}let d=s.author;u+=`author ${dl(d)}
61
+ `;let w=s.committer||s.author;return u+=`committer ${dl(w)}
62
+ `,s.gpgsig&&(u+="gpgsig"+pl(s.gpgsig)),u}static render(s){return hr.renderHeaders(s)+`
63
+ `+li(s.message)}render(){return this._commit}withoutSignature(){let s=li(this._commit);if(s.indexOf(`
64
+ gpgsig`)===-1)return s;let u=s.slice(0,s.indexOf(`
65
+ gpgsig`)),d=s.slice(s.indexOf(`-----END PGP SIGNATURE-----
66
+ `)+28);return li(u+`
67
+ `+d)}isolateSignature(){let s=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return iy(s)}static async sign(s,u,d){let w=s.withoutSignature(),_=hr.justMessage(s._commit),{signature:E}=await u({payload:w,secretKey:d});E=li(E);let k=hr.justHeaders(s._commit)+`
68
+ gpgsig`+pl(E)+`
69
+ `+_;return hr.from(k)}},c(hr,"$e"),hr);h(ny,"GitCommit");var Wr=ny;async function rn({fs:p,cache:s,gitdir:u,oid:d}){if(d==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Lr.from([]),oid:d};let{type:w,object:_}=await jt({fs:p,cache:s,gitdir:u,oid:d});if(w==="tag")return d=ei.from(_).parse().object,rn({fs:p,cache:s,gitdir:u,oid:d});if(w==="commit")return d=Wr.from(_).parse().tree,rn({fs:p,cache:s,gitdir:u,oid:d});if(w!=="tree")throw new _e(d,w,"tree");return{tree:Lr.from(_),oid:d}}c(rn,"_i"),h(rn,"resolveTree");var sy=(Os=class{constructor({fs:s,gitdir:u,ref:d,cache:w}){var k;var _;this.fs=s,this.cache=w,this.gitdir=u,this.mapPromise=(async()=>{let I=new Map,O;try{O=await ze.resolve({fs:s,gitdir:u,ref:d})}catch(L){L instanceof se&&(O="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let x=await rn({fs:s,cache:this.cache,gitdir:u,oid:O});return x.type="tree",x.mode="40000",I.set(".",x),I})();let E=this;this.ConstructEntry=(_=(k=class{constructor(O){this._fullpath=O,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return E.type(this)}async mode(){return E.mode(this)}async stat(){return E.stat(this)}async content(){return E.content(this)}async oid(){return E.oid(this)}},c(k,"s"),k),h(_,"TreeEntry"),_)}async readdir(s){let u=s._fullpath,{fs:d,cache:w,gitdir:_}=this,E=await this.mapPromise,k=E.get(u);if(!k)throw new Error(`No obj for ${u}`);let I=k.oid;if(!I)throw new Error(`No oid for obj ${JSON.stringify(k)}`);if(k.type!=="tree")return null;let{type:O,object:x}=await jt({fs:d,cache:w,gitdir:_,oid:I});if(O!==k.type)throw new _e(I,O,k.type);let L=Lr.from(x);for(let q of L)E.set(Y(u,q.path),q);return L.entries().map(q=>Y(u,q.path))}async type(s){if(s._type===!1){let u=await this.mapPromise,{type:d}=u.get(s._fullpath);s._type=d}return s._type}async mode(s){if(s._mode===!1){let u=await this.mapPromise,{mode:d}=u.get(s._fullpath);s._mode=J(parseInt(d,8))}return s._mode}async stat(s){}async content(s){if(s._content===!1){let u=await this.mapPromise,{fs:d,cache:w,gitdir:_}=this,E=u.get(s._fullpath).oid,{type:k,object:I}=await jt({fs:d,cache:w,gitdir:_,oid:E});k!=="blob"?s._content=void 0:s._content=new Uint8Array(I)}return s._content}async oid(s){if(s._oid===!1){let u=(await this.mapPromise).get(s._fullpath);s._oid=u.oid}return s._oid}},c(Os,"zc"),Os);h(sy,"GitWalkerRepo");var hS=sy;function Or({ref:p="HEAD"}={}){let s=Object.create(null);return Object.defineProperty(s,Fe,{value:h(function({fs:u,gitdir:d,cache:w}){return new hS({fs:u,gitdir:d,ref:p,cache:w})},"value")}),Object.freeze(s),s}c(Or,"We"),h(Or,"TREE");var ay=(xs=class{constructor({fs:s,dir:u,gitdir:d,cache:w}){var k;var _;this.fs=s,this.cache=w,this.dir=u,this.gitdir=d,this.config=null;let E=this;this.ConstructEntry=(_=(k=class{constructor(O){this._fullpath=O,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return E.type(this)}async mode(){return E.mode(this)}async stat(){return E.stat(this)}async content(){return E.content(this)}async oid(){return E.oid(this)}},c(k,"s"),k),h(_,"WorkdirEntry"),_)}async readdir(s){let u=s._fullpath,{fs:d,dir:w}=this,_=await d.readdir(Y(w,u));return _===null?null:_.map(E=>Y(u,E))}async type(s){return s._type===!1&&await s.stat(),s._type}async mode(s){return s._mode===!1&&await s.stat(),s._mode}async stat(s){if(s._stat===!1){let{fs:u,dir:d}=this,w=await u.lstat(`${d}/${s._fullpath}`);if(!w)throw new Error(`ENOENT: no such file or directory, lstat '${s._fullpath}'`);let _=w.isDirectory()?"tree":"blob";_==="blob"&&!w.isFile()&&!w.isSymbolicLink()&&(_="special"),s._type=_,w=z(w),s._mode=w.mode,w.size===-1&&s._actualSize&&(w.size=s._actualSize),s._stat=w}return s._stat}async content(s){if(s._content===!1){let{fs:u,dir:d,gitdir:w}=this;if(await s.type()==="tree")s._content=void 0;else{let _=await(await this._getGitConfig(u,w)).get("core.autocrlf"),E=await u.read(`${d}/${s._fullpath}`,{autocrlf:_});s._actualSize=E.length,s._stat&&s._stat.size===-1&&(s._stat.size=s._actualSize),s._content=new Uint8Array(E)}}return s._content}async oid(s){if(s._oid===!1){let u=this,{fs:d,gitdir:w,cache:_}=this,E;await me.acquire({fs:d,gitdir:w,cache:_},async function(k){let I=k.entriesMap.get(s._fullpath),O=await s.stat(),x=await(await u._getGitConfig(d,w)).get("core.filemode"),L=typeof process<"u"?process.platform!=="win32":!0;if(!I||le(O,I,x,L)){let q=await s.content();q===void 0?E=void 0:(E=await j(ds.wrap({type:"blob",object:q})),I&&E===I.oid&&(!x||O.mode===I.mode)&&le(O,I,x,L)&&k.insert({filepath:s._fullpath,stats:O,oid:E}))}else E=I.oid}),s._oid=E}return s._oid}async _getGitConfig(s,u){return this.config?this.config:(this.config=await ut.get({fs:s,gitdir:u}),this.config)}},c(xs,"Wc"),xs);h(ay,"GitWalkerFs");var uS=ay;function nn(){let p=Object.create(null);return Object.defineProperty(p,Fe,{value:h(function({fs:s,dir:u,gitdir:d,cache:w}){return new uS({fs:s,dir:u,gitdir:d,cache:w})},"value")}),Object.freeze(p),p}c(nn,"xi"),h(nn,"WORKDIR");function oy(p,s){let u=s-p;return Array.from({length:u},(d,w)=>p+w)}c(oy,"gk"),h(oy,"arrayRange");var ly=typeof Array.prototype.flat>"u"?p=>p.reduce((s,u)=>s.concat(u),[]):p=>p.flat(),cy=(As=class{constructor(){this.value=null}consider(s){s!=null&&(this.value===null?this.value=s:s<this.value&&(this.value=s))}reset(){this.value=null}},c(As,"Vc"),As);h(cy,"RunningMinimum");var dS=cy;function*fy(p){let s=new dS,u,d=[],w=p.length;for(let _=0;_<w;_++)d[_]=p[_].next().value,d[_]!==void 0&&s.consider(d[_]);if(s.value!==null)for(;;){let _=[];u=s.value,s.reset();for(let E=0;E<w;E++)d[E]!==void 0&&d[E]===u?(_[E]=d[E],d[E]=p[E].next().value):_[E]=null,d[E]!==void 0&&s.consider(d[E]);if(yield _,s.value===null)return}}c(fy,"yk"),h(fy,"unionOfIterators");async function bi({fs:p,cache:s,dir:u,gitdir:d,trees:w,map:_=h(async(I,O)=>O,"map"),reduce:E=h(async(I,O)=>{let x=ly(O);return I!==void 0&&x.unshift(I),x},"reduce"),iterate:k=h((I,O)=>Promise.all([...O].map(I)),"iterate")}){let I=w.map(ae=>ae[Fe]({fs:p,dir:u,gitdir:d,cache:s})),O=new Array(I.length).fill("."),x=oy(0,I.length),L=h(async ae=>{x.forEach(Re=>{let Be=ae[Re];ae[Re]=Be&&new I[Re].ConstructEntry(Be)});let ce=(await Promise.all(x.map(Re=>{let Be=ae[Re];return Be?I[Re].readdir(Be):[]}))).map(Re=>(Re===null?[]:Re)[Symbol.iterator]());return{entries:ae,children:fy(ce)}},"unionWalkerFromReaddir"),q=h(async ae=>{let{entries:ce,children:Re}=await L(ae),Be=ce.find(We=>We&&We._fullpath)._fullpath,qe=await _(Be,ce);if(qe!==null){let We=await k(q,Re);return We=We.filter(Qe=>Qe!==void 0),E(qe,We)}},"walk");return q(O)}c(bi,"er"),h(bi,"_walk");async function ml(p,s){let u=await p.readdir(s);u==null?await p.rm(s):u.length?await Promise.all(u.map(d=>{let w=Y(s,d);return p.lstat(w).then(_=>{if(_)return _.isDirectory()?ml(p,w):p.rm(w)})})).then(()=>p.rmdir(s)):await p.rmdir(s)}c(ml,"Tc"),h(ml,"rmRecursive");function hy(p){return uy(p)&&kh(p.then)&&kh(p.catch)}c(hy,"bk"),h(hy,"isPromiseLike");function uy(p){return p&&typeof p=="object"}c(uy,"_k"),h(uy,"isObject");function kh(p){return typeof p=="function"}c(kh,"yw"),h(kh,"isFunction");function Rh(p){return hy(h(s=>{try{return s.readFile().catch(u=>u)}catch(u){return u}},"test")(p))}c(Rh,"bw"),h(Rh,"isPromiseFs");var dy=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Th(p,s){if(Rh(s))for(let u of dy)p[`_${u}`]=s[u].bind(s);else for(let u of dy)p[`_${u}`]=f(s[u].bind(s));Rh(s)?s.rm?p._rm=s.rm.bind(s):s.rmdir.length>1?p._rm=s.rmdir.bind(s):p._rm=ml.bind(null,p):s.rm?p._rm=f(s.rm.bind(s)):s.rmdir.length>2?p._rm=f(s.rmdir.bind(s)):p._rm=ml.bind(null,p)}c(Th,"vw"),h(Th,"bindFs");var py=(Ps=class{constructor(s){if(typeof s._original_unwrapped_fs<"u")return s;let u=Object.getOwnPropertyDescriptor(s,"promises");u&&u.enumerable?Th(this,s.promises):Th(this,s),this._original_unwrapped_fs=s}async exists(s,u={}){try{return await this._stat(s),!0}catch(d){if(d.code==="ENOENT"||d.code==="ENOTDIR"||(d.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',d),d}}async read(s,u={}){try{let d=await this._readFile(s,u);if(u.autocrlf==="true")try{d=new TextDecoder("utf8",{fatal:!0}).decode(d),d=d.replace(/\r\n/g,`
70
+ `),d=new TextEncoder().encode(d)}catch{}return typeof d!="string"&&(d=Buffer.from(d)),d}catch{return null}}async write(s,u,d={}){try{await this._writeFile(s,u,d)}catch{await this.mkdir(He(s)),await this._writeFile(s,u,d)}}async mkdir(s,u=!1){try{await this._mkdir(s)}catch(d){if(d===null||d.code==="EEXIST")return;if(u)throw d;if(d.code==="ENOENT"){let w=He(s);if(w==="."||w==="/"||w===s)throw d;await this.mkdir(w),await this.mkdir(s,!0)}}}async rm(s){try{await this._unlink(s)}catch(u){if(u.code!=="ENOENT")throw u}}async rmdir(s,u){try{u&&u.recursive?await this._rm(s,u):await this._rmdir(s)}catch(d){if(d.code!=="ENOENT")throw d}}async readdir(s){try{let u=await this._readdir(s);return u.sort(C),u}catch(u){return u.code==="ENOTDIR"?null:[]}}async readdirDeep(s){let u=await this._readdir(s);return(await Promise.all(u.map(async d=>{let w=s+"/"+d;return(await this._stat(w)).isDirectory()?this.readdirDeep(w):w}))).reduce((d,w)=>d.concat(w),[])}async lstat(s){try{return await this._lstat(s)}catch(u){if(u.code==="ENOENT"||(u.code||"").includes("ENS"))return null;throw u}}async readlink(s,u={encoding:"buffer"}){try{let d=await this._readlink(s,u);return Buffer.isBuffer(d)?d:Buffer.from(d)}catch(d){if(d.code==="ENOENT"||(d.code||"").includes("ENS"))return null;throw d}}async writelink(s,u){return this._symlink(u.toString("utf8"),s)}},c(Ps,"Gc"),Ps);h(py,"FileSystem");var ct=py;function ie(p,s){if(s===void 0)throw new Ur(p)}c(ie,"E"),h(ie,"assertParameter");async function po(p,s){return!p&&!s?!1:p&&!s||!p&&s?!0:!(await p.type()==="tree"&&await s.type()==="tree"||await p.type()===await s.type()&&await p.mode()===await s.mode()&&await p.oid()===await s.oid())}c(po,"to"),h(po,"modified");async function Oh({fs:p,dir:s,gitdir:u=Y(s,".git"),commit:d="HEAD",cache:w={}}){try{ie("fs",p),ie("dir",s),ie("gitdir",u);let _=new ct(p),E=[Or({ref:d}),nn(),G()],k=[];await me.acquire({fs:_,gitdir:u,cache:w},async function(O){k=O.unmergedPaths});let I=await bi({fs:_,cache:w,dir:s,gitdir:u,trees:E,map:h(async function(O,[x,L,q]){let ae=!await po(L,q),ce=k.includes(O),Re=!await po(q,x);if(ae||ce)return x?{path:O,mode:await x.mode(),oid:await x.oid(),type:await x.type(),content:await x.content()}:void 0;if(Re)return!1;throw new Eh(O)},"map")});await me.acquire({fs:_,gitdir:u,cache:w},async function(O){for(let x of I)if(x!==!1){if(!x){await _.rmdir(`${s}/${x.path}`,{recursive:!0}),O.delete({filepath:x.path});continue}if(x.type==="blob"){let L=new TextDecoder().decode(x.content);await _.write(`${s}/${x.path}`,L,{mode:x.mode}),O.insert({filepath:x.path,oid:x.oid,stage:0})}}})}catch(_){throw _.caller="git.abortMerge",_}}c(Oh,"qw"),h(Oh,"abortMerge");var my=(Ds=class{static async isIgnored({fs:s,dir:u,gitdir:d=Y(u,".git"),filepath:w}){if(Je(w)===".git")return!0;if(w===".")return!1;let _="",E=Y(d,"info","exclude");await s.exists(E)&&(_=await s.read(E,"utf8"));let k=[{gitignore:Y(u,".gitignore"),filepath:w}],I=w.split("/").filter(Boolean);for(let x=1;x<I.length;x++){let L=I.slice(0,x).join("/"),q=I.slice(x).join("/");k.push({gitignore:Y(u,L,".gitignore"),filepath:q})}let O=!1;for(let x of k){let L;try{L=await s.read(x.gitignore,"utf8")}catch(ce){if(ce.code==="NOENT")continue}let q=m().add(_);q.add(L);let ae=He(x.filepath);if(ae!=="."&&q.ignores(ae))return!0;O?O=!q.test(x.filepath).unignored:O=q.test(x.filepath).ignored}return O}},c(Ds,"Zc"),Ds);h(my,"GitIgnoreManager");var gs=my;async function gy({fs:p,gitdir:s,object:u,format:d,oid:w}){if(d!=="deflated")throw new T("GitObjectStoreLoose expects objects to write to be in deflated format");let _=`objects/${w.slice(0,2)}/${w.slice(2)}`,E=`${s}/${_}`;await p.exists(E)||await p.write(E,u)}c(gy,"vk"),h(gy,"writeObjectLoose");var xh=null;async function Ah(p){return xh===null&&(xh=wy()),xh?yy(p):o.deflate(p)}c(Ah,"Uw"),h(Ah,"deflate");async function yy(p){let s=new CompressionStream("deflate"),u=new Blob([p]).stream().pipeThrough(s);return new Uint8Array(await new Response(u).arrayBuffer())}c(yy,"Fk"),h(yy,"browserDeflate");function wy(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}c(wy,"Sk"),h(wy,"testCompressionStream");async function vr({fs:p,gitdir:s,type:u,object:d,format:w="content",oid:_=void 0,dryRun:E=!1}){return w!=="deflated"&&(w!=="wrapped"&&(d=ds.wrap({type:u,object:d})),_=await j(d),d=Buffer.from(await Ah(d))),E||await gy({fs:p,gitdir:s,object:d,format:"deflated",oid:_}),_}c(vr,"He"),h(vr,"_writeObject");function Ph(p){let s;for(;~(s=p.indexOf(92));)p[s]=47;return p}c(Ph,"zw"),h(Ph,"posixifyPathBuffer");async function Dh({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d,cache:w={},force:_=!1,parallel:E=!0}){try{ie("fs",p),ie("dir",s),ie("gitdir",u),ie("filepath",d);let k=new ct(p);await me.acquire({fs:k,gitdir:u,cache:w},async I=>{let O=await(await ut.get({fs:k,gitdir:u})).get("core.autocrlf");return gl({dir:s,gitdir:u,fs:k,filepath:d,index:I,force:_,parallel:E,autocrlf:O})})}catch(k){throw k.caller="git.add",k}}c(Dh,"Ww"),h(Dh,"add");async function gl({dir:p,gitdir:s,fs:u,filepath:d,index:w,force:_,parallel:E,autocrlf:k}){d=Array.isArray(d)?d:[d];let I=d.map(async L=>{if(!_&&await gs.isIgnored({fs:u,dir:p,gitdir:s,filepath:L}))return;let q=await u.lstat(Y(p,L));if(!q)throw new se(L);if(q.isDirectory()){let ae=await u.readdir(Y(p,L));if(E){let ce=ae.map(Re=>gl({dir:p,gitdir:s,fs:u,filepath:[Y(L,Re)],index:w,force:_,parallel:E,autocrlf:k}));await Promise.all(ce)}else for(let ce of ae)await gl({dir:p,gitdir:s,fs:u,filepath:[Y(L,ce)],index:w,force:_,parallel:E,autocrlf:k})}else{let ae=q.isSymbolicLink()?await u.readlink(Y(p,L)).then(Ph):await u.read(Y(p,L),{autocrlf:k});if(ae===null)throw new se(L);let ce=await vr({fs:u,gitdir:s,type:"blob",object:ae});w.insert({filepath:L,stats:q,oid:ce})}}),O=await Promise.allSettled(I),x=O.filter(L=>L.status==="rejected").map(L=>L.reason);if(x.length>1)throw new bh(x);if(x.length===1)throw x[0];return O.filter(L=>L.status==="fulfilled"&&L.value).map(L=>L.value)}c(gl,"Ac"),h(gl,"addToIndex");async function ys({fs:p,gitdir:s,path:u}){return(await ut.get({fs:p,gitdir:s})).get(u)}c(ys,"$n"),h(ys,"_getConfig");function Nh(p,...s){for(let u of s)if(u)for(let d of Object.keys(u)){let w=u[d];w!==void 0&&(p[d]=w)}return p}c(Nh,"Vw"),h(Nh,"assignDefined");async function _i({fs:p,gitdir:s,author:u,commit:d}){let w=Math.floor(Date.now()/1e3),_={name:await ys({fs:p,gitdir:s,path:"user.name"}),email:await ys({fs:p,gitdir:s,path:"user.email"})||"",timestamp:w,timezoneOffset:new Date(w*1e3).getTimezoneOffset()},E=Nh({},_,d?d.author:void 0,u);if(E.name!==void 0)return E}c(_i,"rr"),h(_i,"normalizeAuthorObject");async function sn({fs:p,gitdir:s,author:u,committer:d,commit:w}){let _=Math.floor(Date.now()/1e3),E={name:await ys({fs:p,gitdir:s,path:"user.name"}),email:await ys({fs:p,gitdir:s,path:"user.email"})||"",timestamp:_,timezoneOffset:new Date(_*1e3).getTimezoneOffset()},k=Nh({},E,w?w.committer:void 0,u,d);if(k.name!==void 0)return k}c(sn,"vi"),h(sn,"normalizeCommitterObject");async function Ch({fs:p,cache:s,gitdir:u,oid:d}){let{type:w,object:_}=await jt({fs:p,cache:s,gitdir:u,oid:d});if(w==="tag")return d=ei.from(_).parse().object,Ch({fs:p,cache:s,gitdir:u,oid:d});if(w!=="commit")throw new _e(d,w,"commit");return{commit:Wr.from(_),oid:d}}c(Ch,"Gw"),h(Ch,"resolveCommit");async function an({fs:p,cache:s,gitdir:u,oid:d}){let{commit:w,oid:_}=await Ch({fs:p,cache:s,gitdir:u,oid:d});return{oid:_,commit:w.parse(),payload:w.withoutSignature()}}c(an,"Fi"),h(an,"_readCommit");async function mo({fs:p,cache:s,onSign:u,gitdir:d,message:w,author:_,committer:E,signingKey:k,amend:I=!1,dryRun:O=!1,noUpdateBranch:x=!1,ref:L,parent:q,tree:ae}){let ce=!1;L||(L=await ze.resolve({fs:p,gitdir:d,ref:"HEAD",depth:2}));let Re,Be;try{Re=await ze.resolve({fs:p,gitdir:d,ref:L}),Be=await an({fs:p,gitdir:d,oid:Re,cache:{}})}catch{ce=!0}if(I&&ce)throw new Fh(L);let qe=I?await _i({fs:p,gitdir:d,author:_,commit:Be.commit}):await _i({fs:p,gitdir:d,author:_});if(!qe)throw new Tr("author");let We=I?await sn({fs:p,gitdir:d,author:qe,committer:E,commit:Be.commit}):await sn({fs:p,gitdir:d,author:qe,committer:E});if(!We)throw new Tr("committer");return me.acquire({fs:p,gitdir:d,cache:s,allowUnmerged:!1},async function(Qe){let at=it(Qe.entries).get(".");if(ae||(ae=await Ih({fs:p,gitdir:d,inode:at,dryRun:O})),q?q=await Promise.all(q.map(Ve=>ze.resolve({fs:p,gitdir:d,ref:Ve}))):I?q=Be.commit.parent:q=Re?[Re]:[],!w)if(I)w=Be.commit.message;else throw new Ur("message");let ot=Wr.from({tree:ae,parent:q,author:qe,committer:We,message:w});k&&(ot=await Wr.sign(ot,u,k));let nt=await vr({fs:p,gitdir:d,type:"commit",object:ot.toObject(),dryRun:O});return!x&&!O&&await ze.writeRef({fs:p,gitdir:d,ref:L,value:nt}),nt})}c(mo,"Go"),h(mo,"_commit");async function Ih({fs:p,gitdir:s,inode:u,dryRun:d}){let w=u.children;for(let k of w)k.type==="tree"&&(k.metadata.mode="040000",k.metadata.oid=await Ih({fs:p,gitdir:s,inode:k,dryRun:d}));let _=w.map(k=>({mode:k.metadata.mode,path:k.basename,oid:k.metadata.oid,type:k.type})),E=Lr.from(_);return await vr({fs:p,gitdir:s,type:"tree",object:E.toObject(),dryRun:d})}c(Ih,"Zw"),h(Ih,"constructTree");async function ws({fs:p,cache:s,gitdir:u,oid:d,filepath:w}){if(w.startsWith("/"))throw new ps("leading-slash");if(w.endsWith("/"))throw new ps("trailing-slash");let _=d,E=await rn({fs:p,cache:s,gitdir:u,oid:d}),k=E.tree;if(w==="")d=E.oid;else{let I=w.split("/");d=await Bh({fs:p,cache:s,gitdir:u,tree:k,pathArray:I,oid:_,filepath:w})}return d}c(ws,"Mn"),h(ws,"resolveFilepath");async function Bh({fs:p,cache:s,gitdir:u,tree:d,pathArray:w,oid:_,filepath:E}){let k=w.shift();for(let I of d)if(I.path===k){if(w.length===0)return I.oid;{let{type:O,object:x}=await jt({fs:p,cache:s,gitdir:u,oid:I.oid});if(O!=="tree")throw new _e(_,O,"tree",E);return d=Lr.from(x),Bh({fs:p,cache:s,gitdir:u,tree:d,pathArray:w,oid:_,filepath:E})}}throw new se(`file or directory found at "${_}:${E}"`)}c(Bh,"Kw"),h(Bh,"_resolveFilepath");async function on({fs:p,cache:s,gitdir:u,oid:d,filepath:w=void 0}){w!==void 0&&(d=await ws({fs:p,cache:s,gitdir:u,oid:d,filepath:w}));let{tree:_,oid:E}=await rn({fs:p,cache:s,gitdir:u,oid:d});return{oid:E,tree:_.entries()}}c(on,"Pi"),h(on,"_readTree");async function bs({fs:p,gitdir:s,tree:u}){let d=Lr.from(u).toObject();return await vr({fs:p,gitdir:s,type:"tree",object:d,format:"content"})}c(bs,"jn"),h(bs,"_writeTree");async function by({fs:p,cache:s,onSign:u,gitdir:d,ref:w,oid:_,note:E,force:k,author:I,committer:O,signingKey:x}){let L;try{L=await ze.resolve({gitdir:d,fs:p,ref:w})}catch(Re){if(!(Re instanceof se))throw Re}let q=(await on({fs:p,cache:s,gitdir:d,oid:L||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(k)q=q.filter(Re=>Re.path!==_);else for(let Re of q)if(Re.path===_)throw new yi("note",_);typeof E=="string"&&(E=Buffer.from(E,"utf8"));let ae=await vr({fs:p,gitdir:d,type:"blob",object:E,format:"content"});q.push({mode:"100644",path:_,oid:ae,type:"blob"});let ce=await bs({fs:p,gitdir:d,tree:q});return await mo({fs:p,cache:s,onSign:u,gitdir:d,ref:w,tree:ce,parent:L&&[L],message:`Note added by 'isomorphic-git addNote'
71
+ `,author:I,committer:O,signingKey:x})}c(by,"Ek"),h(by,"_addNote");async function jh({fs:p,onSign:s,dir:u,gitdir:d=Y(u,".git"),ref:w="refs/notes/commits",oid:_,note:E,force:k,author:I,committer:O,signingKey:x,cache:L={}}){try{ie("fs",p),ie("gitdir",d),ie("oid",_),ie("note",E),x&&ie("onSign",s);let q=new ct(p),ae=await _i({fs:q,gitdir:d,author:I});if(!ae)throw new Tr("author");let ce=await sn({fs:q,gitdir:d,author:ae,committer:O});if(!ce)throw new Tr("committer");return await by({fs:new ct(q),cache:L,onSign:s,gitdir:d,ref:w,oid:_,note:E,force:k,author:ae,committer:ce,signingKey:x})}catch(q){throw q.caller="git.addNote",q}}c(jh,"Yw"),h(jh,"addNote");var pS=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function _s(p,s){if(typeof p!="string")throw new TypeError("Reference name must be a string");return!pS.test(p)&&(!!s||p.includes("/"))}c(_s,"Ln"),h(_s,"isValidRef");async function Mh({fs:p,gitdir:s,remote:u,url:d,force:w}){if(!_s(u,!0))throw new wi(u,l.clean(u));let _=await ut.get({fs:p,gitdir:s});if(!w&&(await _.getSubsections("remote")).includes(u)&&d!==await _.get(`remote.${u}.url`))throw new yi("remote",u);await _.set(`remote.${u}.url`,d),await _.set(`remote.${u}.fetch`,`+refs/heads/*:refs/remotes/${u}/*`),await ut.save({fs:p,gitdir:s,config:_})}c(Mh,"Xw"),h(Mh,"_addRemote");async function $h({fs:p,dir:s,gitdir:u=Y(s,".git"),remote:d,url:w,force:_=!1}){try{return ie("fs",p),ie("gitdir",u),ie("remote",d),ie("url",w),await Mh({fs:new ct(p),gitdir:u,remote:d,url:w,force:_})}catch(E){throw E.caller="git.addRemote",E}}c($h,"Jw"),h($h,"addRemote");async function _y({fs:p,cache:s,onSign:u,gitdir:d,ref:w,tagger:_,message:E=w,gpgsig:k,object:I,signingKey:O,force:x=!1}){if(w=w.startsWith("refs/tags/")?w:`refs/tags/${w}`,!x&&await ze.exists({fs:p,gitdir:d,ref:w}))throw new yi("tag",w);let L=await ze.resolve({fs:p,gitdir:d,ref:I||"HEAD"}),{type:q}=await jt({fs:p,cache:s,gitdir:d,oid:L}),ae=ei.from({object:L,type:q,tag:w.replace("refs/tags/",""),tagger:_,message:E,gpgsig:k});O&&(ae=await ei.sign(ae,u,O));let ce=await vr({fs:p,gitdir:d,type:"tag",object:ae.toObject()});await ze.writeRef({fs:p,gitdir:d,ref:w,value:ce})}c(_y,"xk"),h(_y,"_annotatedTag");async function Lh({fs:p,onSign:s,dir:u,gitdir:d=Y(u,".git"),ref:w,tagger:_,message:E=w,gpgsig:k,object:I,signingKey:O,force:x=!1,cache:L={}}){try{ie("fs",p),ie("gitdir",d),ie("ref",w),O&&ie("onSign",s);let q=new ct(p),ae=await _i({fs:q,gitdir:d,author:_});if(!ae)throw new Tr("tagger");return await _y({fs:q,cache:L,onSign:s,gitdir:d,ref:w,tagger:ae,message:E,gpgsig:k,object:I,signingKey:O,force:x})}catch(q){throw q.caller="git.annotatedTag",q}}c(Lh,"Qw"),h(Lh,"annotatedTag");async function vy({fs:p,gitdir:s,ref:u,object:d,checkout:w=!1,force:_=!1}){if(!_s(u,!0))throw new wi(u,l.clean(u));let E=`refs/heads/${u}`;if(!_&&await ze.exists({fs:p,gitdir:s,ref:E}))throw new yi("branch",u,!1);let k;try{k=await ze.resolve({fs:p,gitdir:s,ref:d||"HEAD"})}catch{}k&&await ze.writeRef({fs:p,gitdir:s,ref:E,value:k}),w&&await ze.writeSymbolicRef({fs:p,gitdir:s,ref:"HEAD",value:E})}c(vy,"Pk"),h(vy,"_branch");async function Uh({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,object:w,checkout:_=!1,force:E=!1}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),await vy({fs:new ct(p),gitdir:u,ref:d,object:w,checkout:_,force:E})}catch(k){throw k.caller="git.branch",k}}c(Uh,"eg"),h(Uh,"branch");var Sy=h((p,s)=>p==="."||s==null||s.length===0||s==="."?!0:s.length>=p.length?s.startsWith(p):p.startsWith(s),"worthWalking");async function yl({fs:p,cache:s,onProgress:u,onPostCheckout:d,dir:w,gitdir:_,remote:E,ref:k,filepaths:I,noCheckout:O,noUpdateHead:x,dryRun:L,force:q,track:ae=!0,nonBlocking:ce=!1,batchSize:Re=100}){let Be;if(d)try{Be=await ze.resolve({fs:p,gitdir:_,ref:"HEAD"})}catch{Be="0000000000000000000000000000000000000000"}let qe;try{qe=await ze.resolve({fs:p,gitdir:_,ref:k})}catch(We){if(k==="HEAD")throw We;let Qe=`${E}/${k}`;if(qe=await ze.resolve({fs:p,gitdir:_,ref:Qe}),ae){let at=await ut.get({fs:p,gitdir:_});await at.set(`branch.${k}.remote`,E),await at.set(`branch.${k}.merge`,`refs/heads/${k}`),await ut.save({fs:p,gitdir:_,config:at})}await ze.writeRef({fs:p,gitdir:_,ref:`refs/heads/${k}`,value:qe})}if(!O){let We;try{We=await Ey({fs:p,cache:s,onProgress:u,dir:w,gitdir:_,ref:k,force:q,filepaths:I})}catch(Ve){throw Ve instanceof se&&Ve.data.what===qe?new ph(k,qe):Ve}let Qe=We.filter(([Ve])=>Ve==="conflict").map(([Ve,tt])=>tt);if(Qe.length>0)throw new dh(Qe);let at=We.filter(([Ve])=>Ve==="error").map(([Ve,tt])=>tt);if(at.length>0)throw new T(at.join(", "));if(L){d&&await d({previousHead:Be,newHead:qe,type:I!=null&&I.length>0?"file":"branch"});return}let ot=0,nt=We.length;if(await me.acquire({fs:p,gitdir:_,cache:s},async function(Ve){await Promise.all(We.filter(([tt])=>tt==="delete"||tt==="delete-index").map(async function([tt,rt]){let yt=`${w}/${rt}`;tt==="delete"&&await p.rm(yt),Ve.delete({filepath:rt}),u&&await u({phase:"Updating workdir",loaded:++ot,total:nt})}))}),await me.acquire({fs:p,gitdir:_,cache:s},async function(Ve){for(let[tt,rt]of We)if(tt==="rmdir"||tt==="rmdir-index"){let yt=`${w}/${rt}`;try{tt==="rmdir"&&await p.rmdir(yt),Ve.delete({filepath:rt}),u&&await u({phase:"Updating workdir",loaded:++ot,total:nt})}catch(Dt){if(Dt.code==="ENOTEMPTY")console.log(`Did not delete ${rt} because directory is not empty`);else throw Dt}}}),await Promise.all(We.filter(([Ve])=>Ve==="mkdir"||Ve==="mkdir-index").map(async function([Ve,tt]){let rt=`${w}/${tt}`;await p.mkdir(rt),u&&await u({phase:"Updating workdir",loaded:++ot,total:nt})})),ce){let Ve=We.filter(([rt])=>rt==="create"||rt==="create-index"||rt==="update"||rt==="mkdir-index"),tt=await Wh("Update Working Dir",Ve.map(([rt,yt,Dt,Zt,xt])=>()=>ky({fs:p,cache:s,gitdir:_,dir:w},[rt,yt,Dt,Zt,xt])),u,Re);await me.acquire({fs:p,gitdir:_,cache:s,allowUnmerged:!0},async function(rt){await Wh("Update Index",tt.map(([yt,Dt,Zt])=>()=>Fy({index:rt,fullpath:yt,oid:Dt,stats:Zt})),u,Re)})}else await me.acquire({fs:p,gitdir:_,cache:s,allowUnmerged:!0},async function(Ve){await Promise.all(We.filter(([tt])=>tt==="create"||tt==="create-index"||tt==="update"||tt==="mkdir-index").map(async function([tt,rt,yt,Dt,Zt]){let xt=`${w}/${rt}`;try{if(tt!=="create-index"&&tt!=="mkdir-index"){let{object:ur}=await jt({fs:p,cache:s,gitdir:_,oid:yt});if(Zt&&await p.rm(xt),Dt===33188)await p.write(xt,ur);else if(Dt===33261)await p.write(xt,ur,{mode:511});else if(Dt===40960)await p.writelink(xt,ur);else throw new T(`Invalid mode 0o${Dt.toString(8)} detected in blob ${yt}`)}let er=await p.lstat(xt);Dt===33261&&(er.mode=493),tt==="mkdir-index"&&(er.mode=57344),Ve.insert({filepath:rt,stats:er,oid:yt}),u&&await u({phase:"Updating workdir",loaded:++ot,total:nt})}catch(er){console.log(er)}}))});d&&await d({previousHead:Be,newHead:qe,type:I!=null&&I.length>0?"file":"branch"})}if(!x){let We=await ze.expand({fs:p,gitdir:_,ref:k});We.startsWith("refs/heads")?await ze.writeSymbolicRef({fs:p,gitdir:_,ref:"HEAD",value:We}):await ze.writeRef({fs:p,gitdir:_,ref:"HEAD",value:qe})}}c(yl,"Cc"),h(yl,"_checkout");async function Ey({fs:p,cache:s,onProgress:u,dir:d,gitdir:w,ref:_,force:E,filepaths:k}){let I=0;return bi({fs:p,cache:s,dir:d,gitdir:w,trees:[Or({ref:_}),nn(),G()],map:h(async function(O,[x,L,q]){if(O!=="."){if(k&&!k.some(ae=>Sy(O,ae)))return null;switch(u&&await u({phase:"Analyzing workdir",loaded:++I}),[!!q,!!x,!!L].map(Number).join("")){case"000":return;case"001":return E&&k&&k.includes(O)?["delete",O]:void 0;case"010":switch(await x.type()){case"tree":return["mkdir",O];case"blob":return["create",O,await x.oid(),await x.mode()];case"commit":return["mkdir-index",O,await x.oid(),await x.mode()];default:return["error",`new entry Unhandled type ${await x.type()}`]}case"011":switch(`${await x.type()}-${await L.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",O];case"blob-blob":return await x.oid()!==await L.oid()?E?["update",O,await x.oid(),await x.mode(),await x.mode()!==await L.mode()]:["conflict",O]:await x.mode()!==await L.mode()?E?["update",O,await x.oid(),await x.mode(),!0]:["conflict",O]:["create-index",O,await x.oid(),await x.mode()];case"commit-tree":return;case"commit-blob":return["conflict",O];default:return["error",`new entry Unhandled type ${x.type}`]}case"100":return["delete-index",O];case"101":switch(await q.type()){case"tree":return["rmdir-index",O];case"blob":return await q.oid()!==await L.oid()?E?["delete",O]:["conflict",O]:["delete",O];case"commit":return["rmdir-index",O];default:return["error",`delete entry Unhandled type ${await q.type()}`]}case"110":case"111":switch(`${await q.type()}-${await x.type()}`){case"tree-tree":return;case"blob-blob":{if(await q.oid()===await x.oid()&&await q.mode()===await x.mode()&&!E)return;if(L){if(await L.oid()!==await q.oid()&&await L.oid()!==await x.oid())return E?["update",O,await x.oid(),await x.mode(),await x.mode()!==await L.mode()]:["conflict",O]}else if(E)return["update",O,await x.oid(),await x.mode(),await x.mode()!==await q.mode()];return await x.mode()!==await q.mode()?["update",O,await x.oid(),await x.mode(),!0]:await x.oid()!==await q.oid()?["update",O,await x.oid(),await x.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",O,await x.oid()];case"blob-tree":return["update-blob-to-tree",O];case"commit-commit":return["mkdir-index",O,await x.oid(),await x.mode()];default:return["error",`update entry Unhandled type ${await q.type()}-${await x.type()}`]}}}},"map"),reduce:h(async function(O,x){return x=ly(x),O?O&&O[0]==="rmdir"?(x.push(O),x):(x.unshift(O),x):x},"reduce")})}c(Ey,"Tk"),h(Ey,"analyze");async function Fy({index:p,fullpath:s,stats:u,oid:d}){try{p.insert({filepath:s,stats:u,oid:d})}catch(w){console.warn(`Error inserting ${s} into index:`,w)}}c(Fy,"Ak"),h(Fy,"updateIndex");async function ky({fs:p,cache:s,gitdir:u,dir:d},[w,_,E,k,I]){let O=`${d}/${_}`;if(w!=="create-index"&&w!=="mkdir-index"){let{object:L}=await jt({fs:p,cache:s,gitdir:u,oid:E});if(I&&await p.rm(O),k===33188)await p.write(O,L);else if(k===33261)await p.write(O,L,{mode:511});else if(k===40960)await p.writelink(O,L);else throw new T(`Invalid mode 0o${k.toString(8)} detected in blob ${E}`)}let x=await p.lstat(O);return k===33261&&(x.mode=493),w==="mkdir-index"&&(x.mode=57344),[_,E,x]}c(ky,"Ok"),h(ky,"updateWorkingDir");async function Wh(p,s,u,d){let w=[];try{for(let _=0;_<s.length;_+=d){let E=s.slice(_,_+d).map(k=>k());(await Promise.allSettled(E)).forEach(k=>{k.status==="fulfilled"&&w.push(k.value)}),u&&await u({phase:"Updating workdir",loaded:_+E.length,total:s.length})}return w}catch(_){console.error(`Error during ${p}: ${_}`)}return w}c(Wh,"Fw"),h(Wh,"batchAllSettled");async function wl({fs:p,onProgress:s,onPostCheckout:u,dir:d,gitdir:w=Y(d,".git"),remote:_="origin",ref:E,filepaths:k,noCheckout:I=!1,noUpdateHead:O=E===void 0,dryRun:x=!1,force:L=!1,track:q=!0,cache:ae={},nonBlocking:ce=!1,batchSize:Re=100}){try{ie("fs",p),ie("dir",d),ie("gitdir",w);let Be=E||"HEAD";return await yl({fs:new ct(p),cache:ae,onProgress:s,onPostCheckout:u,dir:d,gitdir:w,remote:_,ref:Be,filepaths:k,noCheckout:I,noUpdateHead:O,dryRun:x,force:L,track:q,nonBlocking:ce,batchSize:Re})}catch(Be){throw Be.caller="git.checkout",Be}}c(wl,"Ic"),h(wl,"checkout");var mS=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Mi(p){let s=mS.exec(p);return s?s[1]==="remotes/"&&p.endsWith("/HEAD")?s[2].slice(0,-5):s[2]:p}c(Mi,"Er"),h(Mi,"abbreviateRef");async function vi({fs:p,gitdir:s,fullname:u=!1,test:d=!1}){let w=await ze.resolve({fs:p,gitdir:s,ref:"HEAD",depth:2});if(d)try{await ze.resolve({fs:p,gitdir:s,ref:w})}catch{return}if(w.startsWith("refs/"))return u?w:Mi(w)}c(vi,"nr"),h(vi,"_currentBranch");function Ry(p){return p=p.replace(/^git@([^:]+):/,"https://$1/"),p=p.replace(/^ssh:\/\//,"https://"),p}c(Ry,"Rk"),h(Ry,"translateSSHtoHTTP");function qh({username:p="",password:s=""}){return`Basic ${Buffer.from(`${p}:${s}`).toString("base64")}`}c(qh,"rg"),h(qh,"calculateBasicAuthHeader");async function vs(p,s){let u=lh(p);for(;;){let{value:d,done:w}=await u.next();if(d&&await s(d),w)break}u.return&&u.return()}c(vs,"Hn"),h(vs,"forAwait");async function go(p){let s=0,u=[];await vs(p,_=>{u.push(_),s+=_.byteLength});let d=new Uint8Array(s),w=0;for(let _ of u)d.set(_,w),w+=_.byteLength;return d}c(go,"ro"),h(go,"collect");function zh(p){let s=p.match(/^https?:\/\/([^/]+)@/);if(s==null)return{url:p,auth:{}};s=s[1];let[u,d]=s.split(":");return p=p.replace(`${s}@`,""),{url:p,auth:{username:u,password:d}}}c(zh,"Sw"),h(zh,"extractAuthFromUrl");function bl(p,s){let u=s.toString(16);return"0".repeat(p-u.length)+u}c(bl,"Oc"),h(bl,"padHex");var Ty=(Ns=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(s){typeof s=="string"&&(s=Buffer.from(s));let u=s.length+4,d=bl(4,u);return Buffer.concat([Buffer.from(d,"utf8"),s])}static streamReader(s){let u=new pg(s);return h(async function(){try{let d=await u.read(4);return d==null?!0:(d=parseInt(d.toString("utf8"),16),d===0||d===1?null:await u.read(d-4)??!0)}catch(d){return s.error=d,!0}},"read")}},c(Ns,"Kc"),Ns);h(Ty,"GitPktLine");var zt=Ty;async function Hh(p){let s={},u;for(;u=await p(),u!==!0;){if(u===null)continue;u=u.toString("utf8").replace(/\n$/,"");let d=u.indexOf("=");if(d>-1){let w=u.slice(0,d),_=u.slice(d+1);s[w]=_}else s[u]=!0}return{protocolVersion:2,capabilities2:s}}c(Hh,"Ew"),h(Hh,"parseCapabilitiesV2");async function Gh(p,{service:s}){let u=new Set,d=new Map,w=new Map,_=zt.streamReader(p),E=await _();for(;E===null;)E=await _();if(E===!0)throw new mh;if(E.includes("version 2"))return Hh(_);if(E.toString("utf8").replace(/\n$/,"")!==`# service=${s}`)throw new ho(`# service=${s}\\n`,E.toString("utf8"));let k=await _();for(;k===null;)k=await _();if(k===!0)return{capabilities:u,refs:d,symrefs:w};if(k=k.toString("utf8"),k.includes("version 2"))return Hh(_);let[I,O]=_l(k,"\0","\\x00");if(O.split(" ").map(x=>u.add(x)),I!=="0000000000000000000000000000000000000000 capabilities^{}"){let[x,L]=_l(I," "," ");for(d.set(L,x);;){let q=await _();if(q===!0)break;if(q!==null){let[ae,ce]=_l(q.toString("utf8")," "," ");d.set(ce,ae)}}}for(let x of u)if(x.startsWith("symref=")){let L=x.match(/symref=([^:]+):(.*)/);L.length===3&&w.set(L[1],L[2])}return{protocolVersion:1,capabilities:u,refs:d,symrefs:w}}c(Gh,"kw"),h(Gh,"parseRefsAdResponse");function _l(p,s,u){let d=p.trim().split(s);if(d.length!==2)throw new ho(`Two strings separated by '${u}'`,p.toString("utf8"));return d}c(_l,"pc"),h(_l,"splitAndAssert");var Oy=h((p,s)=>p.endsWith("?")?`${p}${s}`:`${p}/${s.replace(/^https?:\/\//,"")}`,"corsProxify"),xy=h((p,s)=>{(s.username||s.password)&&(p.Authorization=qh(s)),s.headers&&Object.assign(p,s.headers)},"updateHeaders"),Vh=h(async p=>{try{let s=Buffer.from(await go(p.body)),u=s.toString("utf8");return{preview:u.length<256?u:u.slice(0,256)+"...",response:u,data:s}}catch{return{}}},"stringifyBody"),Ay=(Cs=class{static async capabilities(){return["discover","connect"]}static async discover({http:s,onProgress:u,onAuth:d,onAuthSuccess:w,onAuthFailure:_,corsProxy:E,service:k,url:I,headers:O,protocolVersion:x}){let{url:L,auth:q}=zh(I),ae=E?Oy(E,L):L;(q.username||q.password)&&(O.Authorization=qh(q)),x===2&&(O["Git-Protocol"]="version=2");let ce,Re,Be=!1;do if(ce=await s.request({onProgress:u,method:"GET",url:`${ae}/info/refs?service=${k}`,headers:O}),Re=!1,ce.statusCode===401||ce.statusCode===203){let qe=Be?_:d;if(qe){if(q=await qe(L,{...q,headers:{...O}}),q&&q.cancel)throw new ul;q&&(xy(O,q),Be=!0,Re=!0)}}else ce.statusCode===200&&Be&&w&&await w(L,q);while(Re);if(ce.statusCode!==200){let{response:qe}=await Vh(ce);throw new ll(ce.statusCode,ce.statusMessage,qe)}if(ce.headers["content-type"]===`application/x-${k}-advertisement`){let qe=await Gh(ce.body,{service:k});return qe.auth=q,qe}else{let{preview:qe,response:We,data:Qe}=await Vh(ce);try{let at=await Gh([Qe],{service:k});return at.auth=q,at}catch{throw new _h(qe,We)}}}static async connect({http:s,onProgress:u,corsProxy:d,service:w,url:_,auth:E,body:k,headers:I}){let O=zh(_);O&&(_=O.url),d&&(_=Oy(d,_)),I["content-type"]=`application/x-${w}-request`,I.accept=`application/x-${w}-result`,xy(I,E);let x=await s.request({onProgress:u,method:"POST",url:`${_}/${w}`,body:k,headers:I});if(x.statusCode!==200){let{response:L}=Vh(x);throw new ll(x.statusCode,x.statusMessage,L)}return x}},c(Cs,"Yc"),Cs);h(Ay,"GitRemoteHTTP");var vl=Ay,Py=(Is=class{static getRemoteHelperFor({url:s}){let u=new Map;u.set("http",vl),u.set("https",vl);let d=Dy({url:s});if(!d)throw new Sh(s);if(u.has(d.transport))return u.get(d.transport);throw new vh(s,d.transport,d.transport==="ssh"?Ry(s):void 0)}},c(Is,"Xc"),Is);h(Py,"GitRemoteManager");var Sl=Py;function Dy({url:p}){if(p.startsWith("git@"))return{transport:"ssh",address:p};let s=p.match(/(\w+)(:\/\/|::)(.*)/);if(s!==null){if(s[2]==="://")return{transport:s[1],address:s[0]};if(s[2]==="::")return{transport:s[1],address:s[3]}}}c(Dy,"Ck"),h(Dy,"parseRemoteUrl");var ln=null,Ny=(Bs=class{static async read({fs:s,gitdir:u}){ln===null&&(ln=new t);let d=Y(u,"shallow"),w=new Set;return await ln.acquire(d,async function(){let _=await s.read(d,{encoding:"utf8"});if(_===null||_.trim()==="")return w;_.trim().split(`
72
+ `).map(E=>w.add(E))}),w}static async write({fs:s,gitdir:u,oids:d}){ln===null&&(ln=new t);let w=Y(u,"shallow");if(d.size>0){let _=[...d].join(`
72
73
  `)+`
73
- `;await Xi.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await Xi.acquire(n,async function(){await e.rm(n)})}};l(Qw,"GitShallowManager");var Qi=Qw;async function dj({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}l(dj,"hasObjectLoose");async function pj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(C(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let f=`${r}/objects/pack/${o}`,c=await Dw({fs:t,cache:e,filename:f,getExternalRefDelta:n});if(c.error)throw new z(c.error);if(c.offsets.has(i))return!0}return!1}l(pj,"hasObjectPacked");async function zT({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(f=>he({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),o=await dj({fs:t,gitdir:r,oid:i});return o||(o=await pj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),o}l(zT,"hasObject");function mj(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}l(mj,"emptyPackfile");function b1(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}l(b1,"filterCapabilities");var xu={name:"isomorphic-git",version:"0.0.0-development",agent:"git/isomorphic-git@0.0.0-development"},ey=class ey{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};l(ey,"FIFO");var js=ey;function wj(t){let e=t.indexOf("\r"),r=t.indexOf(`
74
- `);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}l(wj,"findSplit");function _1(t){let e=new js,r="";return(async()=>(await oc(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=wj(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}l(_1,"splitLines");var ty=class ty{static demux(e){let r=be.streamReader(e),i=new js,n=new js,s=new js,o=l(async function(){let f=await r();if(f===null)return o();if(f===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(f[0]){case 1:{n.write(f.slice(1));break}case 2:{s.write(f.slice(1));break}case 3:{let c=f.slice(1);s.write(c),i.end(),s.end(),n.destroy(new Error(c.toString("utf8")));return}default:i.write(f)}o()},"nextBit");return o(),{packetlines:i,packfile:n,progress:s}}};l(ty,"GitSideBand");var Lf=ty;async function yj(t){let{packetlines:e,packfile:r,progress:i}=Lf.demux(t),n=[],s=[],o=[],f=!1,c=!1;return new Promise((a,u)=>{oc(e,h=>{let d=h.toString("utf8").trim();if(d.startsWith("shallow")){let p=d.slice(-41).trim();p.length!==40&&u(new ci(p)),n.push(p)}else if(d.startsWith("unshallow")){let p=d.slice(-41).trim();p.length!==40&&u(new ci(p)),s.push(p)}else if(d.startsWith("ACK")){let[,p,m]=d.split(" ");o.push({oid:p,status:m}),m||(c=!0)}else d.startsWith("NAK")?(f=!0,c=!0):(c=!0,f=!0);c&&(t.error?u(t.error):a({shallows:n,unshallows:s,acks:o,nak:f,packfile:r,progress:i}))}).finally(()=>{c||(t.error?u(t.error):a({shallows:n,unshallows:s,acks:o,nak:f,packfile:r,progress:i}))})})}l(yj,"parseUploadPackResponse");function gj({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:o=[]}){let f=[];e=[...new Set(e)];let c=` ${t.join(" ")}`;for(let a of e)f.push(be.encode(`want ${a}${c}
75
- `)),c="";for(let a of i)f.push(be.encode(`shallow ${a}
76
- `));n!==null&&f.push(be.encode(`deepen ${n}
77
- `)),s!==null&&f.push(be.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
78
- `));for(let a of o)f.push(be.encode(`deepen-not ${a}
79
- `));f.push(be.flush());for(let a of r)f.push(be.encode(`have ${a}
80
- `));return f.push(be.encode(`done
81
- `)),f}l(gj,"writeUploadPackRequest");async function $w({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:c,ref:a,remoteRef:u,remote:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:b=!1,tags:_=!1,singleBranch:F=!1,headers:E={},prune:R=!1,pruneTags:D=!1}){let S=a||await mi({fs:t,gitdir:c,test:!0}),O=await Se.get({fs:t,gitdir:c}),v=h||S&&await O.get(`branch.${S}.remote`)||"origin",A=d||await O.get(`remote.${v}.url`);if(typeof A>"u")throw new dt("remote OR url");let x=u||S&&await O.get(`branch.${S}.merge`)||a||"HEAD";p===void 0&&(p=await O.get("http.corsProxy"));let I=Qs.getRemoteHelperFor({url:A}),M=await I.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:f,corsProxy:p,service:"git-upload-pack",url:A,headers:E,protocolVersion:1}),H=M.auth,Te=M.refs;if(Te.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!M.capabilities.has("shallow"))throw new ai("shallow","depth");if(w!==null&&!M.capabilities.has("deepen-since"))throw new ai("deepen-since","since");if(y.length>0&&!M.capabilities.has("deepen-not"))throw new ai("deepen-not","exclude");if(b===!0&&!M.capabilities.has("deepen-relative"))throw new ai("deepen-relative","relative");let ft,zt;try{let re=$.resolveAgainstMap({ref:x,map:Te});ft=re.fullref,zt=re.oid}catch{}for(let re of Te.keys())re===ft||re==="HEAD"||re.startsWith("refs/heads/")||_&&re.startsWith("refs/tags/")||Te.delete(re);let Ht=b1([...M.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${xu.agent}`]);b&&Ht.push("deepen-relative");let Fd=F?[zt]:Te.values(),Td=F?[S]:await $.listRefs({fs:t,gitdir:c,filepath:"refs"}),yt=[];for(let re of Td)try{re=await $.expand({fs:t,gitdir:c,ref:re});let Ue=await $.resolve({fs:t,gitdir:c,ref:re});await zT({fs:t,cache:e,gitdir:c,oid:Ue})&&yt.push(Ue)}catch{}yt=[...new Set(yt)];let ge=await Qi.read({fs:t,gitdir:c}),sr=M.capabilities.has("shallow")?[...ge]:[],Ge=gj({capabilities:Ht,wants:Fd,haves:yt,shallows:sr,depth:m,since:w,exclude:y}),Ho=Buffer.from(await Mf(Ge)),Ai=await I.connect({http:r,onProgress:i,corsProxy:p,service:"git-upload-pack",url:A,auth:H,body:[Ho],headers:E}),Pe=await yj(Ai.body);Ai.headers&&(Pe.headers=Ai.headers);for(let re of Pe.shallows)if(!ge.has(re))try{let{object:Ue}=await he({fs:t,cache:e,gitdir:c,oid:re}),Ot=new mt(Ue),or=await Promise.all(Ot.headers().parent.map(Go=>zT({fs:t,cache:e,gitdir:c,oid:Go})));or.length===0||or.every(Go=>Go)||ge.add(re)}catch{ge.add(re)}for(let re of Pe.unshallows)ge.delete(re);if(await Qi.write({fs:t,gitdir:c,oids:ge}),F){let re=new Map([[ft,zt]]),Ue=new Map,Ot=10,or=ft;for(;Ot--;){let Rd=M.symrefs.get(or);if(Rd===void 0)break;Ue.set(or,Rd),or=Rd}let kd=Te.get(or);kd&&re.set(or,kd);let{pruned:Go}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:v,refs:re,symrefs:Ue,tags:_,prune:R});R&&(Pe.pruned=Go)}else{let{pruned:re}=await $.updateRemoteRefs({fs:t,gitdir:c,remote:v,refs:Te,symrefs:M.symrefs,tags:_,prune:R,pruneTags:D});R&&(Pe.pruned=re)}if(Pe.HEAD=M.symrefs.get("HEAD"),Pe.HEAD===void 0)try{let{oid:re}=$.resolveAgainstMap({ref:"HEAD",map:Te});for(let[Ue,Ot]of Te.entries())if(Ue!=="HEAD"&&Ot===re){Pe.HEAD=Ue;break}}catch{}let eN=ft&&ft.startsWith("refs/tags")?"tag":"branch";if(Pe.FETCH_HEAD={oid:zt,description:`${eN} '${Yi(ft)}' of ${A}`},i||n){let re=_1(Pe.progress);oc(re,async Ue=>{if(n&&await n(Ue),i){let Ot=Ue.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);Ot&&await i({phase:Ot[1].trim(),loaded:parseInt(Ot[2],10),total:parseInt(Ot[3],10)})}})}let Mc=Buffer.from(await Mf(Pe.packfile));if(Ai.body.error)throw Ai.body.error;let I0=Mc.slice(-20).toString("hex"),Vo={defaultBranch:Pe.HEAD,fetchHead:Pe.FETCH_HEAD.oid,fetchHeadDescription:Pe.FETCH_HEAD.description};if(Pe.headers&&(Vo.headers=Pe.headers),R&&(Vo.pruned=Pe.pruned),I0!==""&&!mj(Mc)){Vo.packfile=`objects/pack/pack-${I0}.pack`;let re=C(c,Vo.packfile);await t.write(re,Mc);let Ue=l(or=>he({fs:t,cache:e,gitdir:c,oid:or}),"getExternalRefDelta"),Ot=await Ua.fromPack({pack:Mc,getExternalRefDelta:Ue,onProgress:i});await t.write(re.replace(/\.pack$/,".idx"),await Ot.toBuffer())}return Vo}l($w,"_fetch");async function S1({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(o=>i+"/"+o);for(let o of s)await t.mkdir(o);await t.write(i+"/config",`[core]
74
+ `;await ln.acquire(w,async function(){await s.write(w,_,{encoding:"utf8"})})}else await ln.acquire(w,async function(){await s.rm(w)})}},c(Bs,"Jc"),Bs);h(Ny,"GitShallowManager");var yo=Ny;async function Cy({fs:p,gitdir:s,oid:u}){let d=`objects/${u.slice(0,2)}/${u.slice(2)}`;return p.exists(`${s}/${d}`)}c(Cy,"Ik"),h(Cy,"hasObjectLoose");async function Iy({fs:p,cache:s,gitdir:u,oid:d,getExternalRefDelta:w}){let _=await p.readdir(Y(u,"objects/pack"));_=_.filter(E=>E.endsWith(".idx"));for(let E of _){let k=`${u}/objects/pack/${E}`,I=await ol({fs:p,cache:s,filename:k,getExternalRefDelta:w});if(I.error)throw new T(I.error);if(I.offsets.has(d))return!0}return!1}c(Iy,"Bk"),h(Iy,"hasObjectPacked");async function Kh({fs:p,cache:s,gitdir:u,oid:d,format:w="content"}){let _=h(k=>jt({fs:p,cache:s,gitdir:u,oid:k}),"getExternalRefDelta"),E=await Cy({fs:p,gitdir:u,oid:d});return E||(E=await Iy({fs:p,cache:s,gitdir:u,oid:d,getExternalRefDelta:_})),E}c(Kh,"Tw"),h(Kh,"hasObject");function By(p){return p.slice(0,12).toString("hex")==="5041434b0000000200000000"}c(By,"Nk"),h(By,"emptyPackfile");function Jh(p,s){let u=p.map(d=>d.split("=",1)[0]);return s.filter(d=>{let w=d.split("=",1)[0];return u.includes(w)})}c(Jh,"ig"),h(Jh,"filterCapabilities");var El={name:"isomorphic-git",version:"1.34.1",agent:"git/isomorphic-git@1.34.1"},jy=(js=class{constructor(){this._queue=[]}write(s){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let u=this._waiting;this._waiting=null,u({value:s})}else this._queue.push(s)}end(){if(this._ended=!0,this._waiting){let s=this._waiting;this._waiting=null,s({done:!0})}}destroy(s){this.error=s,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(s=>{this._waiting=s})}},c(js,"Qc"),js);h(jy,"FIFO");var Fl=jy;function My(p){let s=p.indexOf("\r"),u=p.indexOf(`
75
+ `);return s===-1&&u===-1?-1:s===-1?u+1:u===-1?s+1:u===s+1?u+1:Math.min(s,u)+1}c(My,"$k"),h(My,"findSplit");function Yh(p){let s=new Fl,u="";return(async()=>(await vs(p,d=>{for(d=d.toString("utf8"),u+=d;;){let w=My(u);if(w===-1)break;s.write(u.slice(0,w)),u=u.slice(w)}}),u.length>0&&s.write(u),s.end()))(),s}c(Yh,"ng"),h(Yh,"splitLines");var $y=(Ms=class{static demux(s){let u=zt.streamReader(s),d=new Fl,w=new Fl,_=new Fl,E=h(async function(){let k=await u();if(k===null)return E();if(k===!0){d.end(),_.end(),s.error?w.destroy(s.error):w.end();return}switch(k[0]){case 1:{w.write(k.slice(1));break}case 2:{_.write(k.slice(1));break}case 3:{let I=k.slice(1);_.write(I),d.end(),_.end(),w.destroy(new Error(I.toString("utf8")));return}default:d.write(k)}E()},"nextBit");return E(),{packetlines:d,packfile:w,progress:_}}},c(Ms,"ef"),Ms);h($y,"GitSideBand");var Ly=$y;async function Uy(p){let{packetlines:s,packfile:u,progress:d}=Ly.demux(p),w=[],_=[],E=[],k=!1,I=!1;return new Promise((O,x)=>{vs(s,L=>{let q=L.toString("utf8").trim();if(q.startsWith("shallow")){let ae=q.slice(-41).trim();ae.length!==40&&x(new Q(ae)),w.push(ae)}else if(q.startsWith("unshallow")){let ae=q.slice(-41).trim();ae.length!==40&&x(new Q(ae)),_.push(ae)}else if(q.startsWith("ACK")){let[,ae,ce]=q.split(" ");E.push({oid:ae,status:ce}),ce||(I=!0)}else q.startsWith("NAK")?(k=!0,I=!0):(I=!0,k=!0);I&&(p.error?x(p.error):O({shallows:w,unshallows:_,acks:E,nak:k,packfile:u,progress:d}))}).finally(()=>{I||(p.error?x(p.error):O({shallows:w,unshallows:_,acks:E,nak:k,packfile:u,progress:d}))})})}c(Uy,"Lk"),h(Uy,"parseUploadPackResponse");function Wy({capabilities:p=[],wants:s=[],haves:u=[],shallows:d=[],depth:w=null,since:_=null,exclude:E=[]}){let k=[];s=[...new Set(s)];let I=` ${p.join(" ")}`;for(let O of s)k.push(zt.encode(`want ${O}${I}
76
+ `)),I="";for(let O of d)k.push(zt.encode(`shallow ${O}
77
+ `));w!==null&&k.push(zt.encode(`deepen ${w}
78
+ `)),_!==null&&k.push(zt.encode(`deepen-since ${Math.floor(_.valueOf()/1e3)}
79
+ `));for(let O of E)k.push(zt.encode(`deepen-not ${O}
80
+ `));k.push(zt.flush());for(let O of u)k.push(zt.encode(`have ${O}
81
+ `));return k.push(zt.encode(`done
82
+ `)),k}c(Wy,"Mk"),h(Wy,"writeUploadPackRequest");async function kl({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,gitdir:I,ref:O,remoteRef:x,remote:L,url:q,corsProxy:ae,depth:ce=null,since:Re=null,exclude:Be=[],relative:qe=!1,tags:We=!1,singleBranch:Qe=!1,headers:at={},prune:ot=!1,pruneTags:nt=!1}){let Ve=O||await vi({fs:p,gitdir:I,test:!0}),tt=await ut.get({fs:p,gitdir:I}),rt=L||Ve&&await tt.get(`branch.${Ve}.remote`)||"origin",yt=q||await tt.get(`remote.${rt}.url`);if(typeof yt>"u")throw new Ur("remote OR url");let Dt=x||Ve&&await tt.get(`branch.${Ve}.merge`)||O||"HEAD";ae===void 0&&(ae=await tt.get("http.corsProxy"));let Zt=Sl.getRemoteHelperFor({url:yt}),xt=await Zt.discover({http:u,onAuth:_,onAuthSuccess:E,onAuthFailure:k,corsProxy:ae,service:"git-upload-pack",url:yt,headers:at,protocolVersion:1}),er=xt.auth,ur=xt.refs;if(ur.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(ce!==null&&!xt.capabilities.has("shallow"))throw new ms("shallow","depth");if(Re!==null&&!xt.capabilities.has("deepen-since"))throw new ms("deepen-since","since");if(Be.length>0&&!xt.capabilities.has("deepen-not"))throw new ms("deepen-not","exclude");if(qe===!0&&!xt.capabilities.has("deepen-relative"))throw new ms("deepen-relative","relative");let ri,$s;try{let Ot=ze.resolveAgainstMap({ref:Dt,map:ur});ri=Ot.fullref,$s=Ot.oid}catch{}for(let Ot of ur.keys())Ot===ri||Ot==="HEAD"||Ot.startsWith("refs/heads/")||We&&Ot.startsWith("refs/tags/")||ur.delete(Ot);let Ls=Jh([...xt.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${El.agent}`]);qe&&Ls.push("deepen-relative");let Sd=Qe?[$s]:ur.values(),Ed=Qe?[Ve]:await ze.listRefs({fs:p,gitdir:I,filepath:"refs"}),Pr=[];for(let Ot of Ed)try{Ot=await ze.expand({fs:p,gitdir:I,ref:Ot});let Er=await ze.resolve({fs:p,gitdir:I,ref:Ot});await Kh({fs:p,cache:s,gitdir:I,oid:Er})&&Pr.push(Er)}catch{}Pr=[...new Set(Pr)];let qt=await yo.read({fs:p,gitdir:I}),ci=xt.capabilities.has("shallow")?[...qt]:[],Sr=Wy({capabilities:Ls,wants:Sd,haves:Pr,shallows:ci,depth:ce,since:Re,exclude:Be}),bo=Buffer.from(await go(Sr)),Jn=await Zt.connect({http:u,onProgress:d,corsProxy:ae,service:"git-upload-pack",url:yt,auth:er,body:[bo],headers:at}),tr=await Uy(Jn.body);Jn.headers&&(tr.headers=Jn.headers);for(let Ot of tr.shallows)if(!qt.has(Ot))try{let{object:Er}=await jt({fs:p,cache:s,gitdir:I,oid:Ot}),qr=new Wr(Er),fi=await Promise.all(qr.headers().parent.map(Us=>Kh({fs:p,cache:s,gitdir:I,oid:Us})));fi.length===0||fi.every(Us=>Us)||qt.add(Ot)}catch{qt.add(Ot)}for(let Ot of tr.unshallows)qt.delete(Ot);if(await yo.write({fs:p,gitdir:I,oids:qt}),Qe){let Ot=new Map([[ri,$s]]),Er=new Map,qr=10,fi=ri;for(;qr--;){let Fd=xt.symrefs.get(fi);if(Fd===void 0)break;Er.set(fi,Fd),fi=Fd}let Us=ur.get(fi);Us&&Ot.set(fi,Us);let{pruned:vS}=await ze.updateRemoteRefs({fs:p,gitdir:I,remote:rt,refs:Ot,symrefs:Er,tags:We,prune:ot});ot&&(tr.pruned=vS)}else{let{pruned:Ot}=await ze.updateRemoteRefs({fs:p,gitdir:I,remote:rt,refs:ur,symrefs:xt.symrefs,tags:We,prune:ot,pruneTags:nt});ot&&(tr.pruned=Ot)}if(tr.HEAD=xt.symrefs.get("HEAD"),tr.HEAD===void 0)try{let{oid:Ot}=ze.resolveAgainstMap({ref:"HEAD",map:ur});for(let[Er,qr]of ur.entries())if(Er!=="HEAD"&&qr===Ot){tr.HEAD=Er;break}}catch{}let _S=ri&&ri.startsWith("refs/tags")?"tag":"branch";if(tr.FETCH_HEAD={oid:$s,description:`${_S} '${Mi(ri)}' of ${yt}`},d||w){let Ot=Yh(tr.progress);vs(Ot,async Er=>{if(w&&await w(Er),d){let qr=Er.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);qr&&await d({phase:qr[1].trim(),loaded:parseInt(qr[2],10),total:parseInt(qr[3],10)})}})}let xl=Buffer.from(await go(tr.packfile));if(Jn.body.error)throw Jn.body.error;let Pw=xl.slice(-20).toString("hex"),_o={defaultBranch:tr.HEAD,fetchHead:tr.FETCH_HEAD.oid,fetchHeadDescription:tr.FETCH_HEAD.description};if(tr.headers&&(_o.headers=tr.headers),ot&&(_o.pruned=tr.pruned),Pw!==""&&!By(xl)){_o.packfile=`objects/pack/pack-${Pw}.pack`;let Ot=Y(I,_o.packfile);await p.write(Ot,xl);let Er=h(fi=>jt({fs:p,cache:s,gitdir:I,oid:fi}),"getExternalRefDelta"),qr=await hh.fromPack({pack:xl,getExternalRefDelta:Er,onProgress:d});await p.write(Ot.replace(/\.pack$/,".idx"),await qr.toBuffer())}return _o}c(kl,"Bc"),h(kl,"_fetch");async function Xh({fs:p,bare:s=!1,dir:u,gitdir:d=s?u:Y(u,".git"),defaultBranch:w="master"}){if(await p.exists(d+"/config"))return;let _=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];_=_.map(E=>d+"/"+E);for(let E of _)await p.mkdir(E);await p.write(d+"/config",`[core]
82
83
  repositoryformatversion = 0
83
84
  filemode = false
84
- bare = ${e}
85
- `+(e?"":` logallrefupdates = true
85
+ bare = ${s}
86
+ `+(s?"":` logallrefupdates = true
86
87
  `)+` symlinks = false
87
88
  ignorecase = true
88
- `),await t.write(i+"/HEAD",`ref: refs/heads/${n}
89
- `)}l(S1,"_init");async function bj({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,onPostCheckout:c,dir:a,gitdir:u,url:h,corsProxy:d,ref:p,remote:m,depth:w,since:y,exclude:b,relative:_,singleBranch:F,noCheckout:E,noTags:R,headers:D,nonBlocking:S,batchSize:O=100}){try{if(await S1({fs:t,gitdir:u}),await d1({fs:t,gitdir:u,remote:m,url:h,force:!1}),d){let x=await Se.get({fs:t,gitdir:u});await x.set("http.corsProxy",d),await Se.save({fs:t,gitdir:u,config:x})}let{defaultBranch:v,fetchHead:A}=await $w({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:u,ref:p,remote:m,corsProxy:d,depth:w,since:y,exclude:b,relative:_,singleBranch:F,headers:D,tags:!R});if(A===null)return;p=p||v,p=p.replace("refs/heads/",""),await Cw({fs:t,cache:e,onProgress:i,onPostCheckout:c,dir:a,gitdir:u,ref:p,remote:m,noCheckout:E,nonBlocking:S,batchSize:O})}catch(v){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),v}}l(bj,"_clone");async function v1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:f,dir:c,gitdir:a=C(c,".git"),url:u,corsProxy:h=void 0,ref:d=void 0,remote:p="origin",depth:m=void 0,since:w=void 0,exclude:y=[],relative:b=!1,singleBranch:_=!1,noCheckout:F=!1,noTags:E=!1,headers:R={},cache:D={},nonBlocking:S=!1,batchSize:O=100}){try{return k("fs",t),k("http",e),k("gitdir",a),F||k("dir",c),k("url",u),await bj({fs:new L(t),cache:D,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:f,dir:c,gitdir:a,url:u,corsProxy:h,ref:d,remote:p,depth:m,since:w,exclude:y,relative:b,singleBranch:_,noCheckout:F,noTags:E,headers:R,nonBlocking:S,batchSize:O})}catch(v){throw v.caller="git.clone",v}}l(v1,"clone");async function E1({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),message:n,author:s,committer:o,signingKey:f,amend:c=!1,dryRun:a=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p,cache:m={}}){try{k("fs",t),c||k("message",n),f&&k("onSign",e);let w=new L(t);return await Ou({fs:w,cache:m,onSign:e,gitdir:i,message:n,author:s,committer:o,signingKey:f,amend:c,dryRun:a,noUpdateBranch:u,ref:h,parent:d,tree:p})}catch(w){throw w.caller="git.commit",w}}l(E1,"commit");async function F1({fs:t,dir:e,gitdir:r=C(e,".git"),fullname:i=!1,test:n=!1}){try{return k("fs",t),k("gitdir",r),await mi({fs:new L(t),gitdir:r,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}l(F1,"currentBranch");async function _j({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await $.exists({fs:t,gitdir:e,ref:r}))throw new le(r);let n=await $.expand({fs:t,gitdir:e,ref:r}),s=await mi({fs:t,gitdir:e,fullname:!0});if(n===s){let c=await $.resolve({fs:t,gitdir:e,ref:n});await $.writeRef({fs:t,gitdir:e,ref:"HEAD",value:c})}await $.deleteRef({fs:t,gitdir:e,ref:n});let o=Yi(r),f=await Se.get({fs:t,gitdir:e});await f.deleteSection("branch",o),await Se.save({fs:t,gitdir:e,config:f})}l(_j,"_deleteBranch");async function T1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("ref",i),await _j({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}l(T1,"deleteBranch");async function k1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{k("fs",t),k("ref",i),await $.deleteRef({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}l(k1,"deleteRef");async function Sj({fs:t,gitdir:e,remote:r}){let i=await Se.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await Se.save({fs:t,gitdir:e,config:i})}l(Sj,"_deleteRemote");async function R1({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i}){try{return k("fs",t),k("remote",i),await Sj({fs:new L(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}l(R1,"deleteRemote");async function vj({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await $.deleteRef({fs:t,gitdir:e,ref:r})}l(vj,"_deleteTag");async function O1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("ref",i),await vj({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}l(O1,"deleteTag");async function Ej({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}l(Ej,"expandOidLoose");async function Fj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],o=await t.readdir(C(r,"objects/pack"));o=o.filter(f=>f.endsWith(".idx"));for(let f of o){let c=`${r}/objects/pack/${f}`,a=await Dw({fs:t,cache:e,filename:c,getExternalRefDelta:n});if(a.error)throw new z(a.error);for(let u of a.offsets.keys())u.startsWith(i)&&s.push(u)}return s}l(Fj,"expandOidPacked");async function Tj({fs:t,cache:e,gitdir:r,oid:i}){let n=l(f=>he({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),s=await Ej({fs:t,gitdir:r,oid:i}),o=await Fj({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let f of o)s.indexOf(f)===-1&&s.push(f);if(s.length===1)return s[0];throw s.length>1?new Wa("oids",i,s):new le(`an object matching "${i}"`)}l(Tj,"_expandOid");async function x1({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Tj({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.expandOid",s}}l(x1,"expandOid");async function A1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i}){try{return k("fs",t),k("gitdir",r),k("ref",i),await $.expand({fs:new L(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.expandRef",n}}l(A1,"expandRef");async function Bw({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,o=i.map((f,c)=>({index:c,oid:f}));for(;o.length;){let f=new Set;for(let{oid:a,index:u}of o)n[a]||(n[a]=new Set),n[a].add(u),n[a].size===s&&f.add(a);if(f.size>0)return[...f];let c=new Map;for(let{oid:a,index:u}of o)try{let{object:h}=await he({fs:t,cache:e,gitdir:r,oid:a}),d=mt.from(h),{parent:p}=d.parseHeaders();for(let m of p)(!n[m]||!n[m].has(u))&&c.set(m+":"+u,{oid:m,index:u})}catch{}o=Array.from(c.values())}return[]}l(Bw,"_findMergeBase");var yw=/^.*(\r?\n|$)/gm;function kj({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],o=e[2],f=s.match(yw),c=n.match(yw),a=o.match(yw),u=nL(f,c,a),h=7,d="",p=!0;for(let m of u)m.ok&&(d+=m.ok.join("")),m.conflict&&(p=!1,d+=`${"<".repeat(h)} ${r}
90
- `,d+=m.conflict.a.join(""),d+=`${"=".repeat(h)}
91
- `,d+=m.conflict.b.join(""),d+=`${">".repeat(h)} ${i}
92
- `);return{cleanMerge:p,mergedText:d}}l(kj,"mergeFile");async function Rj({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),index:n,ourOid:s,baseOid:o,theirOid:f,ourName:c="ours",baseName:a="base",theirName:u="theirs",dryRun:h=!1,abortOnConflict:d=!0,mergeDriver:p}){let m=Et({ref:s}),w=Et({ref:o}),y=Et({ref:f}),b=[],_=[],F=[],E=[],R=await ui({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,y],map:l(async function(D,[S,O,v]){let A=Nf(D),x=await Bf(S,O),I=await Bf(v,O);switch(`${x}-${I}`){case"false-false":return{mode:await O.mode(),path:A,oid:await O.oid(),type:await O.type()};case"false-true":return!v&&await S.type()==="tree"?{mode:await S.mode(),path:A,oid:await S.oid(),type:await S.type()}:v?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:void 0;case"true-false":return!S&&await v.type()==="tree"?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:S?{mode:await S.mode(),path:A,oid:await S.oid(),type:await S.type()}:void 0;case"true-true":{if(S&&v&&await S.type()==="tree"&&await v.type()==="tree")return{mode:await S.mode(),path:A,oid:await S.oid(),type:"tree"};if(S&&v&&await S.type()==="blob"&&await v.type()==="blob")return Oj({fs:t,gitdir:i,path:A,ours:S,base:O,theirs:v,ourName:c,baseName:a,theirName:u,mergeDriver:p}).then(async M=>{if(M.cleanMerge)d||n.insert({filepath:D,oid:M.mergeResult.oid,stage:0});else if(b.push(D),_.push(D),!d){let H="";O&&await O.type()==="blob"&&(H=await O.oid());let Te=await S.oid(),ft=await v.oid();n.delete({filepath:D}),H&&n.insert({filepath:D,oid:H,stage:1}),n.insert({filepath:D,oid:Te,stage:2}),n.insert({filepath:D,oid:ft,stage:3})}return M.mergeResult});if(O&&!S&&v&&await O.type()==="blob"&&await v.type()==="blob"){if(b.push(D),F.push(D),!d){let M=await O.oid(),H=await v.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:M,stage:1}),n.insert({filepath:D,oid:H,stage:3})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:A}}if(O&&S&&!v&&await O.type()==="blob"&&await S.type()==="blob"){if(b.push(D),E.push(D),!d){let M=await O.oid(),H=await S.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:M,stage:1}),n.insert({filepath:D,oid:H,stage:2})}return{mode:await S.mode(),oid:await S.oid(),type:"blob",path:A}}if(O&&!S&&!v&&(await O.type()==="blob"||await O.type()==="tree"))return;throw new Hs}}},"map"),reduce:b.length!==0&&(!r||d)?void 0:async(D,S)=>{let O=S.filter(Boolean);if(D&&!(D&&D.type==="tree"&&O.length===0&&D.path!==".")){if(O.length>0||D.path==="."&&O.length===0){let A=new pt(O).toObject(),x=await wt({fs:t,gitdir:i,type:"tree",object:A,dryRun:h});D.oid=x}return D}}});return b.length!==0?(r&&!d&&await ui({fs:t,cache:e,dir:r,gitdir:i,trees:[Et({ref:R.oid})],map:l(async function(D,[S]){let O=`${r}/${D}`;if(await S.type()==="blob"){let v=await S.mode(),A=new TextDecoder().decode(await S.content());await t.write(O,A,{mode:v})}return!0},"map")}),new Vs(b,_,F,E)):R.oid}l(Rj,"mergeTree");async function Oj({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:o,theirName:f,baseName:c,dryRun:a,mergeDriver:u=kj}){let h="blob",d="100755",p="",m="";n&&await n.type()==="blob"&&(d=await n.mode(),p=await n.oid(),m=Buffer.from(await n.content()).toString("utf8"));let w=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};if(await i.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await s.oid(),type:h}};if(await s.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};let y=Buffer.from(await i.content()).toString("utf8"),b=Buffer.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:F}=await u({branches:[c,o,f],contents:[m,y,b],path:r}),E=await wt({fs:t,gitdir:e,type:"blob",object:Buffer.from(_,"utf8"),dryRun:a});return{cleanMerge:F,mergeResult:{mode:w,path:r,oid:E,type:h}}}l(Oj,"mergeBlobs");async function P1({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:o=!0,fastForwardOnly:f=!1,dryRun:c=!1,noUpdateBranch:a=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,onSign:w,mergeDriver:y,allowUnrelatedHistories:b=!1}){n===void 0&&(n=await mi({fs:t,gitdir:i,fullname:!0})),n=await $.expand({fs:t,gitdir:i,ref:n}),s=await $.expand({fs:t,gitdir:i,ref:s});let _=await $.resolve({fs:t,gitdir:i,ref:n}),F=await $.resolve({fs:t,gitdir:i,ref:s}),E=await Bw({fs:t,cache:e,gitdir:i,oids:[_,F]});if(E.length!==1)if(E.length===0&&b)E.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Hs;let R=E[0];if(R===F)return{oid:_,alreadyMerged:!0};if(o&&R===_)return!c&&!a&&await $.writeRef({fs:t,gitdir:i,ref:n,value:F}),{oid:F,fastForward:!0};{if(f)throw new Ga;let D=await Ee.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async O=>Rj({fs:t,cache:e,dir:r,gitdir:i,index:O,ourOid:_,theirOid:F,baseOid:R,ourName:Yi(n),baseName:"base",theirName:Yi(s),dryRun:c,abortOnConflict:u,mergeDriver:y}));if(D instanceof Vs)throw D;return h||(h=`Merge branch '${Yi(s)}' into ${Yi(n)}`),{oid:await Ou({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:D,parent:[_,F],author:d,committer:p,signingKey:m,onSign:w,dryRun:c,noUpdateBranch:a}),tree:D,mergeCommit:!0}}}l(P1,"_merge");async function N1({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,dir:c,gitdir:a,ref:u,url:h,remote:d,remoteRef:p,prune:m,pruneTags:w,fastForward:y,fastForwardOnly:b,corsProxy:_,singleBranch:F,headers:E,author:R,committer:D,signingKey:S}){try{if(!u){let A=await mi({fs:t,gitdir:a});if(!A)throw new dt("ref");u=A}let{fetchHead:O,fetchHeadDescription:v}=await $w({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,gitdir:a,corsProxy:_,ref:u,url:h,remote:d,remoteRef:p,singleBranch:F,headers:E,prune:m,pruneTags:w});await P1({fs:t,cache:e,gitdir:a,ours:u,theirs:O,fastForward:y,fastForwardOnly:b,message:`Merge ${v}`,author:R,committer:D,signingKey:S,dryRun:!1,noUpdateBranch:!1}),await Cw({fs:t,cache:e,onProgress:i,dir:c,gitdir:a,ref:u,remote:d,noCheckout:!1})}catch(O){throw O.caller="git.pull",O}}l(N1,"_pull");async function D1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(f,".git"),ref:a,url:u,remote:h,remoteRef:d,corsProxy:p,singleBranch:m,headers:w={},cache:y={}}){try{k("fs",t),k("http",e),k("gitdir",c);let b={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await N1({fs:new L(t),cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c,ref:a,url:u,remote:h,remoteRef:d,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:w,author:b,committer:b})}catch(b){throw b.caller="git.fastForward",b}}l(D1,"fastForward");async function C1({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(f,".git"),ref:a,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:b=!1,tags:_=!1,singleBranch:F=!1,headers:E={},prune:R=!1,pruneTags:D=!1,cache:S={}}){try{return k("fs",t),k("http",e),k("gitdir",c),await $w({fs:new L(t),cache:S,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:a,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m,since:w,exclude:y,relative:b,tags:_,singleBranch:F,headers:E,prune:R,pruneTags:D})}catch(O){throw O.caller="git.fetch",O}}l(C1,"fetch");async function I1({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oids",i),await Bw({fs:new L(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}l(I1,"findMergeBase");async function $1({fs:t,filepath:e}){if(await t.exists(C(e,".git")))return e;{let r=Ws(e);if(r===e)throw new le(`git root for ${e}`);return $1({fs:t,filepath:r})}}l($1,"_findRoot");async function B1({fs:t,filepath:e}){try{return k("fs",t),k("filepath",e),await $1({fs:new L(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}l(B1,"findRoot");async function M1({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await rc({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}l(M1,"getConfig");async function xj({fs:t,gitdir:e,path:r}){return(await Se.get({fs:t,gitdir:e})).getall(r)}l(xj,"_getConfigAll");async function L1({fs:t,dir:e,gitdir:r=C(e,".git"),path:i}){try{return k("fs",t),k("gitdir",r),k("path",i),await xj({fs:new L(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}l(L1,"getConfigAll");async function j1({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1}){try{k("http",t),k("url",s);let a=await Qs.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:1}),u={capabilities:[...a.capabilities]};for(let[h,d]of a.refs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}for(let[h,d]of a.symrefs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}return u}catch(c){throw c.caller="git.getRemoteInfo",c}}l(j1,"getRemoteInfo");function q1(t,e,r,i){let n=[];for(let[s,o]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let c=s.replace("^{}",""),a=n[n.length-1],u=a.ref===c?a:n.find(h=>h.ref===c);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}let f={ref:s,oid:o};r&&t.symrefs.has(s)&&(f.target=t.symrefs.get(s)),n.push(f)}return n}l(q1,"formatInfoRefs");async function U1({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1,protocolVersion:c=2}){try{k("http",t),k("url",s);let u=await Qs.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:c});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let h={};for(let d of u.capabilities){let[p,m]=d.split("=");m?h[p]=m:h[p]=!0}return{protocolVersion:1,capabilities:h,refs:q1(u,void 0,!0,!0)}}catch(a){throw a.caller="git.getRemoteInfo2",a}}l(U1,"getRemoteInfo2");async function Aj({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=li.wrap({type:t,object:e})),i=await Mr(e)),{oid:i,object:e}}l(Aj,"hashObject");async function W1({object:t}){try{k("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await Aj({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}l(W1,"hashBlob");async function Pj({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=C(i,s);let o=await t.read(s),f=l(a=>he({fs:t,cache:e,gitdir:n,oid:a}),"getExternalRefDelta"),c=await Ua.fromPack({pack:o,getExternalRefDelta:f,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await c.toBuffer()),{oids:[...c.hashes]}}catch(o){throw o.caller="git.indexPack",o}}l(Pj,"_indexPack");async function z1({fs:t,onProgress:e,dir:r,gitdir:i=C(r,".git"),filepath:n,cache:s={}}){try{return k("fs",t),k("dir",r),k("gitdir",r),k("filepath",n),await Pj({fs:new L(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(o){throw o.caller="git.indexPack",o}}l(z1,"indexPack");async function H1({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C(r,".git"),defaultBranch:n="master"}){try{return k("fs",t),k("gitdir",i),e||k("dir",r),await S1({fs:new L(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}l(H1,"init");async function V1({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let o=await Qi.read({fs:t,gitdir:r});if(!i)throw new dt("oid");if(!n)throw new dt("ancestor");if(i===n)return!1;let f=[i],c=new Set,a=0;for(;f.length;){if(a++===s)throw new Ka(s);let u=f.shift(),{type:h,object:d}=await he({fs:t,cache:e,gitdir:r,oid:u});if(h!=="commit")throw new ot(u,h,"commit");let p=mt.from(d).parse();for(let m of p.parent)if(m===n)return!0;if(!o.has(u))for(let m of p.parent)c.has(m)||(f.push(m),c.add(m))}return!1}l(V1,"_isDescendent");async function G1({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:o={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),k("ancestor",n),await V1({fs:new L(t),cache:o,gitdir:r,oid:i,ancestor:n,depth:s})}catch(f){throw f.caller="git.isDescendent",f}}l(G1,"isDescendent");async function J1({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i}){try{return k("fs",t),k("dir",e),k("gitdir",r),k("filepath",i),hi.isIgnored({fs:new L(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}l(J1,"isIgnored");async function K1({fs:t,dir:e,gitdir:r=C(e,".git"),remote:i}){try{return k("fs",t),k("gitdir",r),$.listBranches({fs:new L(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.listBranches",n}}l(K1,"listBranches");async function Nj({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await X1({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return Ee.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}l(Nj,"_listFiles");async function X1({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:o}=await ro({fs:t,cache:e,gitdir:r,oid:i});for(let f of o)f.type==="tree"?await X1({fs:t,cache:e,gitdir:r,oid:f.oid,filenames:n,prefix:C(s,f.path)}):n.push(C(s,f.path))}l(X1,"accumulateFilesFromOid");async function Y1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),await Nj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}l(Y1,"listFiles");async function Dj({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await $.resolve({gitdir:r,fs:t,ref:i})}catch(f){if(f instanceof le)return[]}return(await ro({fs:t,cache:e,gitdir:r,oid:n})).tree.map(f=>({target:f.path,note:f.oid}))}l(Dj,"_listNotes");async function Z1({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return k("fs",t),k("gitdir",r),k("ref",i),await Dj({fs:new L(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}l(Z1,"listNotes");async function Q1({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i}){try{return k("fs",t),k("gitdir",r),$.listRefs({fs:new L(t),gitdir:r,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}l(Q1,"listRefs");async function Cj({fs:t,gitdir:e}){let r=await Se.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let o=await r.get(`remote.${s}.url`);return{remote:s,url:o}}))}l(Cj,"_listRemotes");async function ek({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return k("fs",t),k("gitdir",r),await Cj({fs:new L(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}l(ek,"listRemotes");async function Ij(t){let e=be.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...o]=i.split(" "),f={ref:s,oid:n};for(let c of o){let[a,u]=c.split(":");a==="symref-target"?f.target=u:a==="peeled"&&(f.peeled=u)}r.push(f)}return r}l(Ij,"parseListRefsResponse");async function $j({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(be.encode(`command=ls-refs
93
- `)),i.push(be.encode(`agent=${xu.agent}
94
- `)),(r||e||t)&&i.push(be.delim()),r&&i.push(be.encode("peel")),e&&i.push(be.encode("symrefs")),t&&i.push(be.encode(`ref-prefix ${t}`)),i.push(be.flush()),i}l($j,"writeListRefsRequest");async function tk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:o={},forPush:f=!1,protocolVersion:c=2,prefix:a,symrefs:u,peelTags:h}){try{k("http",t),k("url",s);let d=await Zs.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:c});if(d.protocolVersion===1)return q1(d,a,u,h);let p=await $j({prefix:a,symrefs:u,peelTags:h}),m=await Zs.connect({http:t,auth:d.auth,headers:o,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,body:p});return Ij(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}l(tk,"listServerRefs");async function rk({fs:t,dir:e,gitdir:r=C(e,".git")}){try{return k("fs",t),k("gitdir",r),$.listTags({fs:new L(t),gitdir:r})}catch(i){throw i.caller="git.listTags",i}}l(rk,"listTags");function Bj(t,e){return t.committer.timestamp-e.committer.timestamp}l(Bj,"compareAge");var Mj="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function HT({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===Mj)return;let s=i,o,f=await Ks({fs:t,cache:e,gitdir:r,oid:i}),c=f.tree;return n===f.oid?o=f.path:(o=await ik({fs:t,cache:e,gitdir:r,tree:c,fileId:n,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}l(HT,"resolveFileIdInTree");async function ik({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:o=[],parentPath:f=""}){let c=i.entries().map(function(a){let u;return a.oid===n?(u=C(f,a.path),o.push(u)):a.type==="tree"&&(u=he({fs:t,cache:e,gitdir:r,oid:a.oid}).then(function({object:h}){return ik({fs:t,cache:e,gitdir:r,tree:pt.from(h),fileId:n,oid:s,filepaths:o,parentPath:C(f,a.path)})})),u});return await Promise.all(c),o}l(ik,"_resolveFileId");async function Lj({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:o,force:f,follow:c}){let a=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],h=await Qi.read({fs:t,gitdir:r}),d=await $.resolve({fs:t,gitdir:r,ref:n}),p=[await Ys({fs:t,cache:e,gitdir:r,oid:d})],m,w,y;function b(_){y&&i&&u.push(_)}for(l(b,"endCommit");p.length>0;){let _=p.pop();if(a!==void 0&&_.commit.committer.timestamp<=a)break;if(i){let F;try{F=await nc({fs:t,cache:e,gitdir:r,oid:_.commit.tree,filepath:i}),w&&m!==F&&u.push(w),m=F,w=_,y=!0}catch(E){if(E instanceof le){let R=c&&m;if(R&&(R=await HT({fs:t,cache:e,gitdir:r,oid:_.commit.tree,fileId:m}),R))if(Array.isArray(R)){if(w){let D=await HT({fs:t,cache:e,gitdir:r,oid:w.commit.tree,fileId:m});if(Array.isArray(D))if(R=R.filter(S=>D.indexOf(S)===-1),R.length===1)R=R[0],i=R,w&&u.push(w);else{R=!1,w&&u.push(w);break}}}else i=R,w&&u.push(w);if(!R){if(y&&m&&(u.push(w),!f))break;if(!f&&!c)throw E}w=_,y=!1}else throw E}}else u.push(_);if(s!==void 0&&u.length===s){b(_);break}if(!h.has(_.oid))for(let F of _.commit.parent){let E=await Ys({fs:t,cache:e,gitdir:r,oid:F});p.map(R=>R.oid).includes(E.oid)||p.push(E)}p.length===0&&b(_),p.sort((F,E)=>Bj(F.commit,E.commit))}return u}l(Lj,"_log");async function nk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:o,force:f,follow:c,cache:a={}}){try{return k("fs",t),k("gitdir",r),k("ref",n),await Lj({fs:new L(t),cache:a,gitdir:r,filepath:i,ref:n,depth:s,since:o,force:f,follow:c})}catch(u){throw u.caller="git.log",u}}l(nk,"log");async function sk({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ours:n,theirs:s,fastForward:o=!0,fastForwardOnly:f=!1,dryRun:c=!1,noUpdateBranch:a=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,cache:w={},mergeDriver:y,allowUnrelatedHistories:b=!1}){try{k("fs",t),m&&k("onSign",e);let _=new L(t),F=await di({fs:_,gitdir:i,author:d});if(!F&&(!f||!o))throw new Ye("author");let E=await Xs({fs:_,gitdir:i,author:F,committer:p});if(!E&&(!f||!o))throw new Ye("committer");return await P1({fs:_,cache:w,dir:r,gitdir:i,ours:n,theirs:s,fastForward:o,fastForwardOnly:f,dryRun:c,noUpdateBranch:a,abortOnConflict:u,message:h,author:F,committer:E,signingKey:m,onSign:e,mergeDriver:y,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}l(sk,"merge");var jj={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function ok({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new GT,o=[];function f(u,h){let d=Buffer.from(u,h);o.push(d),s.update(d)}l(f,"write");async function c({stype:u,object:h}){let d=jj[u],p=h.length,m=p>15?128:0,w=p&15;p=p>>>4;let y=(m|d|w).toString(16);for(f(y,"hex");m;)m=p>127?128:0,y=m|p&127,f(Pw(2,y),"hex"),p=p>>>7;f(Buffer.from(await s1(h)))}l(c,"writeObject"),f("PACK"),f("00000002","hex"),f(Pw(8,n.length),"hex");for(let u of n){let{type:h,object:d}=await he({fs:t,cache:e,gitdir:i,oid:u});await c({write:f,object:d,stype:h})}let a=s.digest();return o.push(a),o}l(ok,"_pack");async function qj({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await ok({fs:t,cache:e,gitdir:r,oids:i}),o=Buffer.from(await Mf(s)),c=`pack-${o.slice(-20).toString("hex")}.pack`;return n?(await t.write(C(r,`objects/pack/${c}`),o),{filename:c}):{filename:c,packfile:new Uint8Array(o)}}l(qj,"_packObjects");async function ak({fs:t,dir:e,gitdir:r=C(e,".git"),oids:i,write:n=!1,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oids",i),await qj({fs:new L(t),cache:s,gitdir:r,oids:i,write:n})}catch(o){throw o.caller="git.packObjects",o}}l(ak,"packObjects");async function ck({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c=C(f,".git"),ref:a,url:u,remote:h,remoteRef:d,prune:p=!1,pruneTags:m=!1,fastForward:w=!0,fastForwardOnly:y=!1,corsProxy:b,singleBranch:_,headers:F={},author:E,committer:R,signingKey:D,cache:S={}}){try{k("fs",t),k("gitdir",c);let O=new L(t),v=await di({fs:O,gitdir:c,author:E});if(!v)throw new Ye("author");let A=await Xs({fs:O,gitdir:c,author:v,committer:R});if(!A)throw new Ye("committer");return await N1({fs:O,cache:S,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:c,ref:a,url:u,remote:h,remoteRef:d,fastForward:w,fastForwardOnly:y,corsProxy:b,singleBranch:_,headers:F,author:v,committer:A,signingKey:D,prune:p,pruneTags:m})}catch(O){throw O.caller="git.pull",O}}l(ck,"pull");async function Uj({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),start:n,finish:s}){let o=await Qi.read({fs:t,gitdir:i}),f=new Set,c=new Set;for(let h of n)f.add(await $.resolve({fs:t,gitdir:i,ref:h}));for(let h of s)try{let d=await $.resolve({fs:t,gitdir:i,ref:h});c.add(d)}catch{}let a=new Set;async function u(h){a.add(h);let{type:d,object:p}=await he({fs:t,cache:e,gitdir:i,oid:h});if(d==="tag"){let w=Ft.from(p).headers().object;return u(w)}if(d!=="commit")throw new ot(h,d,"commit");if(!o.has(h)){let w=mt.from(p).headers().parent;for(h of w)!c.has(h)&&!a.has(h)&&await u(h)}}l(u,"walk");for(let h of f)await u(h);return a}l(Uj,"listCommitsAndTags");async function gw({fs:t,cache:e,dir:r,gitdir:i=C(r,".git"),oids:n}){let s=new Set;async function o(f){if(s.has(f))return;s.add(f);let{type:c,object:a}=await he({fs:t,cache:e,gitdir:i,oid:f});if(c==="tag"){let h=Ft.from(a).headers().object;await o(h)}else if(c==="commit"){let h=mt.from(a).headers().tree;await o(h)}else if(c==="tree"){let u=pt.from(a);for(let h of u)h.type==="blob"&&s.add(h.oid),h.type==="tree"&&await o(h.oid)}}l(o,"walk");for(let f of n)await o(f);return s}l(gw,"listObjects");async function Wj(t){let e={},r="",i=be.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+`
95
- `),n=await i();let s=r.toString("utf8").split(`
96
- `);if(n=s.shift(),!n.startsWith("unpack "))throw new Zi('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let f=o.slice(0,2),c=o.slice(3),a=c.indexOf(" ");a===-1&&(a=c.length);let u=c.slice(0,a),h=c.slice(a+1);e.refs[u]={ok:f==="ok",error:h}}return e}l(Wj,"parseReceivePackResponse");async function zj({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(be.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
97
- `)),i="";return r.push(be.flush()),r}l(zj,"writeReceivePackRequest");async function Hj({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:o,onAuthFailure:f,onPrePush:c,gitdir:a,ref:u,remoteRef:h,remote:d,url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:b={}}){let _=u||await mi({fs:t,gitdir:a});if(typeof _>"u")throw new dt("ref");let F=await Se.get({fs:t,gitdir:a});d=d||await F.get(`branch.${_}.pushRemote`)||await F.get("remote.pushDefault")||await F.get(`branch.${_}.remote`)||"origin";let E=p||await F.get(`remote.${d}.pushurl`)||await F.get(`remote.${d}.url`);if(typeof E>"u")throw new dt("remote OR url");let R=h||await F.get(`branch.${_}.merge`);if(typeof E>"u")throw new dt("remoteRef");y===void 0&&(y=await F.get("http.corsProxy"));let D=await $.expand({fs:t,gitdir:a,ref:_}),S=w?"0000000000000000000000000000000000000000":await $.resolve({fs:t,gitdir:a,ref:D}),O=Qs.getRemoteHelperFor({url:E}),v=await O.discover({http:r,onAuth:s,onAuthSuccess:o,onAuthFailure:f,corsProxy:y,service:"git-receive-pack",url:E,headers:b,protocolVersion:1}),A=v.auth,x;if(!R)x=D;else try{x=await $.expandAgainstMap({ref:R,map:v.refs})}catch(ge){if(ge instanceof le)x=R.startsWith("refs/")?R:`refs/heads/${R}`;else throw ge}let I=v.refs.get(x)||"0000000000000000000000000000000000000000";if(c&&!await c({remote:d,url:E,localRef:{ref:w?"(delete)":D,oid:S},remoteRef:{ref:x,oid:I}}))throw new Js;let M=!v.capabilities.has("no-thin"),H=new Set;if(!w){let ge=[...v.refs.values()],sr=new Set;if(I!=="0000000000000000000000000000000000000000"){let Ge=await Bw({fs:t,cache:e,gitdir:a,oids:[S,I]});for(let Ho of Ge)ge.push(Ho);M&&(sr=await gw({fs:t,cache:e,gitdir:a,oids:Ge}))}if(!ge.includes(S)){let Ge=await Uj({fs:t,cache:e,gitdir:a,start:[S],finish:ge});H=await gw({fs:t,cache:e,gitdir:a,oids:Ge})}if(M){try{let Ge=await $.resolve({fs:t,gitdir:a,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Ho}=await $.resolveAgainstMap({ref:Ge.replace(`refs/remotes/${d}/`,""),fullref:Ge,map:v.refs}),Ai=[Ho];for(let Pe of await gw({fs:t,cache:e,gitdir:a,oids:Ai}))sr.add(Pe)}catch{}for(let Ge of sr)H.delete(Ge)}if(S===I&&(m=!0),!m){if(D.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Gs("tag-exists");if(S!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await V1({fs:t,cache:e,gitdir:a,oid:S,ancestor:I,depth:-1}))throw new Gs("not-fast-forward")}}let Te=b1([...v.capabilities],["report-status","side-band-64k",`agent=${xu.agent}`]),ft=await zj({capabilities:Te,triplets:[{oldoid:I,oid:S,fullRef:x}]}),zt=w?[]:await ok({fs:t,cache:e,gitdir:a,oids:[...H]}),Ht=await O.connect({http:r,onProgress:i,corsProxy:y,service:"git-receive-pack",url:E,auth:A,headers:b,body:[...ft,...zt]}),{packfile:Fd,progress:Td}=await Lf.demux(Ht.body);if(n){let ge=_1(Td);oc(ge,async sr=>{await n(sr)})}let yt=await Wj(Fd);if(Ht.headers&&(yt.headers=Ht.headers),d&&yt.ok&&yt.refs[x].ok&&!D.startsWith("refs/tags")){let ge=`refs/remotes/${d}/${x.replace("refs/heads","")}`;w?await $.deleteRef({fs:t,gitdir:a,ref:ge}):await $.writeRef({fs:t,gitdir:a,ref:ge,value:S})}if(yt.ok&&Object.values(yt.refs).every(ge=>ge.ok))return yt;{let ge=Object.entries(yt.refs).filter(([sr,Ge])=>!Ge.ok).map(([sr,Ge])=>`
98
- - ${sr}: ${Ge.error}`).join("");throw new Ja(ge,yt)}}l(Hj,"_push");async function lk({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:f,dir:c,gitdir:a=C(c,".git"),ref:u,remoteRef:h,remote:d="origin",url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:b={},cache:_={}}){try{return k("fs",t),k("http",e),k("gitdir",a),await Hj({fs:new L(t),cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:f,gitdir:a,ref:u,remoteRef:h,remote:d,url:p,force:m,delete:w,corsProxy:y,headers:b})}catch(F){throw F.caller="git.push",F}}l(lk,"push");async function fk({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Ft.from(s).parse().object,fk({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new ot(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}l(fk,"resolveBlob");async function uk({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await nc({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await fk({fs:t,cache:e,gitdir:r,oid:i})}l(uk,"_readBlob");async function hk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await uk({fs:new L(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(o){throw o.caller="git.readBlob",o}}l(hk,"readBlob");async function Mw({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Ys({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readCommit",s}}l(Mw,"readCommit");async function Vj({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await $.resolve({gitdir:r,fs:t,ref:i}),{blob:o}=await uk({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return o}l(Vj,"_readNote");async function dk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("ref",i),k("oid",n),await Vj({fs:new L(t),cache:s,gitdir:r,ref:i,oid:n})}catch(o){throw o.caller="git.readNote",o}}l(dk,"readNote");async function pk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:o=void 0,cache:f={}}){try{k("fs",t),k("gitdir",r),k("oid",i);let c=new L(t);s!==void 0&&(i=await nc({fs:c,cache:f,gitdir:r,oid:i,filepath:s}));let u=await he({fs:c,cache:f,gitdir:r,oid:i,format:n==="parsed"?"content":n});if(u.oid=i,n==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=mt.from(u.object).parse();break;case"tree":u.object=pt.from(u.object).entries();break;case"blob":o?u.object=u.object.toString(o):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Ft.from(u.object).parse();break;default:throw new ot(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(c){throw c.caller="git.readObject",c}}l(pk,"readObject");async function Gj({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await he({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new ot(i,n,"tag");let o=Ft.from(s);return{oid:i,tag:o.parse(),payload:o.payload()}}l(Gj,"_readTag");async function mk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,cache:n={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await Gj({fs:new L(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readTag",s}}l(mk,"readTag");async function wk({fs:t,dir:e,gitdir:r=C(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{return k("fs",t),k("gitdir",r),k("oid",i),await ro({fs:new L(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(o){throw o.caller="git.readTree",o}}l(wk,"readTree");async function yk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{k("fs",t),k("gitdir",r),k("filepath",i),await Ee.acquire({fs:new L(t),gitdir:r,cache:n},async function(s){s.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}l(yk,"remove");async function Jj({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:o,committer:f,signingKey:c}){let a;try{a=await $.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof le))throw m}let h=(await ro({fs:t,cache:e,gitdir:i,oid:a||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;h=h.filter(m=>m.path!==s);let d=await sc({fs:t,gitdir:i,tree:h});return await Ou({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:a&&[a],message:`Note removed by 'isomorphic-git removeNote'
99
- `,author:o,committer:f,signingKey:c})}l(Jj,"_removeNote");async function gk({fs:t,onSign:e,dir:r,gitdir:i=C(r,".git"),ref:n="refs/notes/commits",oid:s,author:o,committer:f,signingKey:c,cache:a={}}){try{k("fs",t),k("gitdir",i),k("oid",s);let u=new L(t),h=await di({fs:u,gitdir:i,author:o});if(!h)throw new Ye("author");let d=await Xs({fs:u,gitdir:i,author:h,committer:f});if(!d)throw new Ye("committer");return await Jj({fs:u,cache:a,onSign:e,gitdir:i,ref:n,oid:s,author:h,committer:d,signingKey:c})}catch(u){throw u.caller="git.removeNote",u}}l(gk,"removeNote");async function Kj({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!ic(i,!0))throw new Zt(i,La.clean(i));if(!ic(r,!0))throw new Zt(r,La.clean(r));let s=`refs/heads/${r}`,o=`refs/heads/${i}`;if(await $.exists({fs:t,gitdir:e,ref:o}))throw new Yt("branch",i,!1);let c=await $.resolve({fs:t,gitdir:e,ref:s,depth:1});await $.writeRef({fs:t,gitdir:e,ref:o,value:c}),await $.deleteRef({fs:t,gitdir:e,ref:s});let u=await mi({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}l(Kj,"_renameBranch");async function bk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{return k("fs",t),k("gitdir",r),k("ref",i),k("oldref",n),await Kj({fs:new L(t),gitdir:r,ref:i,oldref:n,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}l(bk,"renameBranch");async function _k({gitdir:t,type:e,object:r}){return Mr(li.wrap({type:e,object:r}))}l(_k,"hashObject$1");async function Sk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,ref:n,cache:s={}}){try{k("fs",t),k("gitdir",r),k("filepath",i);let o=new L(t),f,c;try{f=await $.resolve({fs:o,gitdir:r,ref:n||"HEAD"})}catch(h){if(n)throw h}if(f)try{f=await nc({fs:o,cache:s,gitdir:r,oid:f,filepath:i})}catch{f=null}let a={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await o.read(C(e,i));u&&(c=await _k({gitdir:r,type:"blob",object:u}),f===c&&(a=await o.lstat(C(e,i)))),await Ee.acquire({fs:o,gitdir:r,cache:s},async function(h){h.delete({filepath:i}),f&&h.insert({filepath:i,stats:a,oid:f})})}catch(o){throw o.caller="git.reset",o}}l(Sk,"resetIndex");async function vk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,depth:n}){try{return k("fs",t),k("gitdir",r),k("ref",i),await $.resolve({fs:new L(t),gitdir:r,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}l(vk,"resolveRef");async function Ek({fs:t,dir:e,gitdir:r=C(e,".git"),path:i,value:n,append:s=!1}){try{k("fs",t),k("gitdir",r),k("path",i);let o=new L(t),f=await Se.get({fs:o,gitdir:r});s?await f.append(i,n):await f.set(i,n),await Se.save({fs:o,gitdir:r,config:f})}catch(o){throw o.caller="git.setConfig",o}}l(Ek,"setConfig");async function Fk({fs:t,gitdir:e,commit:r}){let i=mt.from(r).toObject();return await wt({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}l(Fk,"_writeCommit");var Tu=class Tu{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),f=Tu.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${o} ${f} ${i}
100
- `}static getStashReflogEntry(e,r=!1){return e.split(`
101
- `).filter(s=>s).reverse().map((s,o)=>r?`stash@{${o}}: ${s.split(" ")[1]}`:s)}};l(Tu,"GitRefStash");var jf=Tu,Xj={stage:tn,workdir:to},bw;async function eo(t,e){return bw===void 0&&(bw=new Ma),bw.acquire(t,e)}l(eo,"acquireLock$1");async function Yj(t,e,r,i,n=null){let s=C(r,i),o=await t.lstat(s);if(!o)throw new le(s);if(o.isDirectory())throw new z(`${s}: file expected, but found directory`);let f=n?await QT({fs:t,gitdir:e,oid:n}):void 0,c=f?n:void 0;return f||await eo({fs:t,gitdir:e,currentFilepath:s},async()=>{let a=o.isSymbolicLink()?await t.readlink(s).then(o1):await t.read(s);if(a===null)throw new le(s);c=await wt({fs:t,gitdir:e,type:"blob",object:a})}),c}l(Yj,"checkAndWriteBlob");async function Zj({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(n));s.oid=await sc({fs:t,gitdir:r,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await Yj(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return l(n,"processTreeEntry"),Promise.all(i.map(n))}l(Zj,"processTreeEntries");async function VT({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(p=>typeof p=="string"?Xj[p]():p),o=[],u=await ui({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:l(async(p,[m,w])=>{if(!(p==="."||await hi.isIgnored({fs:t,dir:e,gitdir:r,filepath:p}))&&w)return(!m||await m.oid()!==await w.oid()&&await w.oid()!==void 0)&&o.push([m,w]),{mode:await w.mode(),path:p,oid:await w.oid(),type:await w.type()}},"map"),reduce:l(async(p,m)=>(m=m.filter(Boolean),p?(p.children=m,p):m.length>0?m:void 0),"reduce"),iterate:l(async(p,m)=>{let w=[];for(let y of m){let[b,_]=y;n?_&&(await t.exists(`${e}/${_.toString()}`)?w.push(y):o.push([null,_])):b&&(_?w.push(y):o.push([b,null]))}return w.length?Promise.all(w.map(p)):[]},"iterate")});if(o.length===0||u.length===0)return null;let d=(await Zj({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(p=>({mode:p.mode,path:p.path,oid:p.oid,type:p.type}));return sc({fs:t,gitdir:r,tree:d})}l(VT,"writeTreeChanges");async function Qj({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let o=[],f=[],c=await ui({fs:t,cache:{},dir:e,gitdir:r,trees:[Et({ref:n}),Et({ref:i})],map:l(async(a,[u,h])=>{if(a==="."||await hi.isIgnored({fs:t,dir:e,gitdir:r,filepath:a}))return;let d=h?await h.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!h&&u){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&o.push(a),d==="blob"&&s&&f.push({filepath:a,oid:await u.oid()}),{method:m,filepath:a}}let p=await h.oid();if(!u||await u.oid()!==p)return d==="tree"?{method:"mkdir",filepath:a}:(s&&f.push({filepath:a,oid:p,stats:await t.lstat(C(e,a))}),{method:"write",filepath:a,oid:p})},"map")});await eo({fs:t,gitdir:r,dirRemoved:o,ops:c},async()=>{for(let a of c){let u=C(e,a.filepath);switch(a.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!o.some(h=>u.startsWith(h))){let{object:h}=await he({fs:t,cache:{},gitdir:r,oid:a.oid});await t.exists(u)&&await t.rm(u),await t.write(u,h)}break}}}),await Ee.acquire({fs:t,gitdir:r,cache:{}},async a=>{f.forEach(({filepath:u,stats:h,oid:d})=>{a.insert({filepath:u,stats:h,oid:d})})})}l(Qj,"applyTreeChanges");var Ls=class Ls{constructor({fs:e,dir:r,gitdir:i=C(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return C(this.gitdir,Ls.refStash)}get refLogsStashPath(){return C(this.gitdir,Ls.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await di({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Ye("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return Fk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Zt(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?Ys({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return $.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Ls.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=jf.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await eo({filepath:s,entry:n},async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return jf.getStashReflogEntry(r,e)}};l(Ls,"GitStashManager");var en=Ls;async function Tk({fs:t,dir:e,gitdir:r,message:i=""}){let n=new en({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await mi({fs:t,gitdir:r,fullname:!1}),o=await $.resolve({fs:t,gitdir:r,ref:"HEAD"}),c=(await Mw({fs:t,dir:e,gitdir:r,oid:o})).commit.message,a=[o],u=null,h=Et({ref:"HEAD"}),d=await VT({fs:t,dir:e,gitdir:r,treePair:[Et({ref:"HEAD"}),"stage"]});if(d){let y=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:a});a.push(y),u=d,h=tn()}let p=await VT({fs:t,dir:e,gitdir:r,treePair:[h,"workdir"]});if(p){let y=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:p,parent:[a[a.length-1]]});a.push(y),u=p}if(!u||!d&&!p)throw new le("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${c}`;return{stashCommit:await n.writeStashCommit({message:m,tree:u,parent:a}),stashMsg:m,branch:s,stashMgr:n}}l(Tk,"_createStashCommit");async function eq({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:o,stashMgr:f}=await Tk({fs:t,dir:e,gitdir:r,message:i});return await f.writeStashRef(n),await f.writeStashReflogEntry({stashCommit:n,message:s}),await Iw({fs:t,dir:e,gitdir:r,ref:o,track:!1,force:!0}),n}l(eq,"_stashPush");async function tq({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await Tk({fs:t,dir:e,gitdir:r,message:i});return n}l(tq,"_stashCreate");async function kk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new en({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let f=0;f<o.length-1;f++){let a=(await Ys({fs:t,cache:{},gitdir:r,oid:o[f+1]})).commit.message.startsWith("stash-Index");await Qj({fs:t,dir:e,gitdir:r,stashCommit:o[f+1],parentCommit:o[f],wasStaged:a})}}l(kk,"_stashApply");async function Rk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new en({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let o=n.refStashPath;await eo(o,async()=>{await t.exists(o)&&await t.rm(o)});let f=await n.readStashReflogs({parsed:!1});if(!f.length)return;f.splice(i,1);let c=n.refLogsStashPath;await eo({reflogEntries:f,stashReflogPath:c,stashMgr:n},async()=>{if(f.length){await t.write(c,f.reverse().join(`
89
+ `),await p.write(d+"/HEAD",`ref: refs/heads/${w}
90
+ `)}c(Xh,"ag"),h(Xh,"_init");async function qy({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,onPostCheckout:I,dir:O,gitdir:x,url:L,corsProxy:q,ref:ae,remote:ce,depth:Re,since:Be,exclude:qe,relative:We,singleBranch:Qe,noCheckout:at,noTags:ot,headers:nt,nonBlocking:Ve,batchSize:tt=100}){try{if(await Xh({fs:p,gitdir:x}),await Mh({fs:p,gitdir:x,remote:ce,url:L,force:!1}),q){let Dt=await ut.get({fs:p,gitdir:x});await Dt.set("http.corsProxy",q),await ut.save({fs:p,gitdir:x,config:Dt})}let{defaultBranch:rt,fetchHead:yt}=await kl({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,gitdir:x,ref:ae,remote:ce,corsProxy:q,depth:Re,since:Be,exclude:qe,relative:We,singleBranch:Qe,headers:nt,tags:!ot});if(yt===null)return;ae=ae||rt,ae=ae.replace("refs/heads/",""),await yl({fs:p,cache:s,onProgress:d,onPostCheckout:I,dir:O,gitdir:x,ref:ae,remote:ce,noCheckout:at,nonBlocking:Ve,batchSize:tt})}catch(rt){throw await p.rmdir(x,{recursive:!0,maxRetries:10}).catch(()=>{}),rt}}c(qy,"jk"),h(qy,"_clone");async function Qh({fs:p,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,onPostCheckout:k,dir:I,gitdir:O=Y(I,".git"),url:x,corsProxy:L=void 0,ref:q=void 0,remote:ae="origin",depth:ce=void 0,since:Re=void 0,exclude:Be=[],relative:qe=!1,singleBranch:We=!1,noCheckout:Qe=!1,noTags:at=!1,headers:ot={},cache:nt={},nonBlocking:Ve=!1,batchSize:tt=100}){try{return ie("fs",p),ie("http",s),ie("gitdir",O),Qe||ie("dir",I),ie("url",x),await qy({fs:new ct(p),cache:nt,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,onPostCheckout:k,dir:I,gitdir:O,url:x,corsProxy:L,ref:q,remote:ae,depth:ce,since:Re,exclude:Be,relative:qe,singleBranch:We,noCheckout:Qe,noTags:at,headers:ot,nonBlocking:Ve,batchSize:tt})}catch(rt){throw rt.caller="git.clone",rt}}c(Qh,"og"),h(Qh,"clone");async function Zh({fs:p,onSign:s,dir:u,gitdir:d=Y(u,".git"),message:w,author:_,committer:E,signingKey:k,amend:I=!1,dryRun:O=!1,noUpdateBranch:x=!1,ref:L,parent:q,tree:ae,cache:ce={}}){try{ie("fs",p),I||ie("message",w),k&&ie("onSign",s);let Re=new ct(p);return await mo({fs:Re,cache:ce,onSign:s,gitdir:d,message:w,author:_,committer:E,signingKey:k,amend:I,dryRun:O,noUpdateBranch:x,ref:L,parent:q,tree:ae})}catch(Re){throw Re.caller="git.commit",Re}}c(Zh,"sg"),h(Zh,"commit");async function eu({fs:p,dir:s,gitdir:u=Y(s,".git"),fullname:d=!1,test:w=!1}){try{return ie("fs",p),ie("gitdir",u),await vi({fs:new ct(p),gitdir:u,fullname:d,test:w})}catch(_){throw _.caller="git.currentBranch",_}}c(eu,"lg"),h(eu,"currentBranch");async function zy({fs:p,gitdir:s,ref:u}){if(u=u.startsWith("refs/heads/")?u:`refs/heads/${u}`,!await ze.exists({fs:p,gitdir:s,ref:u}))throw new se(u);let d=await ze.expand({fs:p,gitdir:s,ref:u}),w=await vi({fs:p,gitdir:s,fullname:!0});if(d===w){let k=await ze.resolve({fs:p,gitdir:s,ref:d});await ze.writeRef({fs:p,gitdir:s,ref:"HEAD",value:k})}await ze.deleteRef({fs:p,gitdir:s,ref:d});let _=Mi(u),E=await ut.get({fs:p,gitdir:s});await E.deleteSection("branch",_),await ut.save({fs:p,gitdir:s,config:E})}c(zy,"Hk"),h(zy,"_deleteBranch");async function tu({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d}){try{return ie("fs",p),ie("ref",d),await zy({fs:new ct(p),gitdir:u,ref:d})}catch(w){throw w.caller="git.deleteBranch",w}}c(tu,"cg"),h(tu,"deleteBranch");async function ru({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d}){try{ie("fs",p),ie("ref",d),await ze.deleteRef({fs:new ct(p),gitdir:u,ref:d})}catch(w){throw w.caller="git.deleteRef",w}}c(ru,"fg"),h(ru,"deleteRef");async function Hy({fs:p,gitdir:s,remote:u}){let d=await ut.get({fs:p,gitdir:s});await d.deleteSection("remote",u),await ut.save({fs:p,gitdir:s,config:d})}c(Hy,"qk"),h(Hy,"_deleteRemote");async function iu({fs:p,dir:s,gitdir:u=Y(s,".git"),remote:d}){try{return ie("fs",p),ie("remote",d),await Hy({fs:new ct(p),gitdir:u,remote:d})}catch(w){throw w.caller="git.deleteRemote",w}}c(iu,"ug"),h(iu,"deleteRemote");async function Gy({fs:p,gitdir:s,ref:u}){u=u.startsWith("refs/tags/")?u:`refs/tags/${u}`,await ze.deleteRef({fs:p,gitdir:s,ref:u})}c(Gy,"Uk"),h(Gy,"_deleteTag");async function nu({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d}){try{return ie("fs",p),ie("ref",d),await Gy({fs:new ct(p),gitdir:u,ref:d})}catch(w){throw w.caller="git.deleteTag",w}}c(nu,"dg"),h(nu,"deleteTag");async function Vy({fs:p,gitdir:s,oid:u}){let d=u.slice(0,2);return(await p.readdir(`${s}/objects/${d}`)).map(w=>`${d}${w}`).filter(w=>w.startsWith(u))}c(Vy,"zk"),h(Vy,"expandOidLoose");async function Ky({fs:p,cache:s,gitdir:u,oid:d,getExternalRefDelta:w}){let _=[],E=await p.readdir(Y(u,"objects/pack"));E=E.filter(k=>k.endsWith(".idx"));for(let k of E){let I=`${u}/objects/pack/${k}`,O=await ol({fs:p,cache:s,filename:I,getExternalRefDelta:w});if(O.error)throw new T(O.error);for(let x of O.offsets.keys())x.startsWith(d)&&_.push(x)}return _}c(Ky,"Wk"),h(Ky,"expandOidPacked");async function Jy({fs:p,cache:s,gitdir:u,oid:d}){let w=h(k=>jt({fs:p,cache:s,gitdir:u,oid:k}),"getExternalRefDelta"),_=await Vy({fs:p,gitdir:u,oid:d}),E=await Ky({fs:p,cache:s,gitdir:u,oid:d,getExternalRefDelta:w});for(let k of E)_.indexOf(k)===-1&&_.push(k);if(_.length===1)return _[0];throw _.length>1?new uh("oids",d,_):new se(`an object matching "${d}"`)}c(Jy,"Vk"),h(Jy,"_expandOid");async function su({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,cache:w={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),await Jy({fs:new ct(p),cache:w,gitdir:u,oid:d})}catch(_){throw _.caller="git.expandOid",_}}c(su,"hg"),h(su,"expandOid");async function au({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),await ze.expand({fs:new ct(p),gitdir:u,ref:d})}catch(w){throw w.caller="git.expandRef",w}}c(au,"pg"),h(au,"expandRef");async function Rl({fs:p,cache:s,gitdir:u,oids:d}){let w={},_=d.length,E=d.map((k,I)=>({index:I,oid:k}));for(;E.length;){let k=new Set;for(let{oid:O,index:x}of E)w[O]||(w[O]=new Set),w[O].add(x),w[O].size===_&&k.add(O);if(k.size>0)return[...k];let I=new Map;for(let{oid:O,index:x}of E)try{let{object:L}=await jt({fs:p,cache:s,gitdir:u,oid:O}),q=Wr.from(L),{parent:ae}=q.parseHeaders();for(let ce of ae)(!w[ce]||!w[ce].has(x))&&I.set(ce+":"+x,{oid:ce,index:x})}catch{}E=Array.from(I.values())}return[]}c(Rl,"Nc"),h(Rl,"_findMergeBase");var ou=/^.*(\r?\n|$)/gm;function Yy({branches:p,contents:s}){let u=p[1],d=p[2],w=s[0],_=s[1],E=s[2],k=_.match(ou),I=w.match(ou),O=E.match(ou),x=a(k,I,O),L=7,q="",ae=!0;for(let ce of x)ce.ok&&(q+=ce.ok.join("")),ce.conflict&&(ae=!1,q+=`${"<".repeat(L)} ${u}
91
+ `,q+=ce.conflict.a.join(""),q+=`${"=".repeat(L)}
92
+ `,q+=ce.conflict.b.join(""),q+=`${">".repeat(L)} ${d}
93
+ `);return{cleanMerge:ae,mergedText:q}}c(Yy,"Gk"),h(Yy,"mergeFile");async function Xy({fs:p,cache:s,dir:u,gitdir:d=Y(u,".git"),index:w,ourOid:_,baseOid:E,theirOid:k,ourName:I="ours",baseName:O="base",theirName:x="theirs",dryRun:L=!1,abortOnConflict:q=!0,mergeDriver:ae}){let ce=Or({ref:_}),Re=Or({ref:E}),Be=Or({ref:k}),qe=[],We=[],Qe=[],at=[],ot=await bi({fs:p,cache:s,dir:u,gitdir:d,trees:[ce,Re,Be],map:h(async function(nt,[Ve,tt,rt]){let yt=Je(nt),Dt=await po(Ve,tt),Zt=await po(rt,tt);switch(`${Dt}-${Zt}`){case"false-false":return{mode:await tt.mode(),path:yt,oid:await tt.oid(),type:await tt.type()};case"false-true":return!rt&&await Ve.type()==="tree"?{mode:await Ve.mode(),path:yt,oid:await Ve.oid(),type:await Ve.type()}:rt?{mode:await rt.mode(),path:yt,oid:await rt.oid(),type:await rt.type()}:void 0;case"true-false":return!Ve&&await rt.type()==="tree"?{mode:await rt.mode(),path:yt,oid:await rt.oid(),type:await rt.type()}:Ve?{mode:await Ve.mode(),path:yt,oid:await Ve.oid(),type:await Ve.type()}:void 0;case"true-true":{if(Ve&&rt&&await Ve.type()==="tree"&&await rt.type()==="tree")return{mode:await Ve.mode(),path:yt,oid:await Ve.oid(),type:"tree"};if(Ve&&rt&&await Ve.type()==="blob"&&await rt.type()==="blob")return Qy({fs:p,gitdir:d,path:yt,ours:Ve,base:tt,theirs:rt,ourName:I,baseName:O,theirName:x,mergeDriver:ae}).then(async xt=>{if(xt.cleanMerge)q||w.insert({filepath:nt,oid:xt.mergeResult.oid,stage:0});else if(qe.push(nt),We.push(nt),!q){let er="";tt&&await tt.type()==="blob"&&(er=await tt.oid());let ur=await Ve.oid(),ri=await rt.oid();w.delete({filepath:nt}),er&&w.insert({filepath:nt,oid:er,stage:1}),w.insert({filepath:nt,oid:ur,stage:2}),w.insert({filepath:nt,oid:ri,stage:3})}return xt.mergeResult});if(tt&&!Ve&&rt&&await tt.type()==="blob"&&await rt.type()==="blob"){if(qe.push(nt),Qe.push(nt),!q){let xt=await tt.oid(),er=await rt.oid();w.delete({filepath:nt}),w.insert({filepath:nt,oid:xt,stage:1}),w.insert({filepath:nt,oid:er,stage:3})}return{mode:await rt.mode(),oid:await rt.oid(),type:"blob",path:yt}}if(tt&&Ve&&!rt&&await tt.type()==="blob"&&await Ve.type()==="blob"){if(qe.push(nt),at.push(nt),!q){let xt=await tt.oid(),er=await Ve.oid();w.delete({filepath:nt}),w.insert({filepath:nt,oid:xt,stage:1}),w.insert({filepath:nt,oid:er,stage:2})}return{mode:await Ve.mode(),oid:await Ve.oid(),type:"blob",path:yt}}if(tt&&!Ve&&!rt&&(await tt.type()==="blob"||await tt.type()==="tree"))return;throw new cl}}},"map"),reduce:qe.length!==0&&(!u||q)?void 0:async(nt,Ve)=>{let tt=Ve.filter(Boolean);if(nt&&!(nt&&nt.type==="tree"&&tt.length===0&&nt.path!==".")){if(tt.length>0||nt.path==="."&&tt.length===0){let rt=new Lr(tt).toObject(),yt=await vr({fs:p,gitdir:d,type:"tree",object:rt,dryRun:L});nt.oid=yt}return nt}}});return qe.length!==0?(u&&!q&&await bi({fs:p,cache:s,dir:u,gitdir:d,trees:[Or({ref:ot.oid})],map:h(async function(nt,[Ve]){let tt=`${u}/${nt}`;if(await Ve.type()==="blob"){let rt=await Ve.mode(),yt=new TextDecoder().decode(await Ve.content());await p.write(tt,yt,{mode:rt})}return!0},"map")}),new fl(qe,We,Qe,at)):ot.oid}c(Xy,"Zk"),h(Xy,"mergeTree");async function Qy({fs:p,gitdir:s,path:u,ours:d,base:w,theirs:_,ourName:E,theirName:k,baseName:I,dryRun:O,mergeDriver:x=Yy}){let L="blob",q="100755",ae="",ce="";w&&await w.type()==="blob"&&(q=await w.mode(),ae=await w.oid(),ce=Buffer.from(await w.content()).toString("utf8"));let Re=q===await d.mode()?await _.mode():await d.mode();if(await d.oid()===await _.oid())return{cleanMerge:!0,mergeResult:{mode:Re,path:u,oid:await d.oid(),type:L}};if(await d.oid()===ae)return{cleanMerge:!0,mergeResult:{mode:Re,path:u,oid:await _.oid(),type:L}};if(await _.oid()===ae)return{cleanMerge:!0,mergeResult:{mode:Re,path:u,oid:await d.oid(),type:L}};let Be=Buffer.from(await d.content()).toString("utf8"),qe=Buffer.from(await _.content()).toString("utf8"),{mergedText:We,cleanMerge:Qe}=await x({branches:[I,E,k],contents:[ce,Be,qe],path:u}),at=await vr({fs:p,gitdir:s,type:"blob",object:Buffer.from(We,"utf8"),dryRun:O});return{cleanMerge:Qe,mergeResult:{mode:Re,path:u,oid:at,type:L}}}c(Qy,"Kk"),h(Qy,"mergeBlobs");async function lu({fs:p,cache:s,dir:u,gitdir:d,ours:w,theirs:_,fastForward:E=!0,fastForwardOnly:k=!1,dryRun:I=!1,noUpdateBranch:O=!1,abortOnConflict:x=!0,message:L,author:q,committer:ae,signingKey:ce,onSign:Re,mergeDriver:Be,allowUnrelatedHistories:qe=!1}){w===void 0&&(w=await vi({fs:p,gitdir:d,fullname:!0})),w=await ze.expand({fs:p,gitdir:d,ref:w}),_=await ze.expand({fs:p,gitdir:d,ref:_});let We=await ze.resolve({fs:p,gitdir:d,ref:w}),Qe=await ze.resolve({fs:p,gitdir:d,ref:_}),at=await Rl({fs:p,cache:s,gitdir:d,oids:[We,Qe]});if(at.length!==1)if(at.length===0&&qe)at.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new cl;let ot=at[0];if(ot===Qe)return{oid:We,alreadyMerged:!0};if(E&&ot===We)return!I&&!O&&await ze.writeRef({fs:p,gitdir:d,ref:w,value:Qe}),{oid:Qe,fastForward:!0};{if(k)throw new gh;let nt=await me.acquire({fs:p,gitdir:d,cache:s,allowUnmerged:!1},async Ve=>Xy({fs:p,cache:s,dir:u,gitdir:d,index:Ve,ourOid:We,theirOid:Qe,baseOid:ot,ourName:Mi(w),baseName:"base",theirName:Mi(_),dryRun:I,abortOnConflict:x,mergeDriver:Be}));if(nt instanceof fl)throw nt;return L||(L=`Merge branch '${Mi(_)}' into ${Mi(w)}`),{oid:await mo({fs:p,cache:s,gitdir:d,message:L,ref:w,tree:nt,parent:[We,Qe],author:q,committer:ae,signingKey:ce,onSign:Re,dryRun:I,noUpdateBranch:O}),tree:nt,mergeCommit:!0}}}c(lu,"mg"),h(lu,"_merge");async function cu({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,dir:I,gitdir:O,ref:x,url:L,remote:q,remoteRef:ae,prune:ce,pruneTags:Re,fastForward:Be,fastForwardOnly:qe,corsProxy:We,singleBranch:Qe,headers:at,author:ot,committer:nt,signingKey:Ve}){try{if(!x){let yt=await vi({fs:p,gitdir:O});if(!yt)throw new Ur("ref");x=yt}let{fetchHead:tt,fetchHeadDescription:rt}=await kl({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,gitdir:O,corsProxy:We,ref:x,url:L,remote:q,remoteRef:ae,singleBranch:Qe,headers:at,prune:ce,pruneTags:Re});await lu({fs:p,cache:s,gitdir:O,ours:x,theirs:tt,fastForward:Be,fastForwardOnly:qe,message:`Merge ${rt}`,author:ot,committer:nt,signingKey:Ve,dryRun:!1,noUpdateBranch:!1}),await yl({fs:p,cache:s,onProgress:d,dir:I,gitdir:O,ref:x,remote:q,noCheckout:!1})}catch(tt){throw tt.caller="git.pull",tt}}c(cu,"wg"),h(cu,"_pull");async function fu({fs:p,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,dir:k,gitdir:I=Y(k,".git"),ref:O,url:x,remote:L,remoteRef:q,corsProxy:ae,singleBranch:ce,headers:Re={},cache:Be={}}){try{ie("fs",p),ie("http",s),ie("gitdir",I);let qe={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await cu({fs:new ct(p),cache:Be,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,dir:k,gitdir:I,ref:O,url:x,remote:L,remoteRef:q,fastForwardOnly:!0,corsProxy:ae,singleBranch:ce,headers:Re,author:qe,committer:qe})}catch(qe){throw qe.caller="git.fastForward",qe}}c(fu,"gg"),h(fu,"fastForward");async function hu({fs:p,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,dir:k,gitdir:I=Y(k,".git"),ref:O,remote:x,remoteRef:L,url:q,corsProxy:ae,depth:ce=null,since:Re=null,exclude:Be=[],relative:qe=!1,tags:We=!1,singleBranch:Qe=!1,headers:at={},prune:ot=!1,pruneTags:nt=!1,cache:Ve={}}){try{return ie("fs",p),ie("http",s),ie("gitdir",I),await kl({fs:new ct(p),cache:Ve,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,gitdir:I,ref:O,remote:x,remoteRef:L,url:q,corsProxy:ae,depth:ce,since:Re,exclude:Be,relative:qe,tags:We,singleBranch:Qe,headers:at,prune:ot,pruneTags:nt})}catch(tt){throw tt.caller="git.fetch",tt}}c(hu,"yg"),h(hu,"fetch");async function uu({fs:p,dir:s,gitdir:u=Y(s,".git"),oids:d,cache:w={}}){try{return ie("fs",p),ie("gitdir",u),ie("oids",d),await Rl({fs:new ct(p),cache:w,gitdir:u,oids:d})}catch(_){throw _.caller="git.findMergeBase",_}}c(uu,"bg"),h(uu,"findMergeBase");async function du({fs:p,filepath:s}){if(await p.exists(Y(s,".git")))return s;{let u=He(s);if(u===s)throw new se(`git root for ${s}`);return du({fs:p,filepath:u})}}c(du,"_g"),h(du,"_findRoot");async function pu({fs:p,filepath:s}){try{return ie("fs",p),ie("filepath",s),await du({fs:new ct(p),filepath:s})}catch(u){throw u.caller="git.findRoot",u}}c(pu,"vg"),h(pu,"findRoot");async function mu({fs:p,dir:s,gitdir:u=Y(s,".git"),path:d}){try{return ie("fs",p),ie("gitdir",u),ie("path",d),await ys({fs:new ct(p),gitdir:u,path:d})}catch(w){throw w.caller="git.getConfig",w}}c(mu,"Fg"),h(mu,"getConfig");async function Zy({fs:p,gitdir:s,path:u}){return(await ut.get({fs:p,gitdir:s})).getall(u)}c(Zy,"Yk"),h(Zy,"_getConfigAll");async function gu({fs:p,dir:s,gitdir:u=Y(s,".git"),path:d}){try{return ie("fs",p),ie("gitdir",u),ie("path",d),await Zy({fs:new ct(p),gitdir:u,path:d})}catch(w){throw w.caller="git.getConfigAll",w}}c(gu,"Sg"),h(gu,"getConfigAll");async function yu({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,url:_,headers:E={},forPush:k=!1}){try{ie("http",p),ie("url",_);let I=await Sl.getRemoteHelperFor({url:_}).discover({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,service:k?"git-receive-pack":"git-upload-pack",url:_,headers:E,protocolVersion:1}),O={capabilities:[...I.capabilities]};for(let[x,L]of I.refs){let q=x.split("/"),ae=q.pop(),ce=O;for(let Re of q)ce[Re]=ce[Re]||{},ce=ce[Re];ce[ae]=L}for(let[x,L]of I.symrefs){let q=x.split("/"),ae=q.pop(),ce=O;for(let Re of q)ce[Re]=ce[Re]||{},ce=ce[Re];ce[ae]=L}return O}catch(I){throw I.caller="git.getRemoteInfo",I}}c(yu,"Eg"),h(yu,"getRemoteInfo");function wu(p,s,u,d){let w=[];for(let[_,E]of p.refs){if(s&&!_.startsWith(s))continue;if(_.endsWith("^{}")){if(d){let I=_.replace("^{}",""),O=w[w.length-1],x=O.ref===I?O:w.find(L=>L.ref===I);if(x===void 0)throw new Error("I did not expect this to happen");x.peeled=E}continue}let k={ref:_,oid:E};u&&p.symrefs.has(_)&&(k.target=p.symrefs.get(_)),w.push(k)}return w}c(wu,"kg"),h(wu,"formatInfoRefs");async function bu({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,url:_,headers:E={},forPush:k=!1,protocolVersion:I=2}){try{ie("http",p),ie("url",_);let O=await Sl.getRemoteHelperFor({url:_}).discover({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,service:k?"git-receive-pack":"git-upload-pack",url:_,headers:E,protocolVersion:I});if(O.protocolVersion===2)return{protocolVersion:O.protocolVersion,capabilities:O.capabilities2};let x={};for(let L of O.capabilities){let[q,ae]=L.split("=");ae?x[q]=ae:x[q]=!0}return{protocolVersion:1,capabilities:x,refs:wu(O,void 0,!0,!0)}}catch(O){throw O.caller="git.getRemoteInfo2",O}}c(bu,"xg"),h(bu,"getRemoteInfo2");async function ew({type:p,object:s,format:u="content",oid:d=void 0}){return u!=="deflated"&&(u!=="wrapped"&&(s=ds.wrap({type:p,object:s})),d=await j(s)),{oid:d,object:s}}c(ew,"Xk"),h(ew,"hashObject");async function _u({object:p}){try{ie("object",p),typeof p=="string"?p=Buffer.from(p,"utf8"):p instanceof Uint8Array||(p=new Uint8Array(p));let s="blob",{oid:u,object:d}=await ew({type:s,format:"content",object:p});return{oid:u,type:s,object:d,format:"wrapped"}}catch(s){throw s.caller="git.hashBlob",s}}c(_u,"Pg"),h(_u,"hashBlob");async function tw({fs:p,cache:s,onProgress:u,dir:d,gitdir:w,filepath:_}){try{_=Y(d,_);let E=await p.read(_),k=h(O=>jt({fs:p,cache:s,gitdir:w,oid:O}),"getExternalRefDelta"),I=await hh.fromPack({pack:E,getExternalRefDelta:k,onProgress:u});return await p.write(_.replace(/\.pack$/,".idx"),await I.toBuffer()),{oids:[...I.hashes]}}catch(E){throw E.caller="git.indexPack",E}}c(tw,"Jk"),h(tw,"_indexPack");async function vu({fs:p,onProgress:s,dir:u,gitdir:d=Y(u,".git"),filepath:w,cache:_={}}){try{return ie("fs",p),ie("dir",u),ie("gitdir",u),ie("filepath",w),await tw({fs:new ct(p),cache:_,onProgress:s,dir:u,gitdir:d,filepath:w})}catch(E){throw E.caller="git.indexPack",E}}c(vu,"Tg"),h(vu,"indexPack");async function Su({fs:p,bare:s=!1,dir:u,gitdir:d=s?u:Y(u,".git"),defaultBranch:w="master"}){try{return ie("fs",p),ie("gitdir",d),s||ie("dir",u),await Xh({fs:new ct(p),bare:s,dir:u,gitdir:d,defaultBranch:w})}catch(_){throw _.caller="git.init",_}}c(Su,"Ag"),h(Su,"init");async function Eu({fs:p,cache:s,gitdir:u,oid:d,ancestor:w,depth:_}){let E=await yo.read({fs:p,gitdir:u});if(!d)throw new Ur("oid");if(!w)throw new Ur("ancestor");if(d===w)return!1;let k=[d],I=new Set,O=0;for(;k.length;){if(O++===_)throw new wh(_);let x=k.shift(),{type:L,object:q}=await jt({fs:p,cache:s,gitdir:u,oid:x});if(L!=="commit")throw new _e(x,L,"commit");let ae=Wr.from(q).parse();for(let ce of ae.parent)if(ce===w)return!0;if(!E.has(x))for(let ce of ae.parent)I.has(ce)||(k.push(ce),I.add(ce))}return!1}c(Eu,"Og"),h(Eu,"_isDescendent");async function Fu({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,ancestor:w,depth:_=-1,cache:E={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),ie("ancestor",w),await Eu({fs:new ct(p),cache:E,gitdir:u,oid:d,ancestor:w,depth:_})}catch(k){throw k.caller="git.isDescendent",k}}c(Fu,"Dg"),h(Fu,"isDescendent");async function ku({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d}){try{return ie("fs",p),ie("dir",s),ie("gitdir",u),ie("filepath",d),gs.isIgnored({fs:new ct(p),dir:s,gitdir:u,filepath:d})}catch(w){throw w.caller="git.isIgnored",w}}c(ku,"Rg"),h(ku,"isIgnored");async function Ru({fs:p,dir:s,gitdir:u=Y(s,".git"),remote:d}){try{return ie("fs",p),ie("gitdir",u),ze.listBranches({fs:new ct(p),gitdir:u,remote:d})}catch(w){throw w.caller="git.listBranches",w}}c(Ru,"Cg"),h(Ru,"listBranches");async function rw({fs:p,gitdir:s,ref:u,cache:d}){if(u){let w=await ze.resolve({gitdir:s,fs:p,ref:u}),_=[];return await Tu({fs:p,cache:d,gitdir:s,oid:w,filenames:_,prefix:""}),_}else return me.acquire({fs:p,gitdir:s,cache:d},async function(w){return w.entries.map(_=>_.path)})}c(rw,"Qk"),h(rw,"_listFiles");async function Tu({fs:p,cache:s,gitdir:u,oid:d,filenames:w,prefix:_}){let{tree:E}=await on({fs:p,cache:s,gitdir:u,oid:d});for(let k of E)k.type==="tree"?await Tu({fs:p,cache:s,gitdir:u,oid:k.oid,filenames:w,prefix:Y(_,k.path)}):w.push(Y(_,k.path))}c(Tu,"Ig"),h(Tu,"accumulateFilesFromOid");async function Ou({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,cache:w={}}){try{return ie("fs",p),ie("gitdir",u),await rw({fs:new ct(p),cache:w,gitdir:u,ref:d})}catch(_){throw _.caller="git.listFiles",_}}c(Ou,"Bg"),h(Ou,"listFiles");async function iw({fs:p,cache:s,gitdir:u,ref:d}){let w;try{w=await ze.resolve({gitdir:u,fs:p,ref:d})}catch(_){if(_ instanceof se)return[]}return(await on({fs:p,cache:s,gitdir:u,oid:w})).tree.map(_=>({target:_.path,note:_.oid}))}c(iw,"ex"),h(iw,"_listNotes");async function xu({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d="refs/notes/commits",cache:w={}}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),await iw({fs:new ct(p),cache:w,gitdir:u,ref:d})}catch(_){throw _.caller="git.listNotes",_}}c(xu,"Ng"),h(xu,"listNotes");async function Au({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d}){try{return ie("fs",p),ie("gitdir",u),ze.listRefs({fs:new ct(p),gitdir:u,filepath:d})}catch(w){throw w.caller="git.listRefs",w}}c(Au,"$g"),h(Au,"listRefs");async function nw({fs:p,gitdir:s}){let u=await ut.get({fs:p,gitdir:s}),d=await u.getSubsections("remote");return Promise.all(d.map(async w=>{let _=await u.get(`remote.${w}.url`);return{remote:w,url:_}}))}c(nw,"tx"),h(nw,"_listRemotes");async function Pu({fs:p,dir:s,gitdir:u=Y(s,".git")}){try{return ie("fs",p),ie("gitdir",u),await nw({fs:new ct(p),gitdir:u})}catch(d){throw d.caller="git.listRemotes",d}}c(Pu,"Lg"),h(Pu,"listRemotes");async function sw(p){let s=zt.streamReader(p),u=[],d;for(;d=await s(),d!==!0;){if(d===null)continue;d=d.toString("utf8").replace(/\n$/,"");let[w,_,...E]=d.split(" "),k={ref:_,oid:w};for(let I of E){let[O,x]=I.split(":");O==="symref-target"?k.target=x:O==="peeled"&&(k.peeled=x)}u.push(k)}return u}c(sw,"rx"),h(sw,"parseListRefsResponse");async function aw({prefix:p,symrefs:s,peelTags:u}){let d=[];return d.push(zt.encode(`command=ls-refs
94
+ `)),d.push(zt.encode(`agent=${El.agent}
95
+ `)),(u||s||p)&&d.push(zt.delim()),u&&d.push(zt.encode("peel")),s&&d.push(zt.encode("symrefs")),p&&d.push(zt.encode(`ref-prefix ${p}`)),d.push(zt.flush()),d}c(aw,"ix"),h(aw,"writeListRefsRequest");async function Du({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,url:_,headers:E={},forPush:k=!1,protocolVersion:I=2,prefix:O,symrefs:x,peelTags:L}){try{ie("http",p),ie("url",_);let q=await vl.discover({http:p,onAuth:s,onAuthSuccess:u,onAuthFailure:d,corsProxy:w,service:k?"git-receive-pack":"git-upload-pack",url:_,headers:E,protocolVersion:I});if(q.protocolVersion===1)return wu(q,O,x,L);let ae=await aw({prefix:O,symrefs:x,peelTags:L}),ce=await vl.connect({http:p,auth:q.auth,headers:E,corsProxy:w,service:k?"git-receive-pack":"git-upload-pack",url:_,body:ae});return sw(ce.body)}catch(q){throw q.caller="git.listServerRefs",q}}c(Du,"Mg"),h(Du,"listServerRefs");async function Nu({fs:p,dir:s,gitdir:u=Y(s,".git")}){try{return ie("fs",p),ie("gitdir",u),ze.listTags({fs:new ct(p),gitdir:u})}catch(d){throw d.caller="git.listTags",d}}c(Nu,"jg"),h(Nu,"listTags");function ow(p,s){return p.committer.timestamp-s.committer.timestamp}c(ow,"nx"),h(ow,"compareAge");var gS="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function Cu({fs:p,cache:s,gitdir:u,oid:d,fileId:w}){if(w===gS)return;let _=d,E,k=await rn({fs:p,cache:s,gitdir:u,oid:d}),I=k.tree;return w===k.oid?E=k.path:(E=await Iu({fs:p,cache:s,gitdir:u,tree:I,fileId:w,oid:_}),Array.isArray(E)&&(E.length===0?E=void 0:E.length===1&&(E=E[0]))),E}c(Cu,"Aw"),h(Cu,"resolveFileIdInTree");async function Iu({fs:p,cache:s,gitdir:u,tree:d,fileId:w,oid:_,filepaths:E=[],parentPath:k=""}){let I=d.entries().map(function(O){let x;return O.oid===w?(x=Y(k,O.path),E.push(x)):O.type==="tree"&&(x=jt({fs:p,cache:s,gitdir:u,oid:O.oid}).then(function({object:L}){return Iu({fs:p,cache:s,gitdir:u,tree:Lr.from(L),fileId:w,oid:_,filepaths:E,parentPath:Y(k,O.path)})})),x});return await Promise.all(I),E}c(Iu,"Hg"),h(Iu,"_resolveFileId");async function lw({fs:p,cache:s,gitdir:u,filepath:d,ref:w,depth:_,since:E,force:k,follow:I}){let O=typeof E>"u"?void 0:Math.floor(E.valueOf()/1e3),x=[],L=await yo.read({fs:p,gitdir:u}),q=await ze.resolve({fs:p,gitdir:u,ref:w}),ae=[await an({fs:p,cache:s,gitdir:u,oid:q})],ce,Re,Be;function qe(We){Be&&d&&x.push(We)}for(c(qe,"g"),h(qe,"endCommit");ae.length>0;){let We=ae.pop();if(O!==void 0&&We.commit.committer.timestamp<=O)break;if(d){let Qe;try{Qe=await ws({fs:p,cache:s,gitdir:u,oid:We.commit.tree,filepath:d}),Re&&ce!==Qe&&x.push(Re),ce=Qe,Re=We,Be=!0}catch(at){if(at instanceof se){let ot=I&&ce;if(ot&&(ot=await Cu({fs:p,cache:s,gitdir:u,oid:We.commit.tree,fileId:ce}),ot))if(Array.isArray(ot)){if(Re){let nt=await Cu({fs:p,cache:s,gitdir:u,oid:Re.commit.tree,fileId:ce});if(Array.isArray(nt))if(ot=ot.filter(Ve=>nt.indexOf(Ve)===-1),ot.length===1)ot=ot[0],d=ot,Re&&x.push(Re);else{ot=!1,Re&&x.push(Re);break}}}else d=ot,Re&&x.push(Re);if(!ot){if(Be&&ce&&(x.push(Re),!k))break;if(!k&&!I)throw at}Re=We,Be=!1}else throw at}}else x.push(We);if(_!==void 0&&x.length===_){qe(We);break}if(!L.has(We.oid))for(let Qe of We.commit.parent){let at=await an({fs:p,cache:s,gitdir:u,oid:Qe});ae.map(ot=>ot.oid).includes(at.oid)||ae.push(at)}ae.length===0&&qe(We),ae.sort((Qe,at)=>ow(Qe.commit,at.commit))}return x}c(lw,"ox"),h(lw,"_log");async function Bu({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d,ref:w="HEAD",depth:_,since:E,force:k,follow:I,cache:O={}}){try{return ie("fs",p),ie("gitdir",u),ie("ref",w),await lw({fs:new ct(p),cache:O,gitdir:u,filepath:d,ref:w,depth:_,since:E,force:k,follow:I})}catch(x){throw x.caller="git.log",x}}c(Bu,"qg"),h(Bu,"log");async function ju({fs:p,onSign:s,dir:u,gitdir:d=Y(u,".git"),ours:w,theirs:_,fastForward:E=!0,fastForwardOnly:k=!1,dryRun:I=!1,noUpdateBranch:O=!1,abortOnConflict:x=!0,message:L,author:q,committer:ae,signingKey:ce,cache:Re={},mergeDriver:Be,allowUnrelatedHistories:qe=!1}){try{ie("fs",p),ce&&ie("onSign",s);let We=new ct(p),Qe=await _i({fs:We,gitdir:d,author:q});if(!Qe&&(!k||!E))throw new Tr("author");let at=await sn({fs:We,gitdir:d,author:Qe,committer:ae});if(!at&&(!k||!E))throw new Tr("committer");return await lu({fs:We,cache:Re,dir:u,gitdir:d,ours:w,theirs:_,fastForward:E,fastForwardOnly:k,dryRun:I,noUpdateBranch:O,abortOnConflict:x,message:L,author:Qe,committer:at,signingKey:ce,onSign:s,mergeDriver:Be,allowUnrelatedHistories:qe})}catch(We){throw We.caller="git.merge",We}}c(ju,"Ug"),h(ju,"merge");var yS={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function Mu({fs:p,cache:s,dir:u,gitdir:d=Y(u,".git"),oids:w}){let _=new r,E=[];function k(x,L){let q=Buffer.from(x,L);E.push(q),_.update(q)}c(k,"l"),h(k,"write");async function I({stype:x,object:L}){let q=yS[x],ae=L.length,ce=ae>15?128:0,Re=ae&15;ae=ae>>>4;let Be=(ce|q|Re).toString(16);for(k(Be,"hex");ce;)ce=ae>127?128:0,Be=ce|ae&127,k(bl(2,Be),"hex"),ae=ae>>>7;k(Buffer.from(await Ah(L)))}c(I,"u"),h(I,"writeObject"),k("PACK"),k("00000002","hex"),k(bl(8,w.length),"hex");for(let x of w){let{type:L,object:q}=await jt({fs:p,cache:s,gitdir:d,oid:x});await I({write:k,object:q,stype:L})}let O=_.digest();return E.push(O),E}c(Mu,"zg"),h(Mu,"_pack");async function cw({fs:p,cache:s,gitdir:u,oids:d,write:w}){let _=await Mu({fs:p,cache:s,gitdir:u,oids:d}),E=Buffer.from(await go(_)),k=`pack-${E.slice(-20).toString("hex")}.pack`;return w?(await p.write(Y(u,`objects/pack/${k}`),E),{filename:k}):{filename:k,packfile:new Uint8Array(E)}}c(cw,"lx"),h(cw,"_packObjects");async function $u({fs:p,dir:s,gitdir:u=Y(s,".git"),oids:d,write:w=!1,cache:_={}}){try{return ie("fs",p),ie("gitdir",u),ie("oids",d),await cw({fs:new ct(p),cache:_,gitdir:u,oids:d,write:w})}catch(E){throw E.caller="git.packObjects",E}}c($u,"Wg"),h($u,"packObjects");async function Lu({fs:p,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,dir:k,gitdir:I=Y(k,".git"),ref:O,url:x,remote:L,remoteRef:q,prune:ae=!1,pruneTags:ce=!1,fastForward:Re=!0,fastForwardOnly:Be=!1,corsProxy:qe,singleBranch:We,headers:Qe={},author:at,committer:ot,signingKey:nt,cache:Ve={}}){try{ie("fs",p),ie("gitdir",I);let tt=new ct(p),rt=await _i({fs:tt,gitdir:I,author:at});if(!rt)throw new Tr("author");let yt=await sn({fs:tt,gitdir:I,author:rt,committer:ot});if(!yt)throw new Tr("committer");return await cu({fs:tt,cache:Ve,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,dir:k,gitdir:I,ref:O,url:x,remote:L,remoteRef:q,fastForward:Re,fastForwardOnly:Be,corsProxy:qe,singleBranch:We,headers:Qe,author:rt,committer:yt,signingKey:nt,prune:ae,pruneTags:ce})}catch(tt){throw tt.caller="git.pull",tt}}c(Lu,"Vg"),h(Lu,"pull");async function fw({fs:p,cache:s,dir:u,gitdir:d=Y(u,".git"),start:w,finish:_}){let E=await yo.read({fs:p,gitdir:d}),k=new Set,I=new Set;for(let L of w)k.add(await ze.resolve({fs:p,gitdir:d,ref:L}));for(let L of _)try{let q=await ze.resolve({fs:p,gitdir:d,ref:L});I.add(q)}catch{}let O=new Set;async function x(L){O.add(L);let{type:q,object:ae}=await jt({fs:p,cache:s,gitdir:d,oid:L});if(q==="tag"){let ce=ei.from(ae).headers().object;return x(ce)}if(q!=="commit")throw new _e(L,q,"commit");if(!E.has(L)){let ce=Wr.from(ae).headers().parent;for(L of ce)!I.has(L)&&!O.has(L)&&await x(L)}}c(x,"f"),h(x,"walk");for(let L of k)await x(L);return O}c(fw,"cx"),h(fw,"listCommitsAndTags");async function Tl({fs:p,cache:s,dir:u,gitdir:d=Y(u,".git"),oids:w}){let _=new Set;async function E(k){if(_.has(k))return;_.add(k);let{type:I,object:O}=await jt({fs:p,cache:s,gitdir:d,oid:k});if(I==="tag"){let x=ei.from(O).headers().object;await E(x)}else if(I==="commit"){let x=Wr.from(O).headers().tree;await E(x)}else if(I==="tree"){let x=Lr.from(O);for(let L of x)L.type==="blob"&&_.add(L.oid),L.type==="tree"&&await E(L.oid)}}c(E,"s"),h(E,"walk");for(let k of w)await E(k);return _}c(Tl,"gc"),h(Tl,"listObjects");async function hw(p){let s={},u="",d=zt.streamReader(p),w=await d();for(;w!==!0;)w!==null&&(u+=w.toString("utf8")+`
96
+ `),w=await d();let _=u.toString("utf8").split(`
97
+ `);if(w=_.shift(),!w.startsWith("unpack "))throw new ho('unpack ok" or "unpack [error message]',w);s.ok=w==="unpack ok",s.ok||(s.error=w.slice(7)),s.refs={};for(let E of _){if(E.trim()==="")continue;let k=E.slice(0,2),I=E.slice(3),O=I.indexOf(" ");O===-1&&(O=I.length);let x=I.slice(0,O),L=I.slice(O+1);s.refs[x]={ok:k==="ok",error:L}}return s}c(hw,"fx"),h(hw,"parseReceivePackResponse");async function uw({capabilities:p=[],triplets:s=[]}){let u=[],d=`\0 ${p.join(" ")}`;for(let w of s)u.push(zt.encode(`${w.oldoid} ${w.oid} ${w.fullRef}${d}
98
+ `)),d="";return u.push(zt.flush()),u}c(uw,"ux"),h(uw,"writeReceivePackRequest");async function dw({fs:p,cache:s,http:u,onProgress:d,onMessage:w,onAuth:_,onAuthSuccess:E,onAuthFailure:k,onPrePush:I,gitdir:O,ref:x,remoteRef:L,remote:q,url:ae,force:ce=!1,delete:Re=!1,corsProxy:Be,headers:qe={}}){let We=x||await vi({fs:p,gitdir:O});if(typeof We>"u")throw new Ur("ref");let Qe=await ut.get({fs:p,gitdir:O});q=q||await Qe.get(`branch.${We}.pushRemote`)||await Qe.get("remote.pushDefault")||await Qe.get(`branch.${We}.remote`)||"origin";let at=ae||await Qe.get(`remote.${q}.pushurl`)||await Qe.get(`remote.${q}.url`);if(typeof at>"u")throw new Ur("remote OR url");let ot=L||await Qe.get(`branch.${We}.merge`);if(typeof at>"u")throw new Ur("remoteRef");Be===void 0&&(Be=await Qe.get("http.corsProxy"));let nt=await ze.expand({fs:p,gitdir:O,ref:We}),Ve=Re?"0000000000000000000000000000000000000000":await ze.resolve({fs:p,gitdir:O,ref:nt}),tt=Sl.getRemoteHelperFor({url:at}),rt=await tt.discover({http:u,onAuth:_,onAuthSuccess:E,onAuthFailure:k,corsProxy:Be,service:"git-receive-pack",url:at,headers:qe,protocolVersion:1}),yt=rt.auth,Dt;if(!ot)Dt=nt;else try{Dt=await ze.expandAgainstMap({ref:ot,map:rt.refs})}catch(qt){if(qt instanceof se)Dt=ot.startsWith("refs/")?ot:`refs/heads/${ot}`;else throw qt}let Zt=rt.refs.get(Dt)||"0000000000000000000000000000000000000000";if(I&&!await I({remote:q,url:at,localRef:{ref:Re?"(delete)":nt,oid:Ve},remoteRef:{ref:Dt,oid:Zt}}))throw new ul;let xt=!rt.capabilities.has("no-thin"),er=new Set;if(!Re){let qt=[...rt.refs.values()],ci=new Set;if(Zt!=="0000000000000000000000000000000000000000"){let Sr=await Rl({fs:p,cache:s,gitdir:O,oids:[Ve,Zt]});for(let bo of Sr)qt.push(bo);xt&&(ci=await Tl({fs:p,cache:s,gitdir:O,oids:Sr}))}if(!qt.includes(Ve)){let Sr=await fw({fs:p,cache:s,gitdir:O,start:[Ve],finish:qt});er=await Tl({fs:p,cache:s,gitdir:O,oids:Sr})}if(xt){try{let Sr=await ze.resolve({fs:p,gitdir:O,ref:`refs/remotes/${q}/HEAD`,depth:2}),{oid:bo}=await ze.resolveAgainstMap({ref:Sr.replace(`refs/remotes/${q}/`,""),fullref:Sr,map:rt.refs}),Jn=[bo];for(let tr of await Tl({fs:p,cache:s,gitdir:O,oids:Jn}))ci.add(tr)}catch{}for(let Sr of ci)er.delete(Sr)}if(Ve===Zt&&(ce=!0),!ce){if(nt.startsWith("refs/tags")&&Zt!=="0000000000000000000000000000000000000000")throw new hl("tag-exists");if(Ve!=="0000000000000000000000000000000000000000"&&Zt!=="0000000000000000000000000000000000000000"&&!await Eu({fs:p,cache:s,gitdir:O,oid:Ve,ancestor:Zt,depth:-1}))throw new hl("not-fast-forward")}}let ur=Jh([...rt.capabilities],["report-status","side-band-64k",`agent=${El.agent}`]),ri=await uw({capabilities:ur,triplets:[{oldoid:Zt,oid:Ve,fullRef:Dt}]}),$s=Re?[]:await Mu({fs:p,cache:s,gitdir:O,oids:[...er]}),Ls=await tt.connect({http:u,onProgress:d,corsProxy:Be,service:"git-receive-pack",url:at,auth:yt,headers:qe,body:[...ri,...$s]}),{packfile:Sd,progress:Ed}=await Ly.demux(Ls.body);if(w){let qt=Yh(Ed);vs(qt,async ci=>{await w(ci)})}let Pr=await hw(Sd);if(Ls.headers&&(Pr.headers=Ls.headers),q&&Pr.ok&&Pr.refs[Dt].ok&&!nt.startsWith("refs/tags")){let qt=`refs/remotes/${q}/${Dt.replace("refs/heads","")}`;Re?await ze.deleteRef({fs:p,gitdir:O,ref:qt}):await ze.writeRef({fs:p,gitdir:O,ref:qt,value:Ve})}if(Pr.ok&&Object.values(Pr.refs).every(qt=>qt.ok))return Pr;{let qt=Object.entries(Pr.refs).filter(([ci,Sr])=>!Sr.ok).map(([ci,Sr])=>`
99
+ - ${ci}: ${Sr.error}`).join("");throw new yh(qt,Pr)}}c(dw,"dx"),h(dw,"_push");async function Uu({fs:p,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,onPrePush:k,dir:I,gitdir:O=Y(I,".git"),ref:x,remoteRef:L,remote:q="origin",url:ae,force:ce=!1,delete:Re=!1,corsProxy:Be,headers:qe={},cache:We={}}){try{return ie("fs",p),ie("http",s),ie("gitdir",O),await dw({fs:new ct(p),cache:We,http:s,onProgress:u,onMessage:d,onAuth:w,onAuthSuccess:_,onAuthFailure:E,onPrePush:k,gitdir:O,ref:x,remoteRef:L,remote:q,url:ae,force:ce,delete:Re,corsProxy:Be,headers:qe})}catch(Qe){throw Qe.caller="git.push",Qe}}c(Uu,"Gg"),h(Uu,"push");async function Wu({fs:p,cache:s,gitdir:u,oid:d}){let{type:w,object:_}=await jt({fs:p,cache:s,gitdir:u,oid:d});if(w==="tag")return d=ei.from(_).parse().object,Wu({fs:p,cache:s,gitdir:u,oid:d});if(w!=="blob")throw new _e(d,w,"blob");return{oid:d,blob:new Uint8Array(_)}}c(Wu,"Zg"),h(Wu,"resolveBlob");async function qu({fs:p,cache:s,gitdir:u,oid:d,filepath:w=void 0}){return w!==void 0&&(d=await ws({fs:p,cache:s,gitdir:u,oid:d,filepath:w})),await Wu({fs:p,cache:s,gitdir:u,oid:d})}c(qu,"Kg"),h(qu,"_readBlob");async function zu({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,filepath:w,cache:_={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),await qu({fs:new ct(p),cache:_,gitdir:u,oid:d,filepath:w})}catch(E){throw E.caller="git.readBlob",E}}c(zu,"Yg"),h(zu,"readBlob");async function Ol({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,cache:w={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),await an({fs:new ct(p),cache:w,gitdir:u,oid:d})}catch(_){throw _.caller="git.readCommit",_}}c(Ol,"$c"),h(Ol,"readCommit");async function pw({fs:p,cache:s,gitdir:u,ref:d="refs/notes/commits",oid:w}){let _=await ze.resolve({gitdir:u,fs:p,ref:d}),{blob:E}=await qu({fs:p,cache:s,gitdir:u,oid:_,filepath:w});return E}c(pw,"hx"),h(pw,"_readNote");async function Hu({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d="refs/notes/commits",oid:w,cache:_={}}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),ie("oid",w),await pw({fs:new ct(p),cache:_,gitdir:u,ref:d,oid:w})}catch(E){throw E.caller="git.readNote",E}}c(Hu,"Xg"),h(Hu,"readNote");async function Gu({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,format:w="parsed",filepath:_=void 0,encoding:E=void 0,cache:k={}}){try{ie("fs",p),ie("gitdir",u),ie("oid",d);let I=new ct(p);_!==void 0&&(d=await ws({fs:I,cache:k,gitdir:u,oid:d,filepath:_}));let O=await jt({fs:I,cache:k,gitdir:u,oid:d,format:w==="parsed"?"content":w});if(O.oid=d,w==="parsed")switch(O.format="parsed",O.type){case"commit":O.object=Wr.from(O.object).parse();break;case"tree":O.object=Lr.from(O.object).entries();break;case"blob":E?O.object=O.object.toString(E):(O.object=new Uint8Array(O.object),O.format="content");break;case"tag":O.object=ei.from(O.object).parse();break;default:throw new _e(O.oid,O.type,"blob|commit|tag|tree")}else(O.format==="deflated"||O.format==="wrapped")&&(O.type=O.format);return O}catch(I){throw I.caller="git.readObject",I}}c(Gu,"Jg"),h(Gu,"readObject");async function mw({fs:p,cache:s,gitdir:u,oid:d}){let{type:w,object:_}=await jt({fs:p,cache:s,gitdir:u,oid:d,format:"content"});if(w!=="tag")throw new _e(d,w,"tag");let E=ei.from(_);return{oid:d,tag:E.parse(),payload:E.payload()}}c(mw,"px"),h(mw,"_readTag");async function Vu({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,cache:w={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),await mw({fs:new ct(p),cache:w,gitdir:u,oid:d})}catch(_){throw _.caller="git.readTag",_}}c(Vu,"Qg"),h(Vu,"readTag");async function Ku({fs:p,dir:s,gitdir:u=Y(s,".git"),oid:d,filepath:w=void 0,cache:_={}}){try{return ie("fs",p),ie("gitdir",u),ie("oid",d),await on({fs:new ct(p),cache:_,gitdir:u,oid:d,filepath:w})}catch(E){throw E.caller="git.readTree",E}}c(Ku,"ey"),h(Ku,"readTree");async function Ju({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d,cache:w={}}){try{ie("fs",p),ie("gitdir",u),ie("filepath",d),await me.acquire({fs:new ct(p),gitdir:u,cache:w},async function(_){_.delete({filepath:d})})}catch(_){throw _.caller="git.remove",_}}c(Ju,"ty"),h(Ju,"remove");async function gw({fs:p,cache:s,onSign:u,gitdir:d,ref:w="refs/notes/commits",oid:_,author:E,committer:k,signingKey:I}){let O;try{O=await ze.resolve({gitdir:d,fs:p,ref:w})}catch(q){if(!(q instanceof se))throw q}let x=(await on({fs:p,cache:s,gitdir:d,oid:O||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;x=x.filter(q=>q.path!==_);let L=await bs({fs:p,gitdir:d,tree:x});return await mo({fs:p,cache:s,onSign:u,gitdir:d,ref:w,tree:L,parent:O&&[O],message:`Note removed by 'isomorphic-git removeNote'
100
+ `,author:E,committer:k,signingKey:I})}c(gw,"mx"),h(gw,"_removeNote");async function Yu({fs:p,onSign:s,dir:u,gitdir:d=Y(u,".git"),ref:w="refs/notes/commits",oid:_,author:E,committer:k,signingKey:I,cache:O={}}){try{ie("fs",p),ie("gitdir",d),ie("oid",_);let x=new ct(p),L=await _i({fs:x,gitdir:d,author:E});if(!L)throw new Tr("author");let q=await sn({fs:x,gitdir:d,author:L,committer:k});if(!q)throw new Tr("committer");return await gw({fs:x,cache:O,onSign:s,gitdir:d,ref:w,oid:_,author:L,committer:q,signingKey:I})}catch(x){throw x.caller="git.removeNote",x}}c(Yu,"ry"),h(Yu,"removeNote");async function yw({fs:p,gitdir:s,oldref:u,ref:d,checkout:w=!1}){if(!_s(d,!0))throw new wi(d,l.clean(d));if(!_s(u,!0))throw new wi(u,l.clean(u));let _=`refs/heads/${u}`,E=`refs/heads/${d}`;if(await ze.exists({fs:p,gitdir:s,ref:E}))throw new yi("branch",d,!1);let k=await ze.resolve({fs:p,gitdir:s,ref:_,depth:1});await ze.writeRef({fs:p,gitdir:s,ref:E,value:k}),await ze.deleteRef({fs:p,gitdir:s,ref:_});let I=await vi({fs:p,gitdir:s,fullname:!0})===_;(w||I)&&await ze.writeSymbolicRef({fs:p,gitdir:s,ref:"HEAD",value:E})}c(yw,"wx"),h(yw,"_renameBranch");async function Xu({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,oldref:w,checkout:_=!1}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),ie("oldref",w),await yw({fs:new ct(p),gitdir:u,ref:d,oldref:w,checkout:_})}catch(E){throw E.caller="git.renameBranch",E}}c(Xu,"iy"),h(Xu,"renameBranch");async function Qu({gitdir:p,type:s,object:u}){return j(ds.wrap({type:s,object:u}))}c(Qu,"ny"),h(Qu,"hashObject$1");async function Zu({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d,ref:w,cache:_={}}){try{ie("fs",p),ie("gitdir",u),ie("filepath",d);let E=new ct(p),k,I;try{k=await ze.resolve({fs:E,gitdir:u,ref:w||"HEAD"})}catch(L){if(w)throw L}if(k)try{k=await ws({fs:E,cache:_,gitdir:u,oid:k,filepath:d})}catch{k=null}let O={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},x=s&&await E.read(Y(s,d));x&&(I=await Qu({gitdir:u,type:"blob",object:x}),k===I&&(O=await E.lstat(Y(s,d)))),await me.acquire({fs:E,gitdir:u,cache:_},async function(L){L.delete({filepath:d}),k&&L.insert({filepath:d,stats:O,oid:k})})}catch(E){throw E.caller="git.reset",E}}c(Zu,"ay"),h(Zu,"resetIndex");async function ed({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,depth:w}){try{return ie("fs",p),ie("gitdir",u),ie("ref",d),await ze.resolve({fs:new ct(p),gitdir:u,ref:d,depth:w})}catch(_){throw _.caller="git.resolveRef",_}}c(ed,"oy"),h(ed,"resolveRef");async function td({fs:p,dir:s,gitdir:u=Y(s,".git"),path:d,value:w,append:_=!1}){try{ie("fs",p),ie("gitdir",u),ie("path",d);let E=new ct(p),k=await ut.get({fs:E,gitdir:u});_?await k.append(d,w):await k.set(d,w),await ut.save({fs:E,gitdir:u,config:k})}catch(E){throw E.caller="git.setConfig",E}}c(td,"sy"),h(td,"setConfig");async function rd({fs:p,gitdir:s,commit:u}){let d=Wr.from(u).toObject();return await vr({fs:p,gitdir:s,type:"commit",object:d,format:"content"})}c(rd,"ly"),h(rd,"_writeCommit");var ww=(Kn=class{static get timezoneOffsetForRefLogEntry(){let s=new Date().getTimezoneOffset(),u=Math.abs(Math.floor(s/60)),d=Math.abs(s%60).toString().padStart(2,"0");return`${s>0?"-":"+"}${u.toString().padStart(2,"0")}${d}`}static createStashReflogEntry(s,u,d){let w=s.name.replace(/\s/g,""),_="0000000000000000000000000000000000000000",E=Math.floor(Date.now()/1e3),k=Kn.timezoneOffsetForRefLogEntry;return`${_} ${u} ${w} ${s.email} ${E} ${k} ${d}
101
+ `}static getStashReflogEntry(s,u=!1){return s.split(`
102
+ `).filter(d=>d).reverse().map((d,w)=>u?`stash@{${w}}: ${d.split(" ")[1]}`:d)}},c(Kn,"zo"),Kn);h(ww,"GitRefStash");var bw=ww,wS={stage:G,workdir:nn},id;async function cn(p,s){return id===void 0&&(id=new t),id.acquire(p,s)}c(cn,"ki"),h(cn,"acquireLock$1");async function _w(p,s,u,d,w=null){let _=Y(u,d),E=await p.lstat(_);if(!E)throw new se(_);if(E.isDirectory())throw new T(`${_}: file expected, but found directory`);let k=w?await nh({fs:p,gitdir:s,oid:w}):void 0,I=k?w:void 0;return k||await cn({fs:p,gitdir:s,currentFilepath:_},async()=>{let O=E.isSymbolicLink()?await p.readlink(_).then(Ph):await p.read(_);if(O===null)throw new se(_);I=await vr({fs:p,gitdir:s,type:"blob",object:O})}),I}c(_w,"yx"),h(_w,"checkAndWriteBlob");async function vw({fs:p,dir:s,gitdir:u,entries:d}){async function w(_){if(_.type==="tree"){if(!_.oid){let E=await Promise.all(_.children.map(w));_.oid=await bs({fs:p,gitdir:u,tree:E}),_.mode=16384}}else _.type==="blob"&&(_.oid=await _w(p,u,s,_.path,_.oid),_.mode=33188);return _.path=_.path.split("/").pop(),_}return c(w,"n"),h(w,"processTreeEntry"),Promise.all(d.map(w))}c(vw,"bx"),h(vw,"processTreeEntries");async function nd({fs:p,dir:s,gitdir:u,treePair:d}){let w=d[1]==="stage",_=d.map(O=>typeof O=="string"?wS[O]():O),E=[],k=await bi({fs:p,cache:{},dir:s,gitdir:u,trees:_,map:h(async(O,[x,L])=>{if(!(O==="."||await gs.isIgnored({fs:p,dir:s,gitdir:u,filepath:O}))&&L)return(!x||await x.oid()!==await L.oid()&&await L.oid()!==void 0)&&E.push([x,L]),{mode:await L.mode(),path:O,oid:await L.oid(),type:await L.type()}},"map"),reduce:h(async(O,x)=>(x=x.filter(Boolean),O?(O.children=x,O):x.length>0?x:void 0),"reduce"),iterate:h(async(O,x)=>{let L=[];for(let q of x){let[ae,ce]=q;w?ce&&(await p.exists(`${s}/${ce.toString()}`)?L.push(q):E.push([null,ce])):ae&&(ce?L.push(q):E.push([ae,null]))}return L.length?Promise.all(L.map(O)):[]},"iterate")});if(E.length===0||k.length===0)return null;let I=(await vw({fs:p,dir:s,gitdir:u,entries:k})).filter(Boolean).map(O=>({mode:O.mode,path:O.path,oid:O.oid,type:O.type}));return bs({fs:p,gitdir:u,tree:I})}c(nd,"Ow"),h(nd,"writeTreeChanges");async function Sw({fs:p,dir:s,gitdir:u,stashCommit:d,parentCommit:w,wasStaged:_}){let E=[],k=[],I=await bi({fs:p,cache:{},dir:s,gitdir:u,trees:[Or({ref:w}),Or({ref:d})],map:h(async(O,[x,L])=>{if(O==="."||await gs.isIgnored({fs:p,dir:s,gitdir:u,filepath:O}))return;let q=L?await L.type():await x.type();if(q!=="tree"&&q!=="blob")return;if(!L&&x){let ce=q==="tree"?"rmdir":"rm";return q==="tree"&&E.push(O),q==="blob"&&_&&k.push({filepath:O,oid:await x.oid()}),{method:ce,filepath:O}}let ae=await L.oid();if(!x||await x.oid()!==ae)return q==="tree"?{method:"mkdir",filepath:O}:(_&&k.push({filepath:O,oid:ae,stats:await p.lstat(Y(s,O))}),{method:"write",filepath:O,oid:ae})},"map")});await cn({fs:p,gitdir:u,dirRemoved:E,ops:I},async()=>{for(let O of I){let x=Y(s,O.filepath);switch(O.method){case"rmdir":await p.rmdir(x);break;case"mkdir":await p.mkdir(x);break;case"rm":await p.rm(x);break;case"write":if(!E.some(L=>x.startsWith(L))){let{object:L}=await jt({fs:p,cache:{},gitdir:u,oid:O.oid});await p.exists(x)&&await p.rm(x),await p.write(x,L)}break}}}),await me.acquire({fs:p,gitdir:u,cache:{}},async O=>{k.forEach(({filepath:x,stats:L,oid:q})=>{O.insert({filepath:x,stats:L,oid:q})})})}c(Sw,"_x"),h(Sw,"applyTreeChanges");var Ew=(Ei=class{constructor({fs:s,dir:u,gitdir:d=Y(u,".git")}){Object.assign(this,{fs:s,dir:u,gitdir:d,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return Y(this.gitdir,Ei.refStash)}get refLogsStashPath(){return Y(this.gitdir,Ei.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await _i({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Tr("author");return this._author}async getStashSHA(s,u){return await this.fs.exists(this.refStashPath)?(u||await this.readStashReflogs({parsed:!1}))[s].split(" ")[1]:null}async writeStashCommit({message:s,tree:u,parent:d}){return rd({fs:this.fs,gitdir:this.gitdir,commit:{message:s,tree:u,parent:d,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(s){let u=await this.readStashReflogs({parsed:!1});if(s!==0&&(s<0||s>u.length-1))throw new wi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");let d=await this.getStashSHA(s,u);return d?an({fs:this.fs,cache:{},gitdir:this.gitdir,oid:d}):{}}async writeStashRef(s){return ze.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Ei.refStash,value:s})}async writeStashReflogEntry({stashCommit:s,message:u}){let d=await this.getAuthor(),w=bw.createStashReflogEntry(d,s,u),_=this.refLogsStashPath;await cn({filepath:_,entry:w},async()=>{let E=await this.fs.exists(_)?await this.fs.read(_,"utf8"):"";await this.fs.write(_,E+w,"utf8")})}async readStashReflogs({parsed:s=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let u=await this.fs.read(this.refLogsStashPath,"utf8");return bw.getStashReflogEntry(u,s)}},c(Ei,"fi"),Ei);h(Ew,"GitStashManager");var wo=Ew;async function sd({fs:p,dir:s,gitdir:u,message:d=""}){let w=new wo({fs:p,dir:s,gitdir:u});await w.getAuthor();let _=await vi({fs:p,gitdir:u,fullname:!1}),E=await ze.resolve({fs:p,gitdir:u,ref:"HEAD"}),k=(await Ol({fs:p,dir:s,gitdir:u,oid:E})).commit.message,I=[E],O=null,x=Or({ref:"HEAD"}),L=await nd({fs:p,dir:s,gitdir:u,treePair:[Or({ref:"HEAD"}),"stage"]});if(L){let ce=await w.writeStashCommit({message:`stash-Index: WIP on ${_} - ${new Date().toISOString()}`,tree:L,parent:I});I.push(ce),O=L,x=G()}let q=await nd({fs:p,dir:s,gitdir:u,treePair:[x,"workdir"]});if(q){let ce=await w.writeStashCommit({message:`stash-WorkDir: WIP on ${_} - ${new Date().toISOString()}`,tree:q,parent:[I[I.length-1]]});I.push(ce),O=q}if(!O||!L&&!q)throw new se("changes, nothing to stash");let ae=(d.trim()||`WIP on ${_}`)+`: ${E.substring(0,7)} ${k}`;return{stashCommit:await w.writeStashCommit({message:ae,tree:O,parent:I}),stashMsg:ae,branch:_,stashMgr:w}}c(sd,"cy"),h(sd,"_createStashCommit");async function Fw({fs:p,dir:s,gitdir:u,message:d=""}){let{stashCommit:w,stashMsg:_,branch:E,stashMgr:k}=await sd({fs:p,dir:s,gitdir:u,message:d});return await k.writeStashRef(w),await k.writeStashReflogEntry({stashCommit:w,message:_}),await wl({fs:p,dir:s,gitdir:u,ref:E,track:!1,force:!0}),w}c(Fw,"vx"),h(Fw,"_stashPush");async function kw({fs:p,dir:s,gitdir:u,message:d=""}){let{stashCommit:w}=await sd({fs:p,dir:s,gitdir:u,message:d});return w}c(kw,"Fx"),h(kw,"_stashCreate");async function ad({fs:p,dir:s,gitdir:u,refIdx:d=0}){let w=await new wo({fs:p,dir:s,gitdir:u}).readStashCommit(d),{parent:_=null}=w.commit?w.commit:{};if(!(!_||!Array.isArray(_)))for(let E=0;E<_.length-1;E++){let k=(await an({fs:p,cache:{},gitdir:u,oid:_[E+1]})).commit.message.startsWith("stash-Index");await Sw({fs:p,dir:s,gitdir:u,stashCommit:_[E+1],parentCommit:_[E],wasStaged:k})}}c(ad,"fy"),h(ad,"_stashApply");async function od({fs:p,dir:s,gitdir:u,refIdx:d=0}){let w=new wo({fs:p,dir:s,gitdir:u});if(!(await w.readStashCommit(d)).commit)return;let _=w.refStashPath;await cn(_,async()=>{await p.exists(_)&&await p.rm(_)});let E=await w.readStashReflogs({parsed:!1});if(!E.length)return;E.splice(d,1);let k=w.refLogsStashPath;await cn({reflogEntries:E,stashReflogPath:k,stashMgr:w},async()=>{if(E.length){await p.write(k,E.reverse().join(`
102
103
  `)+`
103
- `,"utf8");let a=f[f.length-1].split(" ")[1];await n.writeStashRef(a)}else await t.rm(c)})}l(Rk,"_stashDrop");async function rq({fs:t,dir:e,gitdir:r}){return new en({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}l(rq,"_stashList");async function iq({fs:t,dir:e,gitdir:r}){let i=new en({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await eo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}l(iq,"_stashClear");async function nq({fs:t,dir:e,gitdir:r,refIdx:i=0}){await kk({fs:t,dir:e,gitdir:r,refIdx:i}),await Rk({fs:t,dir:e,gitdir:r,refIdx:i})}l(nq,"_stashPop");async function Ok({fs:t,dir:e,gitdir:r=C(e,".git"),op:i="push",message:n="",refIdx:s=0}){k("fs",t),k("dir",e),k("gitdir",r),k("op",i);let o={push:eq,apply:kk,drop:Rk,list:rq,clear:iq,pop:nq,create:tq},f=["apply","drop","pop"];try{let c=new L(t);["refs","logs","logs/refs"].map(h=>C(r,h)).forEach(async h=>{await c.exists(h)||await c.mkdir(h)});let u=o[i];if(u){if(f.includes(i)&&s<0)throw new Zt(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await u({fs:c,dir:e,gitdir:r,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(c){throw c.caller="git.stash",c}}l(Ok,"stash");async function xk({fs:t,dir:e,gitdir:r=C(e,".git"),filepath:i,cache:n={}}){try{k("fs",t),k("gitdir",r),k("filepath",i);let s=new L(t);if(await hi.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let f=await sq({fs:s,cache:n,gitdir:r}),c=await Ak({fs:s,cache:n,gitdir:r,tree:f,path:i}),a=await Ee.acquire({fs:s,gitdir:r,cache:n},async function(w){for(let y of w)if(y.path===i)return y;return null}),u=await s.lstat(C(e,i)),h=c!==null,d=a!==null,p=u!==null,m=l(async()=>{if(d&&!Pf(a,u))return a.oid;{let w=await s.read(C(e,i)),y=await _k({gitdir:r,type:"blob",object:w});return d&&a.oid===y&&u.size!==-1&&Ee.acquire({fs:s,gitdir:r,cache:n},async function(b){b.insert({filepath:i,stats:u,oid:y})}),y}},"getWorkdirOid");if(!h&&!p&&!d)return"absent";if(!h&&!p&&d)return"*absent";if(!h&&p&&!d)return"*added";if(!h&&p&&d)return await m()===a.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return c===a.oid,"*deleted";if(h&&p&&!d)return await m()===c?"*undeleted":"*undeletemodified";if(h&&p&&d){let w=await m();return w===c?w===a.oid?"unmodified":"*unmodified":w===a.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}l(xk,"status");async function Ak({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let o of i)if(o.path===s){if(n.length===0)return o.oid;let{type:f,object:c}=await he({fs:t,cache:e,gitdir:r,oid:o.oid});if(f==="tree"){let a=pt.from(c);return Ak({fs:t,cache:e,gitdir:r,tree:a,path:n})}if(f==="blob")throw new ot(o.oid,f,"blob",n.join("/"))}return null}l(Ak,"getOidAtPath");async function sq({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof le)return[]}let{tree:n}=await ro({fs:t,cache:e,gitdir:r,oid:i});return n}l(sq,"getHeadTree");async function Pk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:o={},ignored:f=!1}){try{k("fs",t),k("gitdir",r),k("ref",i);let c=new L(t);return await ui({fs:c,cache:o,dir:e,gitdir:r,trees:[Et({ref:i}),to(),tn()],map:l(async function(a,[u,h,d]){if(!u&&!d&&h&&!f&&await hi.isIgnored({fs:c,dir:e,filepath:a})||!n.some(D=>y1(a,D)))return null;if(s&&!s(a))return;let[p,m,w]=await Promise.all([u&&u.type(),h&&h.type(),d&&d.type()]),y=[p,m,w].includes("blob");if((p==="tree"||p==="special")&&!y)return;if(p==="commit")return null;if((m==="tree"||m==="special")&&!y)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!y)return;let b=p==="blob"?await u.oid():void 0,_=w==="blob"?await d.oid():void 0,F;p!=="blob"&&m==="blob"&&w!=="blob"?F="42":m==="blob"&&(F=await h.oid());let E=[void 0,b,F,_],R=E.map(D=>E.indexOf(D));return R.shift(),[a,...R]},"map")})}catch(c){throw c.caller="git.statusMatrix",c}}l(Pk,"statusMatrix");async function Nk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,object:n,force:s=!1}){try{k("fs",t),k("gitdir",r),k("ref",i);let o=new L(t);if(i===void 0)throw new dt("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let f=await $.resolve({fs:o,gitdir:r,ref:n||"HEAD"});if(!s&&await $.exists({fs:o,gitdir:r,ref:i}))throw new Yt("tag",i);await $.writeRef({fs:o,gitdir:r,ref:i,value:f})}catch(o){throw o.caller="git.tag",o}}l(Nk,"tag");async function Dk({fs:t,dir:e,gitdir:r=C(e,".git"),cache:i={},filepath:n,oid:s,mode:o,add:f,remove:c,force:a}){try{k("fs",t),k("gitdir",r),k("filepath",n);let u=new L(t);if(c)return await Ee.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!a){let p=await u.lstat(C(e,n));if(p){if(p.isDirectory())throw new fi("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await u.lstat(C(e,n)),!h)throw new le(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new fi("directory")}return await Ee.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!f&&!d.has({filepath:n}))throw new le(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{p=h;let m=p.isSymbolicLink()?await u.readlink(C(e,n)):await u.read(C(e,n));s=await wt({fs:u,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}l(Dk,"updateIndex$1");function Ck(){try{return xu.version}catch(t){throw t.caller="git.version",t}}l(Ck,"version");async function Ik({fs:t,dir:e,gitdir:r=C(e,".git"),trees:i,map:n,reduce:s,iterate:o,cache:f={}}){try{return k("fs",t),k("gitdir",r),k("trees",i),await ui({fs:new L(t),cache:f,dir:e,gitdir:r,trees:i,map:n,reduce:s,iterate:o})}catch(c){throw c.caller="git.walk",c}}l(Ik,"walk");async function $k({fs:t,dir:e,gitdir:r=C(e,".git"),blob:i}){try{return k("fs",t),k("gitdir",r),k("blob",i),await wt({fs:new L(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}l($k,"writeBlob");async function Bk({fs:t,dir:e,gitdir:r=C(e,".git"),commit:i}){try{return k("fs",t),k("gitdir",r),k("commit",i),await Fk({fs:new L(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}l(Bk,"writeCommit");async function Mk({fs:t,dir:e,gitdir:r=C(e,".git"),type:i,object:n,format:s="parsed",oid:o,encoding:f=void 0}){try{let c=new L(t);if(s==="parsed"){switch(i){case"commit":n=mt.from(n).toObject();break;case"tree":n=pt.from(n).toObject();break;case"blob":n=Buffer.from(n,f);break;case"tag":n=Ft.from(n).toObject();break;default:throw new ot(o||"",i,"blob|commit|tag|tree")}s="content"}return o=await wt({fs:c,gitdir:r,type:i,object:n,oid:o,format:s}),o}catch(c){throw c.caller="git.writeObject",c}}l(Mk,"writeObject");async function Lk({fs:t,dir:e,gitdir:r=C(e,".git"),ref:i,value:n,force:s=!1,symbolic:o=!1}){try{k("fs",t),k("gitdir",r),k("ref",i),k("value",n);let f=new L(t);if(!ic(i,!0))throw new Zt(i,La.clean(i));if(!s&&await $.exists({fs:f,gitdir:r,ref:i}))throw new Yt("ref",i);o?await $.writeSymbolicRef({fs:f,gitdir:r,ref:i,value:n}):(n=await $.resolve({fs:f,gitdir:r,ref:n}),await $.writeRef({fs:f,gitdir:r,ref:i,value:n}))}catch(f){throw f.caller="git.writeRef",f}}l(Lk,"writeRef");async function oq({fs:t,gitdir:e,tag:r}){let i=Ft.from(r).toObject();return await wt({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}l(oq,"_writeTag");async function jk({fs:t,dir:e,gitdir:r=C(e,".git"),tag:i}){try{return k("fs",t),k("gitdir",r),k("tag",i),await oq({fs:new L(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}l(jk,"writeTag");async function qk({fs:t,dir:e,gitdir:r=C(e,".git"),tree:i}){try{return k("fs",t),k("gitdir",r),k("tree",i),await sc({fs:new L(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}l(qk,"writeTree");var aq={Errors:r1,STAGE:tn,TREE:Et,WORKDIR:to,add:a1,abortMerge:n1,addNote:h1,addRemote:p1,annotatedTag:m1,branch:w1,checkout:Iw,clone:v1,commit:E1,getConfig:M1,getConfigAll:L1,setConfig:Ek,currentBranch:F1,deleteBranch:T1,deleteRef:k1,deleteRemote:R1,deleteTag:O1,expandOid:x1,expandRef:A1,fastForward:D1,fetch:C1,findMergeBase:I1,findRoot:B1,getRemoteInfo:j1,getRemoteInfo2:U1,hashBlob:W1,indexPack:z1,init:H1,isDescendent:G1,isIgnored:J1,listBranches:K1,listFiles:Y1,listNotes:Z1,listRefs:Q1,listRemotes:ek,listServerRefs:tk,listTags:rk,log:nk,merge:sk,packObjects:ak,pull:ck,push:lk,readBlob:hk,readCommit:Mw,readNote:dk,readObject:pk,readTag:mk,readTree:wk,remove:yk,removeNote:gk,renameBranch:bk,resetIndex:Sk,updateIndex:Dk,resolveRef:vk,status:xk,statusMatrix:Pk,tag:Nk,version:Ck,walk:Ik,writeBlob:$k,writeCommit:Bk,writeObject:Mk,writeRef:Lk,writeTag:jk,writeTree:qk,stash:Ok};B.Errors=r1;B.STAGE=tn;B.TREE=Et;B.WORKDIR=to;B.abortMerge=n1;B.add=a1;B.addNote=h1;B.addRemote=p1;B.annotatedTag=m1;B.branch=w1;B.checkout=Iw;B.clone=v1;B.commit=E1;B.currentBranch=F1;B.default=aq;B.deleteBranch=T1;B.deleteRef=k1;B.deleteRemote=R1;B.deleteTag=O1;B.expandOid=x1;B.expandRef=A1;B.fastForward=D1;B.fetch=C1;B.findMergeBase=I1;B.findRoot=B1;B.getConfig=M1;B.getConfigAll=L1;B.getRemoteInfo=j1;B.getRemoteInfo2=U1;B.hashBlob=W1;B.indexPack=z1;B.init=H1;B.isDescendent=G1;B.isIgnored=J1;B.listBranches=K1;B.listFiles=Y1;B.listNotes=Z1;B.listRefs=Q1;B.listRemotes=ek;B.listServerRefs=tk;B.listTags=rk;B.log=nk;B.merge=sk;B.packObjects=ak;B.pull=ck;B.push=lk;B.readBlob=hk;B.readCommit=Mw;B.readNote=dk;B.readObject=pk;B.readTag=mk;B.readTree=wk;B.remove=yk;B.removeNote=gk;B.renameBranch=bk;B.resetIndex=Sk;B.resolveRef=vk;B.setConfig=Ek;B.stash=Ok;B.status=xk;B.statusMatrix=Pk;B.tag=Nk;B.updateIndex=Dk;B.version=Ck;B.walk=Ik;B.writeBlob=$k;B.writeCommit=Bk;B.writeObject=Mk;B.writeRef=Lk;B.writeTag=jk;B.writeTree=qk});var Wk=T((KK,Uk)=>{Uk.exports=function(t,e){var r=[];t.on("data",function(i){r.push(i)}),t.once("end",function(){e&&e(null,Buffer.concat(r)),e=null}),t.once("error",function(i){e&&e(i),e=null})}});var Hk=T((XK,zk)=>{"use strict";var cq=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];zk.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(cq)),i={};for(let n of r)n in e||(i[n]={get(){let s=t[n];return typeof s=="function"?s.bind(t):s},set(s){t[n]=s},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var Gk=T((YK,Vk)=>{"use strict";var{Transform:lq,PassThrough:fq}=ie("stream"),ry=ie("zlib"),uq=Hk();Vk.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof ry.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new lq({transform(f,c,a){i=!1,a(null,f)},flush(f){f()}}),s=new fq({autoDestroy:!1,destroy(f,c){t.destroy(),c(f)}}),o=r?ry.createBrotliDecompress():ry.createUnzip();return o.once("error",f=>{if(i&&!t.readable){s.end();return}s.destroy(f)}),uq(t,s),t.pipe(n).pipe(o).pipe(s),s}});var Xk=T((ZK,Kk)=>{Kk.exports=Jk;function Jk(t,e){if(t&&e)return Jk(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){r[i]=t[i]}),r;function r(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),o=i[i.length-1];return typeof s=="function"&&s!==o&&Object.keys(o).forEach(function(f){s[f]=o[f]}),s}l(r,"wrapper")}l(Jk,"wrappy")});var Qk=T((eX,iy)=>{var Yk=Xk();iy.exports=Yk(Au);iy.exports.strict=Yk(Zk);Au.proto=Au(function(){Object.defineProperty(Function.prototype,"once",{value:l(function(){return Au(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:l(function(){return Zk(this)},"value"),configurable:!0})});function Au(t){var e=l(function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))},"f");return e.called=!1,e}l(Au,"once");function Zk(t){var e=l(function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},"f"),r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}l(Zk,"onceStrict")});var iR=T((rX,rR)=>{rR.exports=io;var hq=Wk(),eR=Gk(),dq=ie("http"),pq=ie("https"),mq=Qk(),wq=ie("querystring"),tR=ie("url"),ny=l(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function io(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=mq(e),t.url){let{hostname:f,port:c,protocol:a,auth:u,path:h}=tR.parse(t.url);delete t.url,!f&&!c&&!a&&!u?t.path=h:Object.assign(t,{hostname:f,port:c,protocol:a,auth:u,path:h})}let r={"accept-encoding":"gzip, deflate"};t.headers&&Object.keys(t.headers).forEach(f=>r[f.toLowerCase()]=t.headers[f]),t.headers=r;let i;t.body?i=t.json&&!ny(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:wq.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),ny(i)||(t.headers["content-length"]=Buffer.byteLength(i)),t.json&&!t.form&&(t.headers["content-type"]="application/json")),delete t.body,delete t.form,t.json&&(t.headers.accept="application/json"),t.method&&(t.method=t.method.toUpperCase());let n=t.hostname,o=(t.protocol==="https:"?pq:dq).request(t,f=>{if(t.followRedirects!==!1&&f.statusCode>=300&&f.statusCode<400&&f.headers.location){t.url=f.headers.location,delete t.headers.host,f.resume();let a=tR.parse(t.url).hostname;return a!==null&&a!==n&&(delete t.headers.cookie,delete t.headers.authorization),t.method==="POST"&&[301,302].includes(f.statusCode)&&(t.method="GET",delete t.headers["content-length"],delete t.headers["content-type"]),t.maxRedirects--===0?e(new Error("too many redirects")):io(t,e)}let c=typeof eR=="function"&&t.method!=="HEAD";e(null,c?eR(f):f)});return o.on("timeout",()=>{o.abort(),e(new Error("Request timed out"))}),o.on("error",e),ny(i)?i.on("error",e).pipe(o):o.end(i),o}l(io,"simpleGet");io.concat=(t,e)=>io(t,(r,i)=>{if(r)return e(r);hq(i,(n,s)=>{if(n)return e(n);if(t.json)try{s=JSON.parse(s.toString())}catch(o){return e(o,i,s)}e(null,i,s)})});["get","post","put","patch","head","delete"].forEach(t=>{io[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),io(Object.assign({method:t.toUpperCase()},e),r))})});var ye=T((nX,nR)=>{"use strict";var oy=class oy extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
104
- `;super(r),this.name="AggregateError",this.errors=e}};l(oy,"AggregateError");var sy=oy;nR.exports={AggregateError:sy,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var ay=T((oX,sR)=>{"use strict";sR.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var Ze=T((aX,cR)=>{"use strict";var{format:yq,inspect:Pu}=ay(),{AggregateError:gq}=ye(),bq=globalThis.AggregateError||gq,_q=Symbol("kIsNodeError"),Sq=["string","function","number","object","Function","Object","boolean","bigint","symbol"],vq=/^([A-Z][a-z0-9]*)+$/,Eq="__node_internal_",Nu={};function rn(t,e){if(!t)throw new Nu.ERR_INTERNAL_ASSERTION(e)}l(rn,"assert");function oR(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}l(oR,"addNumericalSeparator");function Fq(t,e,r){if(typeof e=="function")return rn(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return rn(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:yq(e,...r)}l(Fq,"getMessage");function He(t,e,r){r||(r=Error);let n=class n extends r{constructor(...o){super(Fq(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}};l(n,"NodeError");let i=n;Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[_q]=!0,Nu[t]=i}l(He,"E");function aR(t){let e=Eq+t.name;return Object.defineProperty(t,"name",{value:e}),t}l(aR,"hideStackFrames");function Tq(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new bq([e,t],e.message);return r.code=e.code,r}return t||e}l(Tq,"aggregateTwoErrors");var ly=class ly extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Nu.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};l(ly,"AbortError");var cy=ly;He("ERR_ASSERTION","%s",Error);He("ERR_INVALID_ARG_TYPE",(t,e,r)=>{rn(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let c of e)rn(typeof c=="string","All expected entries have to be of type string"),Sq.includes(c)?n.push(c.toLowerCase()):vq.test(c)?s.push(c):(rn(c!=="object",'The value "object" should be written as "Object"'),o.push(c));if(s.length>0){let c=n.indexOf("object");c!==-1&&(n.splice(n,c,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let c=n.pop();i+=`one of type ${n.join(", ")}, or ${c}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();i+=`an instance of ${s.join(", ")}, or ${c}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let c=o.pop();i+=`one of ${o.join(", ")}, or ${c}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var f;if((f=r.constructor)!==null&&f!==void 0&&f.name)i+=`. Received an instance of ${r.constructor.name}`;else{let c=Pu(r,{depth:-1});i+=`. Received ${c}`}}else{let c=Pu(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),i+=`. Received type ${typeof r} (${c})`}return i},TypeError);He("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Pu(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);He("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);He("ERR_MISSING_ARGS",(...t)=>{rn(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);He("ERR_OUT_OF_RANGE",(t,e,r)=>{rn(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=oR(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=oR(i)),i+="n"}else i=Pu(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);He("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);He("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);He("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);He("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);He("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);He("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);He("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);He("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);He("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);He("ERR_STREAM_WRITE_AFTER_END","write after end",Error);He("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);cR.exports={AbortError:cy,aggregateTwoErrors:aR(Tq),hideStackFrames:aR,codes:Nu}});var gR=T((lc,cc)=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var pR=new WeakMap,fy=new WeakMap;function de(t){let e=pR.get(t);return console.assert(e!=null,"'this' is expected an Event object, but got",t),e}l(de,"pd");function lR(t){if(t.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener);return}t.event.cancelable&&(t.canceled=!0,typeof t.event.preventDefault=="function"&&t.event.preventDefault())}l(lR,"setCancelFlag");function no(t,e){pR.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=Object.keys(e);for(let i=0;i<r.length;++i){let n=r[i];n in this||Object.defineProperty(this,n,mR(n))}}l(no,"Event");no.prototype={get type(){return de(this).event.type},get target(){return de(this).eventTarget},get currentTarget(){return de(this).currentTarget},composedPath(){let t=de(this).currentTarget;return t==null?[]:[t]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return de(this).eventPhase},stopPropagation(){let t=de(this);t.stopped=!0,typeof t.event.stopPropagation=="function"&&t.event.stopPropagation()},stopImmediatePropagation(){let t=de(this);t.stopped=!0,t.immediateStopped=!0,typeof t.event.stopImmediatePropagation=="function"&&t.event.stopImmediatePropagation()},get bubbles(){return!!de(this).event.bubbles},get cancelable(){return!!de(this).event.cancelable},preventDefault(){lR(de(this))},get defaultPrevented(){return de(this).canceled},get composed(){return!!de(this).event.composed},get timeStamp(){return de(this).timeStamp},get srcElement(){return de(this).eventTarget},get cancelBubble(){return de(this).stopped},set cancelBubble(t){if(!t)return;let e=de(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!de(this).canceled},set returnValue(t){t||lR(de(this))},initEvent(){}};Object.defineProperty(no.prototype,"constructor",{value:no,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(no.prototype,window.Event.prototype),fy.set(window.Event.prototype,no));function mR(t){return{get(){return de(this).event[t]},set(e){de(this).event[t]=e},configurable:!0,enumerable:!0}}l(mR,"defineRedirectDescriptor");function kq(t){return{value(){let e=de(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}l(kq,"defineCallDescriptor");function Rq(t,e){let r=Object.keys(e);if(r.length===0)return t;function i(n,s){t.call(this,n,s)}l(i,"CustomEvent"),i.prototype=Object.create(t.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let n=0;n<r.length;++n){let s=r[n];if(!(s in t.prototype)){let f=typeof Object.getOwnPropertyDescriptor(e,s).value=="function";Object.defineProperty(i.prototype,s,f?kq(s):mR(s))}}return i}l(Rq,"defineWrapper");function wR(t){if(t==null||t===Object.prototype)return no;let e=fy.get(t);return e==null&&(e=Rq(wR(Object.getPrototypeOf(t)),t),fy.set(t,e)),e}l(wR,"getWrapper");function Oq(t,e){let r=wR(Object.getPrototypeOf(e));return new r(t,e)}l(Oq,"wrapEvent");function xq(t){return de(t).immediateStopped}l(xq,"isStopped");function Aq(t,e){de(t).eventPhase=e}l(Aq,"setEventPhase");function Pq(t,e){de(t).currentTarget=e}l(Pq,"setCurrentTarget");function fR(t,e){de(t).passiveListener=e}l(fR,"setPassiveListener");var yR=new WeakMap,uR=1,hR=2,Du=3;function Cu(t){return t!==null&&typeof t=="object"}l(Cu,"isObject");function ac(t){let e=yR.get(t);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}l(ac,"getListeners");function Nq(t){return{get(){let r=ac(this).get(t);for(;r!=null;){if(r.listenerType===Du)return r.listener;r=r.next}return null},set(e){typeof e!="function"&&!Cu(e)&&(e=null);let r=ac(this),i=null,n=r.get(t);for(;n!=null;)n.listenerType===Du?i!==null?i.next=n.next:n.next!==null?r.set(t,n.next):r.delete(t):i=n,n=n.next;if(e!==null){let s={listener:e,listenerType:Du,passive:!1,once:!1,next:null};i===null?r.set(t,s):i.next=s}},configurable:!0,enumerable:!0}}l(Nq,"defineEventAttributeDescriptor");function uy(t,e){Object.defineProperty(t,`on${e}`,Nq(e))}l(uy,"defineEventAttribute");function dR(t){function e(){Qt.call(this)}l(e,"CustomEventTarget"),e.prototype=Object.create(Qt.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)uy(e.prototype,t[r]);return e}l(dR,"defineCustomEventTarget");function Qt(){if(this instanceof Qt){yR.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return dR(arguments[0]);if(arguments.length>0){let t=new Array(arguments.length);for(let e=0;e<arguments.length;++e)t[e]=arguments[e];return dR(t)}throw new TypeError("Cannot call a class as a function")}l(Qt,"EventTarget");Qt.prototype={addEventListener(t,e,r){if(e==null)return;if(typeof e!="function"&&!Cu(e))throw new TypeError("'listener' should be a function or an object.");let i=ac(this),n=Cu(r),o=(n?!!r.capture:!!r)?uR:hR,f={listener:e,listenerType:o,passive:n&&!!r.passive,once:n&&!!r.once,next:null},c=i.get(t);if(c===void 0){i.set(t,f);return}let a=null;for(;c!=null;){if(c.listener===e&&c.listenerType===o)return;a=c,c=c.next}a.next=f},removeEventListener(t,e,r){if(e==null)return;let i=ac(this),s=(Cu(r)?!!r.capture:!!r)?uR:hR,o=null,f=i.get(t);for(;f!=null;){if(f.listener===e&&f.listenerType===s){o!==null?o.next=f.next:f.next!==null?i.set(t,f.next):i.delete(t);return}o=f,f=f.next}},dispatchEvent(t){if(t==null||typeof t.type!="string")throw new TypeError('"event.type" should be a string.');let e=ac(this),r=t.type,i=e.get(r);if(i==null)return!0;let n=Oq(this,t),s=null;for(;i!=null;){if(i.once?s!==null?s.next=i.next:i.next!==null?e.set(r,i.next):e.delete(r):s=i,fR(n,i.passive?i.listener:null),typeof i.listener=="function")try{i.listener.call(this,n)}catch(o){typeof console<"u"&&typeof console.error=="function"&&console.error(o)}else i.listenerType!==Du&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(n);if(xq(n))break;i=i.next}return fR(n,null),Aq(n,0),Pq(n,null),!n.defaultPrevented}};Object.defineProperty(Qt.prototype,"constructor",{value:Qt,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(Qt.prototype,window.EventTarget.prototype);lc.defineEventAttribute=uy;lc.EventTarget=Qt;lc.default=Qt;cc.exports=Qt;cc.exports.EventTarget=cc.exports.default=Qt;cc.exports.defineEventAttribute=uy});var so=T((uc,fc)=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var hy=gR(),dy=class dy extends hy.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Iu.get(this);if(typeof e!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}};l(dy,"AbortSignal");var wi=dy;hy.defineEventAttribute(wi.prototype,"abort");function Dq(){let t=Object.create(wi.prototype);return hy.EventTarget.call(t),Iu.set(t,!1),t}l(Dq,"createAbortSignal");function Cq(t){Iu.get(t)===!1&&(Iu.set(t,!0),t.dispatchEvent({type:"abort"}))}l(Cq,"abortSignal");var Iu=new WeakMap;Object.defineProperties(wi.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(wi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var py=class py{constructor(){_R.set(this,Dq())}get signal(){return bR(this)}abort(){Cq(bR(this))}};l(py,"AbortController");var yi=py,_R=new WeakMap;function bR(t){let e=_R.get(t);if(e==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${t===null?"null":typeof t}`);return e}l(bR,"getSignal");Object.defineProperties(yi.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(yi.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});uc.AbortController=yi;uc.AbortSignal=wi;uc.default=yi;fc.exports=yi;fc.exports.AbortController=fc.exports.default=yi;fc.exports.AbortSignal=wi});var at=T((uX,wy)=>{"use strict";var Iq=ie("buffer"),{format:$q,inspect:Bq}=ay(),{codes:{ERR_INVALID_ARG_TYPE:my}}=Ze(),{kResistStopPropagation:Mq,AggregateError:Lq,SymbolDispose:jq}=ye(),qq=globalThis.AbortSignal||so().AbortSignal,Uq=globalThis.AbortController||so().AbortController,Wq=Object.getPrototypeOf(async function(){}).constructor,SR=globalThis.Blob||Iq.Blob,zq=l(typeof SR<"u"?function(e){return e instanceof SR}:function(e){return!1},"isBlob"),vR=l((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new my(e,"AbortSignal",t)},"validateAbortSignal"),Hq=l((t,e)=>{if(typeof t!="function")throw new my(e,"Function",t)},"validateFunction");wy.exports={AggregateError:Lq,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:l(function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},"createDeferredPromise"),promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:$q,inspect:Bq,types:{isAsyncFunction(t){return t instanceof Wq},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:zq,deprecate(t,e){return t},addAbortListener:ie("events").addAbortListener||l(function(e,r){if(e===void 0)throw new my("signal","AbortSignal",e);vR(e,"signal"),Hq(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Mq]:!0}),i=l(()=>{e.removeEventListener("abort",r)},"removeEventListener")),{__proto__:null,[jq](){var n;(n=i)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:qq.any||l(function(e){if(e.length===1)return e[0];let r=new Uq,i=l(()=>r.abort(),"abort");return e.forEach(n=>{vR(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal},"AbortSignalAny")};wy.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ao=T((dX,NR)=>{"use strict";var{ArrayIsArray:gy,ArrayPrototypeIncludes:kR,ArrayPrototypeJoin:RR,ArrayPrototypeMap:Vq,NumberIsInteger:by,NumberIsNaN:Gq,NumberMAX_SAFE_INTEGER:Jq,NumberMIN_SAFE_INTEGER:Kq,NumberParseInt:Xq,ObjectPrototypeHasOwnProperty:Yq,RegExpPrototypeExec:OR,String:Zq,StringPrototypeToUpperCase:Qq,StringPrototypeTrim:e8}=ye(),{hideStackFrames:Bt,codes:{ERR_SOCKET_BAD_PORT:t8,ERR_INVALID_ARG_TYPE:Qe,ERR_INVALID_ARG_VALUE:oo,ERR_OUT_OF_RANGE:nn,ERR_UNKNOWN_SIGNAL:ER}}=Ze(),{normalizeEncoding:r8}=at(),{isAsyncFunction:i8,isArrayBufferView:n8}=at().types,FR={};function s8(t){return t===(t|0)}l(s8,"isInt32");function o8(t){return t===t>>>0}l(o8,"isUint32");var a8=/^[0-7]+$/,c8="must be a 32-bit unsigned integer or an octal string";function l8(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(OR(a8,t)===null)throw new oo(e,t,c8);t=Xq(t,8)}return xR(t,e),t}l(l8,"parseFileMode");var f8=Bt((t,e,r=Kq,i=Jq)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);if(t<r||t>i)throw new nn(e,`>= ${r} && <= ${i}`,t)}),u8=Bt((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);if(t<r||t>i)throw new nn(e,`>= ${r} && <= ${i}`,t)}),xR=Bt((t,e,r=!1)=>{if(typeof t!="number")throw new Qe(e,"number",t);if(!by(t))throw new nn(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new nn(e,`>= ${i} && <= ${n}`,t)});function _y(t,e){if(typeof t!="string")throw new Qe(e,"string",t)}l(_y,"validateString");function h8(t,e,r=void 0,i){if(typeof t!="number")throw new Qe(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Gq(t))throw new nn(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}l(h8,"validateNumber");var d8=Bt((t,e,r)=>{if(!kR(r,t)){let n="must be one of: "+RR(Vq(r,s=>typeof s=="string"?`'${s}'`:Zq(s)),", ");throw new oo(e,t,n)}});function AR(t,e){if(typeof t!="boolean")throw new Qe(e,"boolean",t)}l(AR,"validateBoolean");function yy(t,e,r){return t==null||!Yq(t,e)?r:t[e]}l(yy,"getOwnPropertyValueOrDefault");var p8=Bt((t,e,r=null)=>{let i=yy(r,"allowArray",!1),n=yy(r,"allowFunction",!1);if(!yy(r,"nullable",!1)&&t===null||!i&&gy(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new Qe(e,"Object",t)}),m8=Bt((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Qe(e,"a dictionary",t)}),$u=Bt((t,e,r=0)=>{if(!gy(t))throw new Qe(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new oo(e,t,i)}});function w8(t,e){$u(t,e);for(let r=0;r<t.length;r++)_y(t[r],`${e}[${r}]`)}l(w8,"validateStringArray");function y8(t,e){$u(t,e);for(let r=0;r<t.length;r++)AR(t[r],`${e}[${r}]`)}l(y8,"validateBooleanArray");function g8(t,e){$u(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new Qe(n,"AbortSignal",i);PR(i,n)}}l(g8,"validateAbortSignalArray");function b8(t,e="signal"){if(_y(t,e),FR[t]===void 0)throw FR[Qq(t)]!==void 0?new ER(t+" (signals must use all capital letters)"):new ER(t)}l(b8,"validateSignalName");var _8=Bt((t,e="buffer")=>{if(!n8(t))throw new Qe(e,["Buffer","TypedArray","DataView"],t)});function S8(t,e){let r=r8(e),i=t.length;if(r==="hex"&&i%2!==0)throw new oo("encoding",e,`is invalid for data of length ${i}`)}l(S8,"validateEncoding");function v8(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&e8(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new t8(e,t,r);return t|0}l(v8,"validatePort");var PR=Bt((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Qe(e,"AbortSignal",t)}),E8=Bt((t,e)=>{if(typeof t!="function")throw new Qe(e,"Function",t)}),F8=Bt((t,e)=>{if(typeof t!="function"||i8(t))throw new Qe(e,"Function",t)}),T8=Bt((t,e)=>{if(t!==void 0)throw new Qe(e,"undefined",t)});function k8(t,e,r){if(!kR(r,t))throw new Qe(e,`('${RR(r,"|")}')`,t)}l(k8,"validateUnion");var R8=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function TR(t,e){if(typeof t>"u"||!OR(R8,t))throw new oo(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(TR,"validateLinkHeaderFormat");function O8(t){if(typeof t=="string")return TR(t,"hints"),t;if(gy(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];TR(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new oo("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l(O8,"validateLinkHeaderValue");NR.exports={isInt32:s8,isUint32:o8,parseFileMode:l8,validateArray:$u,validateStringArray:w8,validateBooleanArray:y8,validateAbortSignalArray:g8,validateBoolean:AR,validateBuffer:_8,validateDictionary:m8,validateEncoding:S8,validateFunction:E8,validateInt32:u8,validateInteger:f8,validateNumber:h8,validateObject:p8,validateOneOf:d8,validatePlainFunction:F8,validatePort:v8,validateSignalName:b8,validateString:_y,validateUint32:xR,validateUndefined:T8,validateUnion:k8,validateAbortSignal:PR,validateLinkHeaderValue:O8}});var gi=T((mX,DR)=>{DR.exports=globalThis.process});var gr=T((wX,JR)=>{"use strict";var{SymbolAsyncIterator:CR,SymbolIterator:IR,SymbolFor:sn}=ye(),$R=sn("nodejs.stream.destroyed"),BR=sn("nodejs.stream.errored"),Sy=sn("nodejs.stream.readable"),vy=sn("nodejs.stream.writable"),MR=sn("nodejs.stream.disturbed"),x8=sn("nodejs.webstream.isClosedPromise"),A8=sn("nodejs.webstream.controllerErrorFunction");function Bu(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}l(Bu,"isReadableNodeStream");function Mu(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}l(Mu,"isWritableNodeStream");function P8(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}l(P8,"isDuplexNodeStream");function yr(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}l(yr,"isNodeStream");function LR(t){return!!(t&&!yr(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}l(LR,"isReadableStream");function jR(t){return!!(t&&!yr(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}l(jR,"isWritableStream");function qR(t){return!!(t&&!yr(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}l(qR,"isTransformStream");function N8(t){return LR(t)||jR(t)||qR(t)}l(N8,"isWebStream");function D8(t,e){return t==null?!1:e===!0?typeof t[CR]=="function":e===!1?typeof t[IR]=="function":typeof t[CR]=="function"||typeof t[IR]=="function"}l(D8,"isIterable");function Lu(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[$R]||i!=null&&i.destroyed)}l(Lu,"isDestroyed");function UR(t){if(!Mu(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}l(UR,"isWritableEnded");function C8(t,e){if(!Mu(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}l(C8,"isWritableFinished");function I8(t){if(!Bu(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}l(I8,"isReadableEnded");function WR(t,e){if(!Bu(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}l(WR,"isReadableFinished");function zR(t){return t&&t[Sy]!=null?t[Sy]:typeof t?.readable!="boolean"?null:Lu(t)?!1:Bu(t)&&t.readable&&!WR(t)}l(zR,"isReadable");function HR(t){return t&&t[vy]!=null?t[vy]:typeof t?.writable!="boolean"?null:Lu(t)?!1:Mu(t)&&t.writable&&!UR(t)}l(HR,"isWritable");function $8(t,e){return yr(t)?Lu(t)?!0:!(e?.readable!==!1&&zR(t)||e?.writable!==!1&&HR(t)):null}l($8,"isFinished");function B8(t){var e,r;return yr(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}l(B8,"isWritableErrored");function M8(t){var e,r;return yr(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}l(M8,"isReadableErrored");function L8(t){if(!yr(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&VR(t)?t._closed:null}l(L8,"isClosed");function VR(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}l(VR,"isOutgoingMessage");function GR(t){return typeof t._sent100=="boolean"&&VR(t)}l(GR,"isServerResponse");function j8(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}l(j8,"isServerRequest");function q8(t){if(!yr(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&GR(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}l(q8,"willEmitClose");function U8(t){var e;return!!(t&&((e=t[MR])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}l(U8,"isDisturbed");function W8(t){var e,r,i,n,s,o,f,c,a,u;return!!(t&&((e=(r=(i=(n=(s=(o=t[BR])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(f=t._readableState)===null||f===void 0?void 0:f.errorEmitted)!==null&&i!==void 0?i:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(a=t._readableState)===null||a===void 0?void 0:a.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}l(W8,"isErrored");JR.exports={isDestroyed:Lu,kIsDestroyed:$R,isDisturbed:U8,kIsDisturbed:MR,isErrored:W8,kIsErrored:BR,isReadable:zR,kIsReadable:Sy,kIsClosedPromise:x8,kControllerErrorFunction:A8,kIsWritable:vy,isClosed:L8,isDuplexNodeStream:P8,isFinished:$8,isIterable:D8,isReadableNodeStream:Bu,isReadableStream:LR,isReadableEnded:I8,isReadableFinished:WR,isReadableErrored:M8,isNodeStream:yr,isWebStream:N8,isWritable:HR,isWritableNodeStream:Mu,isWritableStream:jR,isWritableEnded:UR,isWritableFinished:C8,isWritableErrored:B8,isServerRequest:j8,isServerResponse:GR,willEmitClose:q8,isTransformStream:qR}});var Lr=T((gX,Ry)=>{"use strict";var bi=gi(),{AbortError:iO,codes:z8}=Ze(),{ERR_INVALID_ARG_TYPE:H8,ERR_STREAM_PREMATURE_CLOSE:KR}=z8,{kEmptyObject:Fy,once:Ty}=at(),{validateAbortSignal:V8,validateFunction:G8,validateObject:J8,validateBoolean:K8}=ao(),{Promise:X8,PromisePrototypeThen:Y8,SymbolDispose:nO}=ye(),{isClosed:Z8,isReadable:XR,isReadableNodeStream:Ey,isReadableStream:Q8,isReadableFinished:YR,isReadableErrored:ZR,isWritable:QR,isWritableNodeStream:eO,isWritableStream:eU,isWritableFinished:tO,isWritableErrored:rO,isNodeStream:tU,willEmitClose:rU,kIsClosedPromise:iU}=gr(),co;function nU(t){return t.setHeader&&typeof t.abort=="function"}l(nU,"isRequest");var ky=l(()=>{},"nop");function sO(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Fy):e==null?e=Fy:J8(e,"options"),G8(r,"callback"),V8(e.signal,"options.signal"),r=Ty(r),Q8(t)||eU(t))return sU(t,e,r);if(!tU(t))throw new H8("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Ey(t),o=(n=e.writable)!==null&&n!==void 0?n:eO(t),f=t._writableState,c=t._readableState,a=l(()=>{t.writable||d()},"onlegacyfinish"),u=rU(t)&&Ey(t)===s&&eO(t)===o,h=tO(t,!1),d=l(()=>{h=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||s))&&(!s||p)&&r.call(t)},"onfinish"),p=YR(t,!1),m=l(()=>{p=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||o))&&(!o||h)&&r.call(t)},"onend"),w=l(R=>{r.call(t,R)},"onerror"),y=Z8(t),b=l(()=>{y=!0;let R=rO(t)||ZR(t);if(R&&typeof R!="boolean")return r.call(t,R);if(s&&!p&&Ey(t,!0)&&!YR(t,!1))return r.call(t,new KR);if(o&&!h&&!tO(t,!1))return r.call(t,new KR);r.call(t)},"onclose"),_=l(()=>{y=!0;let R=rO(t)||ZR(t);if(R&&typeof R!="boolean")return r.call(t,R);r.call(t)},"onclosed"),F=l(()=>{t.req.on("finish",d)},"onrequest");nU(t)?(t.on("complete",d),u||t.on("abort",b),t.req?F():t.on("request",F)):o&&!f&&(t.on("end",a),t.on("close",a)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",m),t.on("finish",d),e.error!==!1&&t.on("error",w),t.on("close",b),y?bi.nextTick(b):f!=null&&f.errorEmitted||c!=null&&c.errorEmitted?u||bi.nextTick(_):(!s&&(!u||XR(t))&&(h||QR(t)===!1)||!o&&(!u||QR(t))&&(p||XR(t)===!1)||c&&t.req&&t.aborted)&&bi.nextTick(_);let E=l(()=>{r=ky,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",F),t.req&&t.req.removeListener("finish",d),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",d),t.removeListener("end",m),t.removeListener("error",w),t.removeListener("close",b)},"cleanup");if(e.signal&&!y){let R=l(()=>{let D=r;E(),D.call(t,new iO(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)bi.nextTick(R);else{co=co||at().addAbortListener;let D=co(e.signal,R),S=r;r=Ty((...O)=>{D[nO](),S.apply(t,O)})}}return E}l(sO,"eos");function sU(t,e,r){let i=!1,n=ky;if(e.signal)if(n=l(()=>{i=!0,r.call(t,new iO(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)bi.nextTick(n);else{co=co||at().addAbortListener;let o=co(e.signal,n),f=r;r=Ty((...c)=>{o[nO](),f.apply(t,c)})}let s=l((...o)=>{i||bi.nextTick(()=>r.apply(t,o))},"resolverFn");return Y8(t[iU].promise,s,s),ky}l(sU,"eosWeb");function oU(t,e){var r;let i=!1;return e===null&&(e=Fy),(r=e)!==null&&r!==void 0&&r.cleanup&&(K8(e.cleanup,"cleanup"),i=e.cleanup),new X8((n,s)=>{let o=sO(t,e,f=>{i&&o(),f?s(f):n()})})}l(oU,"finished");Ry.exports=sO;Ry.exports.finished=oU});var on=T((_X,dO)=>{"use strict";var br=gi(),{aggregateTwoErrors:aU,codes:{ERR_MULTIPLE_CALLBACK:cU},AbortError:lU}=Ze(),{Symbol:cO}=ye(),{kIsDestroyed:fU,isDestroyed:uU,isFinished:hU,isServerRequest:dU}=gr(),lO=cO("kDestroy"),Oy=cO("kConstruct");function fO(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}l(fO,"checkError");function pU(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(fO(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?oO(this,t,e):this.once(lO,function(s){oO(this,aU(s,t),e)}),this)}l(pU,"destroy");function oO(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,f=t._writableState;fO(s,f,o),f&&(f.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?br.nextTick(mU,t,s):br.nextTick(uO,t)}l(n,"onDestroy");try{t._destroy(e||null,n)}catch(s){n(s)}}l(oO,"_destroy");function mU(t,e){xy(t,e),uO(t)}l(mU,"emitErrorCloseNT");function uO(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}l(uO,"emitCloseNT");function xy(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}l(xy,"emitErrorNT");function wU(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}l(wU,"undestroy");function Ay(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?br.nextTick(xy,t,e):xy(t,e))}l(Ay,"errorOrDestroy");function yU(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Oy,e),!(t.listenerCount(Oy)>1)&&br.nextTick(gU,t)}l(yU,"construct");function gU(t){let e=!1;function r(i){if(e){Ay(t,i??new cU);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(lO,i):i?Ay(t,i,!0):br.nextTick(bU,t)}l(r,"onConstruct");try{t._construct(i=>{br.nextTick(r,i)})}catch(i){br.nextTick(r,i)}}l(gU,"constructNT");function bU(t){t.emit(Oy)}l(bU,"emitConstructNT");function aO(t){return t?.setHeader&&typeof t.abort=="function"}l(aO,"isRequest");function hO(t){t.emit("close")}l(hO,"emitCloseLegacy");function _U(t,e){t.emit("error",e),br.nextTick(hO,t)}l(_U,"emitErrorCloseLegacy");function SU(t,e){!t||uU(t)||(!e&&!hU(t)&&(e=new lU),dU(t)?(t.socket=null,t.destroy(e)):aO(t)?t.abort():aO(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?br.nextTick(_U,t,e):br.nextTick(hO,t),t.destroyed||(t[fU]=!0))}l(SU,"destroyer");dO.exports={construct:yU,destroyer:SU,destroy:pU,undestroy:wU,errorOrDestroy:Ay}});var Uu=T((vX,mO)=>{"use strict";var{ArrayIsArray:vU,ObjectSetPrototypeOf:pO}=ye(),{EventEmitter:ju}=ie("events");function qu(t){ju.call(this,t)}l(qu,"Stream");pO(qu.prototype,ju.prototype);pO(qu,ju);qu.prototype.pipe=function(t,e){let r=this;function i(u){t.writable&&t.write(u)===!1&&r.pause&&r.pause()}l(i,"ondata"),r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}l(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",f));let s=!1;function o(){s||(s=!0,t.end())}l(o,"onend");function f(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}l(f,"onclose");function c(u){a(),ju.listenerCount(this,"error")===0&&this.emit("error",u)}l(c,"onerror"),Py(r,"error",c),Py(t,"error",c);function a(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",f),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",a),r.removeListener("close",a),t.removeListener("close",a)}return l(a,"cleanup"),r.on("end",a),r.on("close",a),t.on("close",a),t.emit("pipe",r),t};function Py(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):vU(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}l(Py,"prependListener");mO.exports={Stream:qu,prependListener:Py}});var hc=T((FX,Wu)=>{"use strict";var{SymbolDispose:EU}=ye(),{AbortError:wO,codes:FU}=Ze(),{isNodeStream:yO,isWebStream:TU,kControllerErrorFunction:kU}=gr(),RU=Lr(),{ERR_INVALID_ARG_TYPE:gO}=FU,Ny,OU=l((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new gO(e,"AbortSignal",t)},"validateAbortSignal");Wu.exports.addAbortSignal=l(function(e,r){if(OU(e,"signal"),!yO(r)&&!TU(r))throw new gO("stream",["ReadableStream","WritableStream","Stream"],r);return Wu.exports.addAbortSignalNoValidate(e,r)},"addAbortSignal");Wu.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=yO(e)?()=>{e.destroy(new wO(void 0,{cause:t.reason}))}:()=>{e[kU](new wO(void 0,{cause:t.reason}))};if(t.aborted)r();else{Ny=Ny||at().addAbortListener;let i=Ny(t,r);RU(e,i[EU])}return e}});var SO=T((kX,_O)=>{"use strict";var{StringPrototypeSlice:bO,SymbolIterator:xU,TypedArrayPrototypeSet:zu,Uint8Array:AU}=ye(),{Buffer:Dy}=ie("buffer"),{inspect:PU}=at(),lo;_O.exports=(lo=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Dy.alloc(0);let r=Dy.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)zu(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[xU](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=bO(s,0,e),this.head=i,i.data=bO(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Dy.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)zu(r,o,i-e),e-=o.length;else{e===o.length?(zu(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(zu(r,new AU(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return PU(this,{...r,depth:0,customInspect:!1})}},l(lo,"BufferList"),lo)});var dc=T((OX,TO)=>{"use strict";var{MathFloor:NU,NumberIsInteger:DU}=ye(),{validateInteger:CU}=ao(),{ERR_INVALID_ARG_VALUE:IU}=Ze().codes,vO=16*1024,EO=16;function $U(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}l($U,"highWaterMarkFrom");function FO(t){return t?EO:vO}l(FO,"getDefaultHighWaterMark");function BU(t,e){CU(e,"value",0),t?EO=e:vO=e}l(BU,"setDefaultHighWaterMark");function MU(t,e,r,i){let n=$U(e,i,r);if(n!=null){if(!DU(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new IU(s,n)}return NU(n)}return FO(t.objectMode)}l(MU,"getHighWaterMark");TO.exports={getHighWaterMark:MU,getDefaultHighWaterMark:FO,setDefaultHighWaterMark:BU}});var OO=T(RO=>{"use strict";var Iy=pa().Buffer,kO=Iy.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function LU(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}l(LU,"_normalizeEncoding");function jU(t){var e=LU(t);if(typeof e!="string"&&(Iy.isEncoding===kO||!kO(t)))throw new Error("Unknown encoding: "+t);return e||t}l(jU,"normalizeEncoding");RO.StringDecoder=pc;function pc(t){this.encoding=jU(t);var e;switch(this.encoding){case"utf16le":this.text=VU,this.end=GU,e=4;break;case"utf8":this.fillLast=WU,e=4;break;case"base64":this.text=JU,this.end=KU,e=3;break;default:this.write=XU,this.end=YU;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Iy.allocUnsafe(e)}l(pc,"StringDecoder");pc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};pc.prototype.end=HU;pc.prototype.text=zU;pc.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function Cy(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}l(Cy,"utf8CheckByte");function qU(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Cy(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Cy(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Cy(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}l(qU,"utf8CheckIncomplete");function UU(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}l(UU,"utf8CheckExtraBytes");function WU(t){var e=this.lastTotal-this.lastNeed,r=UU(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}l(WU,"utf8FillLast");function zU(t,e){var r=qU(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}l(zU,"utf8Text");function HU(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}l(HU,"utf8End");function VU(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}l(VU,"utf16Text");function GU(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}l(GU,"utf16End");function JU(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}l(JU,"base64Text");function KU(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}l(KU,"base64End");function XU(t){return t.toString(this.encoding)}l(XU,"simpleWrite");function YU(t){return t&&t.length?this.write(t):""}l(YU,"simpleEnd")});var $y=T((NX,NO)=>{"use strict";var xO=gi(),{PromisePrototypeThen:ZU,SymbolAsyncIterator:AO,SymbolIterator:PO}=ye(),{Buffer:QU}=ie("buffer"),{ERR_INVALID_ARG_TYPE:eW,ERR_STREAM_NULL_VALUES:tW}=Ze().codes;function rW(t,e,r){let i;if(typeof e=="string"||e instanceof QU)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[AO])n=!0,i=e[AO]();else if(e&&e[PO])n=!1,i=e[PO]();else throw new eW("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,c())},s._destroy=function(a,u){ZU(f(a),()=>xO.nextTick(u,a),h=>xO.nextTick(u,h||a))};async function f(a){let u=a!=null,h=typeof i.throw=="function";if(u&&h){let{value:d,done:p}=await i.throw(a);if(await d,p)return}if(typeof i.return=="function"){let{value:d}=await i.return();await d}}l(f,"close");async function c(){for(;;){try{let{value:a,done:u}=n?await i.next():i.next();if(u)s.push(null);else{let h=a&&typeof a.then=="function"?await a:a;if(h===null)throw o=!1,new tW;if(s.push(h))continue;o=!1}}catch(a){s.destroy(a)}break}}return l(c,"next"),s}l(rW,"from");NO.exports=rW});var wc=T((CX,XO)=>{"use strict";var er=gi(),{ArrayPrototypeIndexOf:iW,NumberIsInteger:nW,NumberIsNaN:sW,NumberParseInt:oW,ObjectDefineProperties:zy,ObjectKeys:aW,ObjectSetPrototypeOf:IO,Promise:$O,SafeSet:cW,SymbolAsyncDispose:lW,SymbolAsyncIterator:fW,Symbol:uW}=ye();XO.exports=G;G.ReadableState=Ju;var{EventEmitter:hW}=ie("events"),{Stream:_i,prependListener:dW}=Uu(),{Buffer:By}=ie("buffer"),{addAbortSignal:pW}=hc(),BO=Lr(),Y=at().debuglog("stream",t=>{Y=t}),mW=SO(),ho=on(),{getHighWaterMark:wW,getDefaultHighWaterMark:yW}=dc(),{aggregateTwoErrors:DO,codes:{ERR_INVALID_ARG_TYPE:gW,ERR_METHOD_NOT_IMPLEMENTED:bW,ERR_OUT_OF_RANGE:_W,ERR_STREAM_PUSH_AFTER_EOF:SW,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:vW},AbortError:EW}=Ze(),{validateObject:FW}=ao(),an=uW("kPaused"),{StringDecoder:MO}=OO(),TW=$y();IO(G.prototype,_i.prototype);IO(G,_i);var My=l(()=>{},"nop"),{errorOrDestroy:fo}=ho,uo=1,kW=2,LO=4,mc=8,jO=16,Hu=32,Vu=64,qO=128,RW=256,OW=512,xW=1024,Uy=2048,Wy=4096,AW=8192,PW=16384,NW=32768,UO=65536,DW=1<<17,CW=1<<18;function Ce(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}l(Ce,"makeBitMapDescriptor");zy(Ju.prototype,{objectMode:Ce(uo),ended:Ce(kW),endEmitted:Ce(LO),reading:Ce(mc),constructed:Ce(jO),sync:Ce(Hu),needReadable:Ce(Vu),emittedReadable:Ce(qO),readableListening:Ce(RW),resumeScheduled:Ce(OW),errorEmitted:Ce(xW),emitClose:Ce(Uy),autoDestroy:Ce(Wy),destroyed:Ce(AW),closed:Ce(PW),closeEmitted:Ce(NW),multiAwaitDrain:Ce(UO),readingMore:Ce(DW),dataEmitted:Ce(CW)});function Ju(t,e,r){typeof r!="boolean"&&(r=e instanceof _r()),this.state=Uy|Wy|jO|Hu,t&&t.objectMode&&(this.state|=uo),r&&t&&t.readableObjectMode&&(this.state|=uo),this.highWaterMark=t?wW(this,t,"readableHighWaterMark",r):yW(!1),this.buffer=new mW,this.length=0,this.pipes=[],this.flowing=null,this[an]=null,t&&t.emitClose===!1&&(this.state&=~Uy),t&&t.autoDestroy===!1&&(this.state&=~Wy),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new MO(t.encoding),this.encoding=t.encoding)}l(Ju,"ReadableState");function G(t){if(!(this instanceof G))return new G(t);let e=this instanceof _r();this._readableState=new Ju(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&pW(t.signal,this)),_i.call(this,t),ho.construct(this,()=>{this._readableState.needReadable&&Gu(this,this._readableState)})}l(G,"Readable");G.prototype.destroy=ho.destroy;G.prototype._undestroy=ho.undestroy;G.prototype._destroy=function(t,e){e(t)};G.prototype[hW.captureRejectionSymbol]=function(t){this.destroy(t)};G.prototype[lW]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new EW,this.destroy(t)),new $O((e,r)=>BO(this,i=>i&&i!==t?r(i):e(null)))};G.prototype.push=function(t,e){return WO(this,t,e,!1)};G.prototype.unshift=function(t,e){return WO(this,t,e,!0)};function WO(t,e,r,i){Y("readableAddChunk",e);let n=t._readableState,s;if(n.state&uo||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=By.from(e,r).toString(n.encoding):(e=By.from(e,r),r=""))):e instanceof By?r="":_i._isUint8Array(e)?(e=_i._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new gW("chunk",["string","Buffer","Uint8Array"],e))),s)fo(t,s);else if(e===null)n.state&=~mc,BW(t,n);else if(n.state&uo||e&&e.length>0)if(i)if(n.state&LO)fo(t,new vW);else{if(n.destroyed||n.errored)return!1;Ly(t,n,e,!0)}else if(n.ended)fo(t,new SW);else{if(n.destroyed||n.errored)return!1;n.state&=~mc,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Ly(t,n,e,!1):Gu(t,n)):Ly(t,n,e,!1)}else i||(n.state&=~mc,Gu(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}l(WO,"readableAddChunk");function Ly(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&UO?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.state&Vu&&Ku(t)),Gu(t,e)}l(Ly,"addChunk");G.prototype.isPaused=function(){let t=this._readableState;return t[an]===!0||t.flowing===!1};G.prototype.setEncoding=function(t){let e=new MO(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var IW=1073741824;function $W(t){if(t>IW)throw new _W("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}l($W,"computeNewHighWaterMark");function CO(t,e){return t<=0||e.length===0&&e.ended?0:e.state&uo?1:sW(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}l(CO,"howMuchToRead");G.prototype.read=function(t){Y("read",t),t===void 0?t=NaN:nW(t)||(t=oW(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=$W(t)),t!==0&&(e.state&=~qO),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Y("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?jy(this):Ku(this),null;if(t=CO(t,e),t===0&&e.ended)return e.length===0&&jy(this),null;let i=(e.state&Vu)!==0;if(Y("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,Y("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,Y("reading, ended or constructing",i);else if(i){Y("do read"),e.state|=mc|Hu,e.length===0&&(e.state|=Vu);try{this._read(e.highWaterMark)}catch(s){fo(this,s)}e.state&=~Hu,e.reading||(t=CO(r,e))}let n;return t>0?n=JO(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&jy(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function BW(t,e){if(Y("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Ku(t):(e.needReadable=!1,e.emittedReadable=!0,zO(t))}}l(BW,"onEofChunk");function Ku(t){let e=t._readableState;Y("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Y("emitReadable",e.flowing),e.emittedReadable=!0,er.nextTick(zO,t))}l(Ku,"emitReadable");function zO(t){let e=t._readableState;Y("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,VO(t)}l(zO,"emitReadable_");function Gu(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,er.nextTick(MW,t,e))}l(Gu,"maybeReadMore");function MW(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Y("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}l(MW,"maybeReadMore_");G.prototype._read=function(t){throw new bW("_read()")};G.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new cW(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),Y("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==er.stdout&&t!==er.stderr?f:y;i.endEmitted?er.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,_){Y("onunpipe"),b===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,u())}l(o,"onunpipe");function f(){Y("onend"),t.end()}l(f,"onend");let c,a=!1;function u(){Y("cleanup"),t.removeListener("close",m),t.removeListener("finish",w),c&&t.removeListener("drain",c),t.removeListener("error",p),t.removeListener("unpipe",o),r.removeListener("end",f),r.removeListener("end",y),r.removeListener("data",d),a=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}l(u,"cleanup");function h(){a||(i.pipes.length===1&&i.pipes[0]===t?(Y("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(Y("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),c||(c=LW(r,t),t.on("drain",c))}l(h,"pause"),r.on("data",d);function d(b){Y("ondata");let _=t.write(b);Y("dest.write",_),_===!1&&h()}l(d,"ondata");function p(b){if(Y("onerror",b),y(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?fo(t,b):t.emit("error",b)}}l(p,"onerror"),dW(t,"error",p);function m(){t.removeListener("finish",w),y()}l(m,"onclose"),t.once("close",m);function w(){Y("onfinish"),t.removeListener("close",m),y()}l(w,"onfinish"),t.once("finish",w);function y(){Y("unpipe"),r.unpipe(t)}return l(y,"unpipe"),t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(Y("pipe resume"),r.resume()),t};function LW(t,e){return l(function(){let i=t._readableState;i.awaitDrainWriters===e?(Y("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(Y("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}l(LW,"pipeOnDrain");G.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=iW(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};G.prototype.on=function(t,e){let r=_i.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,Y("on readable",i.length,i.reading),i.length?Ku(this):i.reading||er.nextTick(jW,this)),r};G.prototype.addListener=G.prototype.on;G.prototype.removeListener=function(t,e){let r=_i.prototype.removeListener.call(this,t,e);return t==="readable"&&er.nextTick(HO,this),r};G.prototype.off=G.prototype.removeListener;G.prototype.removeAllListeners=function(t){let e=_i.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&er.nextTick(HO,this),e};function HO(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[an]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}l(HO,"updateReadableListening");function jW(t){Y("readable nexttick read 0"),t.read(0)}l(jW,"nReadingNextTick");G.prototype.resume=function(){let t=this._readableState;return t.flowing||(Y("resume"),t.flowing=!t.readableListening,qW(this,t)),t[an]=!1,this};function qW(t,e){e.resumeScheduled||(e.resumeScheduled=!0,er.nextTick(UW,t,e))}l(qW,"resume");function UW(t,e){Y("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),VO(t),e.flowing&&!e.reading&&t.read(0)}l(UW,"resume_");G.prototype.pause=function(){return Y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[an]=!0,this};function VO(t){let e=t._readableState;for(Y("flow",e.flowing);e.flowing&&t.read()!==null;);}l(VO,"flow");G.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{fo(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=aW(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};G.prototype[fW]=function(){return GO(this)};G.prototype.iterator=function(t){return t!==void 0&&FW(t,"options"),GO(this,t)};function GO(t,e){typeof t.read!="function"&&(t=G.wrap(t,{objectMode:!0}));let r=WW(t,e);return r.stream=t,r}l(GO,"streamToAsyncIterator");async function*WW(t,e){let r=My;function i(o){this===t?(r(),r=My):r=o}l(i,"next"),t.on("readable",i);let n,s=BO(t,{writable:!1},o=>{n=o?DO(n,o):null,r(),r=My});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;await new $O(i)}}}catch(o){throw n=DO(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?ho.destroyer(t,null):(t.off("readable",i),s())}}l(WW,"createAsyncIterator");zy(G.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:l(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:l(function(){return this._readableState.flowing},"get"),set:l(function(t){this._readableState&&(this._readableState.flowing=t)},"set")},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});zy(Ju.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[an]!==!1},set(t){this[an]=!!t}}});G._fromList=JO;function JO(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}l(JO,"fromList");function jy(t){let e=t._readableState;Y("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,er.nextTick(zW,e,t))}l(jy,"endReadable");function zW(t,e){if(Y("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)er.nextTick(HW,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}l(zW,"endReadableNT");function HW(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}l(HW,"endWritableNT");G.from=function(t,e){return TW(G,t,e)};var qy;function KO(){return qy===void 0&&(qy={}),qy}l(KO,"lazyWebStreams");G.fromWeb=function(t,e){return KO().newStreamReadableFromReadableStream(t,e)};G.toWeb=function(t,e){return KO().newReadableStreamFromStreamReadable(t,e)};G.wrap=function(t,e){var r,i;return new G({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){ho.destroyer(t,n),s(n)}}).wrap(t)}});var eh=T(($X,cx)=>{"use strict";var cn=gi(),{ArrayPrototypeSlice:QO,Error:VW,FunctionPrototypeSymbolHasInstance:ex,ObjectDefineProperty:tx,ObjectDefineProperties:GW,ObjectSetPrototypeOf:rx,StringPrototypeToLowerCase:JW,Symbol:KW,SymbolHasInstance:XW}=ye();cx.exports=_e;_e.WritableState=bc;var{EventEmitter:YW}=ie("events"),yc=Uu().Stream,{Buffer:Xu}=ie("buffer"),Qu=on(),{addAbortSignal:ZW}=hc(),{getHighWaterMark:QW,getDefaultHighWaterMark:e6}=dc(),{ERR_INVALID_ARG_TYPE:t6,ERR_METHOD_NOT_IMPLEMENTED:r6,ERR_MULTIPLE_CALLBACK:ix,ERR_STREAM_CANNOT_PIPE:i6,ERR_STREAM_DESTROYED:gc,ERR_STREAM_ALREADY_FINISHED:n6,ERR_STREAM_NULL_VALUES:s6,ERR_STREAM_WRITE_AFTER_END:o6,ERR_UNKNOWN_ENCODING:nx}=Ze().codes,{errorOrDestroy:po}=Qu;rx(_e.prototype,yc.prototype);rx(_e,yc);function Gy(){}l(Gy,"nop");var mo=KW("kOnFinished");function bc(t,e,r){typeof r!="boolean"&&(r=e instanceof _r()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?QW(this,t,"writableHighWaterMark",r):e6(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=c6.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Zu(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[mo]=[]}l(bc,"WritableState");function Zu(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}l(Zu,"resetBuffer");bc.prototype.getBuffer=l(function(){return QO(this.buffered,this.bufferedIndex)},"getBuffer");tx(bc.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function _e(t){let e=this instanceof _r();if(!e&&!ex(_e,this))return new _e(t);this._writableState=new bc(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&ZW(t.signal,this)),yc.call(this,t),Qu.construct(this,()=>{let r=this._writableState;r.writing||Ky(this,r),Xy(this,r)})}l(_e,"Writable");tx(_e,XW,{__proto__:null,value:l(function(t){return ex(this,t)?!0:this!==_e?!1:t&&t._writableState instanceof bc},"value")});_e.prototype.pipe=function(){po(this,new i6)};function sx(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!Xu.isEncoding(r))throw new nx(r);typeof i!="function"&&(i=Gy)}if(e===null)throw new s6;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Xu.from(e,r),r="buffer");else if(e instanceof Xu)r="buffer";else if(yc._isUint8Array(e))e=yc._uint8ArrayToBuffer(e),r="buffer";else throw new t6("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new o6:n.destroyed&&(s=new gc("write")),s?(cn.nextTick(i,s),po(t,s,!0),s):(n.pendingcb++,a6(t,n,e,r,i))}l(sx,"_write");_e.prototype.write=function(t,e,r){return sx(this,t,e,r)===!0};_e.prototype.cork=function(){this._writableState.corked++};_e.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Ky(this,t))};_e.prototype.setDefaultEncoding=l(function(e){if(typeof e=="string"&&(e=JW(e)),!Xu.isEncoding(e))throw new nx(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function a6(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Gy&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}l(a6,"writeOrBuffer");function YO(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new gc("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}l(YO,"doWrite");function ZO(t,e,r,i){--e.pendingcb,i(r),Jy(e),po(t,r)}l(ZO,"onwriteError");function c6(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){po(t,new ix);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?cn.nextTick(ZO,t,r,e,n):ZO(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Ky(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},cn.nextTick(l6,r.afterWriteTickInfo)):ox(t,r,1,n))}l(c6,"onwrite");function l6({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,ox(t,e,r,i)}l(l6,"afterWriteTick");function ox(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&Jy(e),Xy(t,e)}l(ox,"afterWrite");function Jy(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],f=t.objectMode?1:s.length;t.length-=f,o((e=t.errored)!==null&&e!==void 0?e:new gc("write"))}let r=t[mo].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new gc("end"))}Zu(t)}l(Jy,"errorBuffer");function Ky(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let f=e.allNoop?Gy:a=>{for(let u=o;u<r.length;++u)r[u].callback(a)},c=e.allNoop&&o===0?r:QO(r,o);c.allBuffers=e.allBuffers,YO(t,e,!0,e.length,c,"",f),Zu(e)}else{do{let{chunk:f,encoding:c,callback:a}=r[o];r[o++]=null;let u=n?1:f.length;YO(t,e,!1,u,f,c,a)}while(o<r.length&&!e.writing);o===r.length?Zu(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}l(Ky,"clearBuffer");_e.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new r6("_write()")};_e.prototype._writev=null;_e.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=sx(this,t,e);s instanceof VW&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,Xy(this,i,!0),i.ended=!0):i.finished?n=new n6("end"):i.destroyed&&(n=new gc("end"))),typeof r=="function"&&(n||i.finished?cn.nextTick(r,n):i[mo].push(r)),this};function Yu(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}l(Yu,"needFinish");function f6(t,e){let r=!1;function i(n){if(r){po(t,n??ix());return}if(r=!0,e.pendingcb--,n){let s=e[mo].splice(0);for(let o=0;o<s.length;o++)s[o](n);po(t,n,e.sync)}else Yu(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,cn.nextTick(Vy,t,e))}l(i,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}l(f6,"callFinal");function u6(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,f6(t,e)):(e.prefinished=!0,t.emit("prefinish")))}l(u6,"prefinish");function Xy(t,e,r){Yu(e)&&(u6(t,e),e.pendingcb===0&&(r?(e.pendingcb++,cn.nextTick((i,n)=>{Yu(n)?Vy(i,n):n.pendingcb--},t,e)):Yu(e)&&(e.pendingcb++,Vy(t,e))))}l(Xy,"finishMaybe");function Vy(t,e){e.pendingcb--,e.finished=!0;let r=e[mo].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}l(Vy,"finish");GW(_e.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:l(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var h6=Qu.destroy;_e.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[mo].length)&&cn.nextTick(Jy,r),h6.call(this,t,e),this};_e.prototype._undestroy=Qu.undestroy;_e.prototype._destroy=function(t,e){e(t)};_e.prototype[YW.captureRejectionSymbol]=function(t){this.destroy(t)};var Hy;function ax(){return Hy===void 0&&(Hy={}),Hy}l(ax,"lazyWebStreams");_e.fromWeb=function(t,e){return ax().newStreamWritableFromWritableStream(t,e)};_e.toWeb=function(t){return ax().newWritableStreamFromStreamWritable(t)}});var Ex=T((MX,vx)=>{var Yy=gi(),d6=ie("buffer"),{isReadable:p6,isWritable:m6,isIterable:lx,isNodeStream:w6,isReadableNodeStream:fx,isWritableNodeStream:ux,isDuplexNodeStream:y6,isReadableStream:hx,isWritableStream:dx}=gr(),px=Lr(),{AbortError:_x,codes:{ERR_INVALID_ARG_TYPE:g6,ERR_INVALID_RETURN_VALUE:mx}}=Ze(),{destroyer:yo}=on(),b6=_r(),Sx=wc(),_6=eh(),{createDeferredPromise:wx}=at(),yx=$y(),gx=globalThis.Blob||d6.Blob,S6=l(typeof gx<"u"?function(e){return e instanceof gx}:function(e){return!1},"isBlob"),v6=globalThis.AbortController||so().AbortController,{FunctionPrototypeCall:bx}=ye(),Zy=class Zy extends b6{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};l(Zy,"Duplexify");var Si=Zy;vx.exports=l(function t(e,r){if(y6(e))return e;if(fx(e))return wo({readable:e});if(ux(e))return wo({writable:e});if(w6(e))return wo({writable:!1,readable:!1});if(hx(e))return wo({readable:Sx.fromWeb(e)});if(dx(e))return wo({writable:_6.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:f}=E6(e);if(lx(n))return yx(Si,n,{objectMode:!0,write:s,final:o,destroy:f});let c=n?.then;if(typeof c=="function"){let a,u=bx(c,n,h=>{if(h!=null)throw new mx("nully","body",h)},h=>{yo(a,h)});return a=new Si({objectMode:!0,readable:!1,write:s,final(h){o(async()=>{try{await u,Yy.nextTick(h,null)}catch(d){Yy.nextTick(h,d)}})},destroy:f})}throw new mx("Iterable, AsyncIterable or AsyncFunction",r,n)}if(S6(e))return t(e.arrayBuffer());if(lx(e))return yx(Si,e,{objectMode:!0,writable:!1});if(hx(e?.readable)&&dx(e?.writable))return Si.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?fx(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?ux(e?.writable)?e?.writable:t(e.writable):void 0;return wo({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return bx(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{yo(n,s)}),n=new Si({objectMode:!0,writable:!1,read(){}})}throw new g6(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function E6(t){let{promise:e,resolve:r}=wx(),i=new v6,n=i.signal;return{value:t(async function*(){for(;;){let o=e;e=null;let{chunk:f,done:c,cb:a}=await o;if(Yy.nextTick(a),c)return;if(n.aborted)throw new _x(void 0,{cause:n.reason});({promise:e,resolve:r}=wx()),yield f}}(),{signal:n}),write(o,f,c){let a=r;r=null,a({chunk:o,done:!1,cb:c})},final(o){let f=r;r=null,f({done:!0,cb:o})},destroy(o,f){i.abort(),f(o)}}}l(E6,"fromAsyncGen");function wo(t){let e=t.readable&&typeof t.readable.read!="function"?Sx.wrap(t.readable):t.readable,r=t.writable,i=!!p6(e),n=!!m6(r),s,o,f,c,a;function u(h){let d=c;c=null,d?d(h):h&&a.destroy(h)}return l(u,"onfinished"),a=new Si({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(px(r,h=>{n=!1,h&&yo(e,h),u(h)}),a._write=function(h,d,p){r.write(h,d)?p():s=p},a._final=function(h){r.end(),o=h},r.on("drain",function(){if(s){let h=s;s=null,h()}}),r.on("finish",function(){if(o){let h=o;o=null,h()}})),i&&(px(e,h=>{i=!1,h&&yo(e,h),u(h)}),e.on("readable",function(){if(f){let h=f;f=null,h()}}),e.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=e.read();if(h===null){f=a._read;return}if(!a.push(h))return}}),a._destroy=function(h,d){!h&&c!==null&&(h=new _x),f=null,s=null,o=null,c===null?d(h):(c=d,yo(r,h),yo(e,h))},a}l(wo,"_duplexify")});var _r=T((jX,kx)=>{"use strict";var{ObjectDefineProperties:F6,ObjectGetOwnPropertyDescriptor:jr,ObjectKeys:T6,ObjectSetPrototypeOf:Fx}=ye();kx.exports=tr;var tg=wc(),Mt=eh();Fx(tr.prototype,tg.prototype);Fx(tr,tg);{let t=T6(Mt.prototype);for(let e=0;e<t.length;e++){let r=t[e];tr.prototype[r]||(tr.prototype[r]=Mt.prototype[r])}}function tr(t){if(!(this instanceof tr))return new tr(t);tg.call(this,t),Mt.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}l(tr,"Duplex");F6(tr.prototype,{writable:{__proto__:null,...jr(Mt.prototype,"writable")},writableHighWaterMark:{__proto__:null,...jr(Mt.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...jr(Mt.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...jr(Mt.prototype,"writableBuffer")},writableLength:{__proto__:null,...jr(Mt.prototype,"writableLength")},writableFinished:{__proto__:null,...jr(Mt.prototype,"writableFinished")},writableCorked:{__proto__:null,...jr(Mt.prototype,"writableCorked")},writableEnded:{__proto__:null,...jr(Mt.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...jr(Mt.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Qy;function Tx(){return Qy===void 0&&(Qy={}),Qy}l(Tx,"lazyWebStreams");tr.fromWeb=function(t,e){return Tx().newStreamDuplexFromReadableWritablePair(t,e)};tr.toWeb=function(t){return Tx().newReadableWritablePairFromDuplex(t)};var eg;tr.from=function(t){return eg||(eg=Ex()),eg(t,"body")}});var ng=T((UX,Ox)=>{"use strict";var{ObjectSetPrototypeOf:Rx,Symbol:k6}=ye();Ox.exports=qr;var{ERR_METHOD_NOT_IMPLEMENTED:R6}=Ze().codes,ig=_r(),{getHighWaterMark:O6}=dc();Rx(qr.prototype,ig.prototype);Rx(qr,ig);var _c=k6("kCallback");function qr(t){if(!(this instanceof qr))return new qr(t);let e=t?O6(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ig.call(this,t),this._readableState.sync=!1,this[_c]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",x6)}l(qr,"Transform");function rg(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}l(rg,"final");function x6(){this._final!==rg&&rg.call(this)}l(x6,"prefinish");qr.prototype._final=rg;qr.prototype._transform=function(t,e,r){throw new R6("_transform()")};qr.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,f)=>{if(o){r(o);return}f!=null&&this.push(f),n.ended||s===i.length||i.length<i.highWaterMark?r():this[_c]=r})};qr.prototype._read=function(){if(this[_c]){let t=this[_c];this[_c]=null,t()}}});var og=T((zX,Ax)=>{"use strict";var{ObjectSetPrototypeOf:xx}=ye();Ax.exports=go;var sg=ng();xx(go.prototype,sg.prototype);xx(go,sg);function go(t){if(!(this instanceof go))return new go(t);sg.call(this,t)}l(go,"PassThrough");go.prototype._transform=function(t,e,r){r(null,t)}});var nh=T((VX,Ix)=>{var Sc=gi(),{ArrayIsArray:A6,Promise:P6,SymbolAsyncIterator:N6,SymbolDispose:D6}=ye(),ih=Lr(),{once:C6}=at(),I6=on(),Px=_r(),{aggregateTwoErrors:$6,codes:{ERR_INVALID_ARG_TYPE:mg,ERR_INVALID_RETURN_VALUE:ag,ERR_MISSING_ARGS:B6,ERR_STREAM_DESTROYED:M6,ERR_STREAM_PREMATURE_CLOSE:L6},AbortError:j6}=Ze(),{validateFunction:q6,validateAbortSignal:U6}=ao(),{isIterable:ln,isReadable:cg,isReadableNodeStream:rh,isNodeStream:Nx,isTransformStream:bo,isWebStream:W6,isReadableStream:lg,isReadableFinished:z6}=gr(),H6=globalThis.AbortController||so().AbortController,fg,ug,hg;function Dx(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=ih(t,{readable:e,writable:r},s=>{i=!s});return{destroy:l(s=>{i||(i=!0,I6.destroyer(t,s||new M6("pipe")))},"destroy"),cleanup:n}}l(Dx,"destroyer");function V6(t){return q6(t[t.length-1],"streams[stream.length - 1]"),t.pop()}l(V6,"popCallback");function dg(t){if(ln(t))return t;if(rh(t))return G6(t);throw new mg("val",["Readable","Iterable","AsyncIterable"],t)}l(dg,"makeAsyncIterable");async function*G6(t){ug||(ug=wc()),yield*ug.prototype[N6].call(t)}l(G6,"fromReadable");async function th(t,e,r,{end:i}){let n,s=null,o=l(a=>{if(a&&(n=a),s){let u=s;s=null,u()}},"resume"),f=l(()=>new P6((a,u)=>{n?u(n):s=l(()=>{n?u(n):a()},"onresolve")}),"wait");e.on("drain",o);let c=ih(e,{readable:!1},o);try{e.writableNeedDrain&&await f();for await(let a of t)e.write(a)||await f();i&&(e.end(),await f()),r()}catch(a){r(n!==a?$6(n,a):a)}finally{c(),e.off("drain",o)}}l(th,"pumpToNode");async function pg(t,e,r,{end:i}){bo(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(o){r(o)}}}l(pg,"pumpToWeb");function J6(...t){return Cx(t,C6(V6(t)))}l(J6,"pipeline");function Cx(t,e,r){if(t.length===1&&A6(t[0])&&(t=t[0]),t.length<2)throw new B6("streams");let i=new H6,n=i.signal,s=r?.signal,o=[];U6(s,"options.signal");function f(){m(new j6)}l(f,"abort"),hg=hg||at().addAbortListener;let c;s&&(c=hg(s,f));let a,u,h=[],d=0;function p(F){m(F,--d===0)}l(p,"finish");function m(F,E){var R;if(F&&(!a||a.code==="ERR_STREAM_PREMATURE_CLOSE")&&(a=F),!(!a&&!E)){for(;h.length;)h.shift()(a);(R=c)===null||R===void 0||R[D6](),i.abort(),E&&(a||o.forEach(D=>D()),Sc.nextTick(e,a,u))}}l(m,"finishImpl");let w;for(let F=0;F<t.length;F++){let E=t[F],R=F<t.length-1,D=F>0,S=R||r?.end!==!1,O=F===t.length-1;if(Nx(E)){let v=function(A){A&&A.name!=="AbortError"&&A.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(A)};var _=v;if(l(v,"onError"),S){let{destroy:A,cleanup:x}=Dx(E,R,D);h.push(A),cg(E)&&O&&o.push(x)}E.on("error",v),cg(E)&&O&&o.push(()=>{E.removeListener("error",v)})}if(F===0)if(typeof E=="function"){if(w=E({signal:n}),!ln(w))throw new ag("Iterable, AsyncIterable or Stream","source",w)}else ln(E)||rh(E)||bo(E)?w=E:w=Px.from(E);else if(typeof E=="function"){if(bo(w)){var y;w=dg((y=w)===null||y===void 0?void 0:y.readable)}else w=dg(w);if(w=E(w,{signal:n}),R){if(!ln(w,!0))throw new ag("AsyncIterable",`transform[${F-1}]`,w)}else{var b;fg||(fg=og());let v=new fg({objectMode:!0}),A=(b=w)===null||b===void 0?void 0:b.then;if(typeof A=="function")d++,A.call(w,M=>{u=M,M!=null&&v.write(M),S&&v.end(),Sc.nextTick(p)},M=>{v.destroy(M),Sc.nextTick(p,M)});else if(ln(w,!0))d++,th(w,v,p,{end:S});else if(lg(w)||bo(w)){let M=w.readable||w;d++,th(M,v,p,{end:S})}else throw new ag("AsyncIterable or Promise","destination",w);w=v;let{destroy:x,cleanup:I}=Dx(w,!1,!0);h.push(x),O&&o.push(I)}}else if(Nx(E)){if(rh(w)){d+=2;let v=K6(w,E,p,{end:S});cg(E)&&O&&o.push(v)}else if(bo(w)||lg(w)){let v=w.readable||w;d++,th(v,E,p,{end:S})}else if(ln(w))d++,th(w,E,p,{end:S});else throw new mg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else if(W6(E)){if(rh(w))d++,pg(dg(w),E,p,{end:S});else if(lg(w)||ln(w))d++,pg(w,E,p,{end:S});else if(bo(w))d++,pg(w.readable,E,p,{end:S});else throw new mg("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else w=Px.from(E)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&Sc.nextTick(f),w}l(Cx,"pipelineImpl");function K6(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new L6)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;l(o,"endFn"),z6(t)?Sc.nextTick(o):t.once("end",o)}else r();return ih(t,{readable:!0,writable:!1},o=>{let f=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&f&&f.ended&&!f.errored&&!f.errorEmitted?t.once("end",r).once("error",r):r(o)}),ih(e,{readable:!1,writable:!0},r)}l(K6,"pipe");Ix.exports={pipelineImpl:Cx,pipeline:J6}});var yg=T((JX,qx)=>{"use strict";var{pipeline:X6}=nh(),sh=_r(),{destroyer:Y6}=on(),{isNodeStream:oh,isReadable:$x,isWritable:Bx,isWebStream:wg,isTransformStream:fn,isWritableStream:Mx,isReadableStream:Lx}=gr(),{AbortError:Z6,codes:{ERR_INVALID_ARG_VALUE:jx,ERR_MISSING_ARGS:Q6}}=Ze(),e4=Lr();qx.exports=l(function(...e){if(e.length===0)throw new Q6("streams");if(e.length===1)return sh.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=sh.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=sh.from(e[p])}for(let p=0;p<e.length;++p)if(!(!oh(e[p])&&!wg(e[p]))){if(p<e.length-1&&!($x(e[p])||Lx(e[p])||fn(e[p])))throw new jx(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Bx(e[p])||Mx(e[p])||fn(e[p])))throw new jx(`streams[${p}]`,r[p],"must be writable")}let i,n,s,o,f;function c(p){let m=o;o=null,m?m(p):p?f.destroy(p):!d&&!h&&f.destroy()}l(c,"onfinished");let a=e[0],u=X6(e,c),h=!!(Bx(a)||Mx(a)||fn(a)),d=!!($x(u)||Lx(u)||fn(u));if(f=new sh({writableObjectMode:!!(a!=null&&a.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:h,readable:d}),h){if(oh(a))f._write=function(m,w,y){a.write(m,w)?y():i=y},f._final=function(m){a.end(),n=m},a.on("drain",function(){if(i){let m=i;i=null,m()}});else if(wg(a)){let w=(fn(a)?a.writable:a).getWriter();f._write=async function(y,b,_){try{await w.ready,w.write(y).catch(()=>{}),_()}catch(F){_(F)}},f._final=async function(y){try{await w.ready,w.close().catch(()=>{}),n=y}catch(b){y(b)}}}let p=fn(u)?u.readable:u;e4(p,()=>{if(n){let m=n;n=null,m()}})}if(d){if(oh(u))u.on("readable",function(){if(s){let p=s;s=null,p()}}),u.on("end",function(){f.push(null)}),f._read=function(){for(;;){let p=u.read();if(p===null){s=f._read;return}if(!f.push(p))return}};else if(wg(u)){let m=(fn(u)?u.readable:u).getReader();f._read=async function(){for(;;)try{let{value:w,done:y}=await m.read();if(!f.push(w))return;if(y){f.push(null);return}}catch{return}}}}return f._destroy=function(p,m){!p&&o!==null&&(p=new Z6),s=null,i=null,n=null,o===null?m(p):(o=m,oh(u)&&Y6(u,p))},f},"compose")});var Yx=T((XX,_g)=>{"use strict";var t4=globalThis.AbortController||so().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r4,ERR_INVALID_ARG_TYPE:vc,ERR_MISSING_ARGS:i4,ERR_OUT_OF_RANGE:n4},AbortError:Sr}=Ze(),{validateAbortSignal:un,validateInteger:Ux,validateObject:hn}=ao(),s4=ye().Symbol("kWeak"),o4=ye().Symbol("kResistStopPropagation"),{finished:a4}=Lr(),c4=yg(),{addAbortSignalNoValidate:l4}=hc(),{isWritable:f4,isNodeStream:u4}=gr(),{deprecate:h4}=at(),{ArrayPrototypePush:d4,Boolean:p4,MathFloor:Wx,Number:m4,NumberIsNaN:w4,Promise:zx,PromiseReject:Hx,PromiseResolve:y4,PromisePrototypeThen:Vx,Symbol:Jx}=ye(),ah=Jx("kEmpty"),Gx=Jx("kEof");function g4(t,e){if(e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),u4(t)&&!f4(t))throw new r4("stream",t,"must be writable");let r=c4(this,t);return e!=null&&e.signal&&l4(e.signal,r),r}l(g4,"compose");function ch(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Wx(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Wx(e.highWaterMark)),Ux(r,"options.concurrency",1),Ux(i,"options.highWaterMark",0),i+=r,l(async function*(){let s=at().AbortSignalAny([e?.signal].filter(p4)),o=this,f=[],c={signal:s},a,u,h=!1,d=0;function p(){h=!0,m()}l(p,"onCatch");function m(){d-=1,w()}l(m,"afterItemProcessed");function w(){u&&!h&&d<r&&f.length<i&&(u(),u=null)}l(w,"maybeResume");async function y(){try{for await(let b of o){if(h)return;if(s.aborted)throw new Sr;try{if(b=t(b,c),b===ah)continue;b=y4(b)}catch(_){b=Hx(_)}d+=1,Vx(b,m,p),f.push(b),a&&(a(),a=null),!h&&(f.length>=i||d>=r)&&await new zx(_=>{u=_})}f.push(Gx)}catch(b){let _=Hx(b);Vx(_,m,p),f.push(_)}finally{h=!0,a&&(a(),a=null)}}l(y,"pump"),y();try{for(;;){for(;f.length>0;){let b=await f[0];if(b===Gx)return;if(s.aborted)throw new Sr;b!==ah&&(yield b),f.shift(),w()}await new zx(b=>{a=b})}}finally{h=!0,u&&(u(),u=null)}},"map").call(this)}l(ch,"map");function b4(t=void 0){return t!=null&&hn(t,"options"),t?.signal!=null&&un(t.signal,"options.signal"),l(async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Sr({cause:t.signal.reason});yield[r++,n]}},"asIndexedPairs").call(this)}l(b4,"asIndexedPairs");async function Kx(t,e=void 0){for await(let r of bg.call(this,t,e))return!0;return!1}l(Kx,"some");async function _4(t,e=void 0){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);return!await Kx.call(this,async(...r)=>!await t(...r),e)}l(_4,"every");async function S4(t,e){for await(let r of bg.call(this,t,e))return r}l(S4,"find");async function v4(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),ah}l(r,"forEachFn");for await(let i of ch.call(this,r,e));}l(v4,"forEach");function bg(t,e){if(typeof t!="function")throw new vc("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:ah}return l(r,"filterFn"),ch.call(this,r,e)}l(bg,"filter");var Sg=class Sg extends i4{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};l(Sg,"ReduceAwareErrMissingArgs");var gg=Sg;async function E4(t,e,r){var i;if(typeof t!="function")throw new vc("reducer",["Function","AsyncFunction"],t);r!=null&&hn(r,"options"),r?.signal!=null&&un(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let a=new Sr(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await a4(this.destroy(a)),a}let s=new t4,o=s.signal;if(r!=null&&r.signal){let a={once:!0,[s4]:this,[o4]:!0};r.signal.addEventListener("abort",()=>s.abort(),a)}let f=!1;try{for await(let a of this){var c;if(f=!0,r!=null&&(c=r.signal)!==null&&c!==void 0&&c.aborted)throw new Sr;n?e=await t(e,a,{signal:o}):(e=a,n=!0)}if(!f&&!n)throw new gg}finally{s.abort()}return e}l(E4,"reduce");async function F4(t){t!=null&&hn(t,"options"),t?.signal!=null&&un(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Sr(void 0,{cause:t.signal.reason});d4(e,i)}return e}l(F4,"toArray");function T4(t,e){let r=ch.call(this,t,e);return l(async function*(){for await(let n of r)yield*n},"flatMap").call(this)}l(T4,"flatMap");function Xx(t){if(t=m4(t),w4(t))return 0;if(t<0)throw new n4("number",">= 0",t);return t}l(Xx,"toIntegerOrInfinity");function k4(t,e=void 0){return e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),t=Xx(t),l(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Sr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Sr;t--<=0&&(yield s)}},"drop").call(this)}l(k4,"drop");function R4(t,e=void 0){return e!=null&&hn(e,"options"),e?.signal!=null&&un(e.signal,"options.signal"),t=Xx(t),l(async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Sr;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Sr;if(t-- >0&&(yield s),t<=0)return}},"take").call(this)}l(R4,"take");_g.exports.streamReturningOperators={asIndexedPairs:h4(b4,"readable.asIndexedPairs will be removed in a future version."),drop:k4,filter:bg,flatMap:T4,map:ch,take:R4,compose:g4};_g.exports.promiseReturningOperators={every:_4,forEach:v4,reduce:E4,toArray:F4,some:Kx,find:S4}});var vg=T((ZX,Zx)=>{"use strict";var{ArrayPrototypePop:O4,Promise:x4}=ye(),{isIterable:A4,isNodeStream:P4,isWebStream:N4}=gr(),{pipelineImpl:D4}=nh(),{finished:C4}=Lr();Eg();function I4(...t){return new x4((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!P4(s)&&!A4(s)&&!N4(s)){let o=O4(t);i=o.signal,n=o.end}D4(t,(o,f)=>{o?r(o):e(f)},{signal:i,end:n})})}l(I4,"pipeline");Zx.exports={finished:C4,pipeline:I4}});var Eg=T((eY,aA)=>{"use strict";var{Buffer:$4}=ie("buffer"),{ObjectDefineProperty:Ur,ObjectKeys:tA,ReflectApply:rA}=ye(),{promisify:{custom:iA}}=at(),{streamReturningOperators:Qx,promiseReturningOperators:eA}=Yx(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:nA}}=Ze(),B4=yg(),{setDefaultHighWaterMark:M4,getDefaultHighWaterMark:L4}=dc(),{pipeline:sA}=nh(),{destroyer:j4}=on(),oA=Lr(),Fg=vg(),Ec=gr(),pe=aA.exports=Uu().Stream;pe.isDestroyed=Ec.isDestroyed;pe.isDisturbed=Ec.isDisturbed;pe.isErrored=Ec.isErrored;pe.isReadable=Ec.isReadable;pe.isWritable=Ec.isWritable;pe.Readable=wc();for(let t of tA(Qx)){let r=function(...i){if(new.target)throw nA();return pe.Readable.from(rA(e,this,i))};l(r,"fn");let e=Qx[t];Ur(r,"name",{__proto__:null,value:e.name}),Ur(r,"length",{__proto__:null,value:e.length}),Ur(pe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of tA(eA)){let r=function(...i){if(new.target)throw nA();return rA(e,this,i)};l(r,"fn");let e=eA[t];Ur(r,"name",{__proto__:null,value:e.name}),Ur(r,"length",{__proto__:null,value:e.length}),Ur(pe.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}pe.Writable=eh();pe.Duplex=_r();pe.Transform=ng();pe.PassThrough=og();pe.pipeline=sA;var{addAbortSignal:q4}=hc();pe.addAbortSignal=q4;pe.finished=oA;pe.destroy=j4;pe.compose=B4;pe.setDefaultHighWaterMark=M4;pe.getDefaultHighWaterMark=L4;Ur(pe,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Fg}});Ur(sA,iA,{__proto__:null,enumerable:!0,get(){return Fg.pipeline}});Ur(oA,iA,{__proto__:null,enumerable:!0,get(){return Fg.finished}});pe.Stream=pe;pe._isUint8Array=l(function(e){return e instanceof Uint8Array},"isUint8Array");pe._uint8ArrayToBuffer=l(function(e){return $4.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var cA=T((rY,X)=>{"use strict";var Ie=ie("stream");if(Ie&&process.env.READABLE_STREAM==="disable"){let t=Ie.promises;X.exports._uint8ArrayToBuffer=Ie._uint8ArrayToBuffer,X.exports._isUint8Array=Ie._isUint8Array,X.exports.isDisturbed=Ie.isDisturbed,X.exports.isErrored=Ie.isErrored,X.exports.isReadable=Ie.isReadable,X.exports.Readable=Ie.Readable,X.exports.Writable=Ie.Writable,X.exports.Duplex=Ie.Duplex,X.exports.Transform=Ie.Transform,X.exports.PassThrough=Ie.PassThrough,X.exports.addAbortSignal=Ie.addAbortSignal,X.exports.finished=Ie.finished,X.exports.destroy=Ie.destroy,X.exports.pipeline=Ie.pipeline,X.exports.compose=Ie.compose,Object.defineProperty(Ie,"promises",{configurable:!0,enumerable:!0,get(){return t}}),X.exports.Stream=Ie.Stream}else{let t=Eg(),e=vg(),r=t.Readable.destroy;X.exports=t.Readable,X.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,X.exports._isUint8Array=t._isUint8Array,X.exports.isDisturbed=t.isDisturbed,X.exports.isErrored=t.isErrored,X.exports.isReadable=t.isReadable,X.exports.Readable=t.Readable,X.exports.Writable=t.Writable,X.exports.Duplex=t.Duplex,X.exports.Transform=t.Transform,X.exports.PassThrough=t.PassThrough,X.exports.addAbortSignal=t.addAbortSignal,X.exports.finished=t.finished,X.exports.destroy=t.destroy,X.exports.destroy=r,X.exports.pipeline=t.pipeline,X.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return e}}),X.exports.Stream=t.Stream}X.exports.default=X.exports});var ir=T(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.constants=No.SEP=void 0;No.SEP="/";No.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var Bg=T(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.Stats=void 0;var m3=ir(),{S_IFMT:w3,S_IFDIR:y3,S_IFREG:g3,S_IFBLK:b3,S_IFCHR:_3,S_IFLNK:S3,S_IFIFO:v3,S_IFSOCK:E3}=m3.constants,Oh=class Oh{static build(e,r=!1){let i=new Oh,{uid:n,gid:s,atime:o,mtime:f,ctime:c}=e,a=r?h=>BigInt(h):h=>h;i.uid=a(n),i.gid=a(s),i.rdev=a(e.rdev),i.blksize=a(4096),i.ino=a(e.ino),i.size=a(e.getSize()),i.blocks=a(1),i.atime=o,i.mtime=f,i.ctime=c,i.birthtime=c,i.atimeMs=a(o.getTime()),i.mtimeMs=a(f.getTime());let u=a(c.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(o.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(c.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=a(0),i.mode=a(e.mode),i.nlink=a(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&w3)===e}isDirectory(){return this._checkModeProperty(y3)}isFile(){return this._checkModeProperty(g3)}isBlockDevice(){return this._checkModeProperty(b3)}isCharacterDevice(){return this._checkModeProperty(_3)}isSymbolicLink(){return this._checkModeProperty(S3)}isFIFO(){return this._checkModeProperty(v3)}isSocket(){return this._checkModeProperty(E3)}};l(Oh,"Stats");var Rh=Oh;Oc.Stats=Rh;Oc.default=Rh});var zA=T(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.Buffer=void 0;var F3=ie("node:buffer");Object.defineProperty(xh,"Buffer",{enumerable:!0,get:l(function(){return F3.Buffer},"get")})});var Fi=T(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.bufferFrom=Ei.bufferAllocUnsafe=Ei.Buffer=void 0;var Ah=zA();Object.defineProperty(Ei,"Buffer",{enumerable:!0,get:l(function(){return Ah.Buffer},"get")});function HA(t,...e){return new Ah.Buffer(t,...e)}l(HA,"bufferV0P12Ponyfill");var T3=Ah.Buffer.allocUnsafe||HA;Ei.bufferAllocUnsafe=T3;var k3=Ah.Buffer.from||HA;Ei.bufferFrom=k3});var Lg=T(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.inherits=R3;Do.promisify=O3;Do.inspect=Mg;Do.format=x3;function R3(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(R3,"inherits");function O3(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(O3,"promisify");function Mg(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>Mg(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${Mg(i)}`).join(", ")} }`:String(t)}l(Mg,"inspect");function x3(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(x3,"format")});var xc=T(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.AssertionError=tt.RangeError=tt.TypeError=tt.Error=void 0;tt.message=JA;tt.E=Ti;var jg=Lg(),VA=typeof Symbol>"u"?"_kCode":Symbol("code"),GA={};function Ug(t){var e;return e=class extends t{constructor(i,...n){super(JA(i,n)),this.code=i,this[VA]=i,this.name=`${super.name} [${this[VA]}]`}},l(e,"NodeError"),e}l(Ug,"makeNodeError");var Ph=globalThis,Wg=class Wg extends Ph.Error{constructor(e){if(typeof e!="object"||e===null)throw new tt.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,jg.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,jg.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,tt.Error.captureStackTrace(this,e.stackStartFunction)}};l(Wg,"AssertionError");var qg=Wg;tt.AssertionError=qg;function JA(t,e){if(typeof t!="string")throw new tt.Error("Error message key must be a string");let r=GA[t];if(!r)throw new tt.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=jg.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(JA,"message");function Ti(t,e){GA[t]=typeof e=="function"?e:String(e)}l(Ti,"E");tt.Error=Ug(Ph.Error);tt.TypeError=Ug(Ph.TypeError);tt.RangeError=Ug(Ph.RangeError);Ti("ERR_DIR_CLOSED","Directory handle was closed");Ti("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Ti("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Ti("ERR_INVALID_FILE_URL_PATH","File URL path %s");Ti("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Ti("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Ti("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Ac=T(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.ENCODING_UTF8=void 0;yn.assertEncoding=P3;yn.strToEncoding=N3;var zg=Fi(),A3=xc();yn.ENCODING_UTF8="utf8";function P3(t){if(t&&!zg.Buffer.isEncoding(t))throw new A3.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(P3,"assertEncoding");function N3(t,e){return!e||e===yn.ENCODING_UTF8?t:e==="buffer"?new zg.Buffer(t):new zg.Buffer(t).toString(e)}l(N3,"strToEncoding")});var Ch=T(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.Dirent=void 0;var D3=ir(),C3=Ac(),{S_IFMT:I3,S_IFDIR:$3,S_IFREG:B3,S_IFBLK:M3,S_IFCHR:L3,S_IFLNK:j3,S_IFIFO:q3,S_IFSOCK:U3}=D3.constants,Dh=class Dh{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Dh,{mode:n}=e.getNode();return i.name=(0,C3.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&I3)===e}isDirectory(){return this._checkModeProperty($3)}isFile(){return this._checkModeProperty(B3)}isBlockDevice(){return this._checkModeProperty(M3)}isCharacterDevice(){return this._checkModeProperty(L3)}isSymbolicLink(){return this._checkModeProperty(j3)}isFIFO(){return this._checkModeProperty(q3)}isSocket(){return this._checkModeProperty(U3)}};l(Dh,"Dirent");var Nh=Dh;Pc.Dirent=Nh;Pc.default=Nh});var Co=T(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.basename=xe.isAbsolute=xe.normalize=xe.dirname=xe.relative=xe.join=xe.posix=xe.sep=xe.resolve=void 0;var zr=ie("node:path");Object.defineProperty(xe,"resolve",{enumerable:!0,get:l(function(){return zr.resolve},"get")});Object.defineProperty(xe,"sep",{enumerable:!0,get:l(function(){return zr.sep},"get")});Object.defineProperty(xe,"posix",{enumerable:!0,get:l(function(){return zr.posix},"get")});Object.defineProperty(xe,"join",{enumerable:!0,get:l(function(){return zr.join},"get")});Object.defineProperty(xe,"relative",{enumerable:!0,get:l(function(){return zr.relative},"get")});Object.defineProperty(xe,"dirname",{enumerable:!0,get:l(function(){return zr.dirname},"get")});Object.defineProperty(xe,"normalize",{enumerable:!0,get:l(function(){return zr.normalize},"get")});Object.defineProperty(xe,"isAbsolute",{enumerable:!0,get:l(function(){return zr.isAbsolute},"get")});Object.defineProperty(xe,"basename",{enumerable:!0,get:l(function(){return zr.basename},"get")})});var XA=T(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:!0})});var Vg=T(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.flattenJSON=void 0;var YA=Fi(),Hg=Co(),W3=Hg.posix?Hg.posix.join:Hg.join,z3=l(t=>{let e={};function r(i,n){for(let s in n){let o=n[s],f=W3(i,s);typeof o=="string"||o instanceof YA.Buffer?e[f]=o:typeof o=="object"&&o!==null&&!(o instanceof YA.Buffer)&&Object.keys(o).length>0?r(f,o):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");Ih.flattenJSON=z3});var Bh=T($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.createProcess=ZA;var H3=l(()=>{if(typeof process<"u")return process;try{return ie("process")}catch{return}},"maybeReturnProcess");function ZA(){let t=H3()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(ZA,"createProcess");$h.default=ZA()});var Kg=T(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.Node=void 0;var V3=aa(),tP=Bh(),Vr=Fi(),G3=ir(),{S_IFMT:Hr,S_IFDIR:J3,S_IFREG:K3,S_IFLNK:QA,S_IFCHR:X3}=G3.constants,Mh=l(()=>tP.default.getuid?.()??0,"getuid"),Lh=l(()=>tP.default.getgid?.()??0,"getgid"),eP=(0,Vr.bufferAllocUnsafe)(0),Jg=class Jg{constructor(e,r=438){this.changes=new V3.FanOut,this._uid=Mh(),this._gid=Lh(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=eP,this.capacity=0,this.size=0,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Hr}set perm(e){this.mode=this.mode&Hr|e&~Hr,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this._setBuf((0,Vr.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,Vr.bufferAllocUnsafe)(0)),(0,Vr.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let r=(0,Vr.bufferFrom)(e);this._setBuf(r)}_setBuf(e){let r=e.length;this.buf=e,this.capacity=r,this.size=r,this.touch()}getSize(){return this.size}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Hr)===K3}isDirectory(){return(this.mode&Hr)===J3}isSymlink(){return(this.mode&Hr)===QA}isCharacterDevice(){return(this.mode&Hr)===X3}makeSymlink(e){this.mode=QA|438,this.symlink=e}write(e,r=0,i=e.length,n=0){let s=e.length;if(r+i>s&&(i=s-r),i<=0)return 0;let o=n+i;if(o>this.capacity){let f=Math.max(this.capacity*2,64);for(;f<o;)f*=2;let c=(0,Vr.bufferAllocUnsafe)(f);this.size>0&&this.buf.copy(c,0,0,this.size),this.buf=c,this.capacity=f}return n>this.size&&this.buf.fill(0,this.size,n),e.copy(this.buf,n,r,r+i),o>this.size&&(this.size=o),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,n>=this.size)return 0;let s=i;if(s>e.byteLength&&(s=e.byteLength),s+n>this.size&&(s=this.size-n),s<=0)return 0;let o=e instanceof Vr.Buffer?e:Vr.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(o,r,n,n+s),s}truncate(e=0){if(!e){this.buf=eP,this.capacity=0,this.size=0,this.touch();return}if(e<=this.size)this.size=e;else{if(e>this.capacity){let r=Math.max(this.capacity*2,64);for(;r<e;)r*=2;let i=(0,Vr.bufferAllocUnsafe)(r);this.size>0&&this.buf.copy(i,0,0,this.size),i.fill(0,this.size,e),this.buf=i,this.capacity=r}else this.buf.fill(0,this.size,e);this.size=e}this.touch()}chmod(e){this.mode=this.mode&Hr|e&~Hr,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=Mh(),r=Lh()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=Mh(),r=Lh()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=Mh(),r=Lh()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(Jg,"Node");var Gg=Jg;jh.Node=Gg});var Yg=T(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.Link=void 0;var Y3=ir(),Z3=aa(),{S_IFREG:Q3}=Y3.constants,Nc=class Nc{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new Z3.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(Q3|438)){let i=new Nc(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new Nc(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(Nc,"Link");var Xg=Nc;qh.Link=Xg});var e0=T(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.File=void 0;var ez=ir(),{O_APPEND:tz}=ez.constants,Qg=class Qg{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&tz&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(Qg,"File");var Zg=Qg;Uh.File=Zg});var Bo=T($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.FLAGS=$o.ERRSTR=void 0;var rz=ir();$o.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:rP,O_WRONLY:Wh,O_RDWR:Io,O_CREAT:ki,O_EXCL:zh,O_TRUNC:Hh,O_APPEND:Vh,O_SYNC:iP}=rz.constants,nP;(function(t){t[t.r=rP]="r",t[t["r+"]=Io]="r+",t[t.rs=rP|iP]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Io|iP]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=Wh|ki|Hh]="w",t[t.wx=Wh|ki|Hh|zh]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Io|ki|Hh]="w+",t[t["wx+"]=Io|ki|Hh|zh]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=Wh|Vh|ki]="a",t[t.ax=Wh|Vh|ki|zh]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Io|Vh|ki]="a+",t[t["ax+"]=Io|Vh|ki|zh]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(nP||($o.FLAGS=nP={}))});var r0=T(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});t0.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Xh=T(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.filenameToSteps=je.resolve=je.unixify=je.isWin=void 0;je.isFd=oP;je.validateFd=hz;je.dataToBuffer=dz;var Jh=Co(),Gh=Fi(),sP=Bh(),iz=Ac(),nz=Bo();je.isWin=sP.default.platform==="win32";var sz=Jh.resolve,oz=Jh.posix?Jh.posix.sep:Jh.sep,az=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||je.isWin&&r==="\\")},"isSeparator"),cz=l(t=>{let e=t.length-1;if(e<2)return t;for(;az(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),lz=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=cz(t)),t},"normalizePath"),fz=l((t,e=!0)=>je.isWin?(t=lz(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");je.unixify=fz;var Kh=l((t,e=sP.default.cwd())=>sz(e,t),"resolve");je.resolve=Kh;if(je.isWin){let t=Kh;je.resolve=Kh=l((e,r)=>(0,je.unixify)(t(e,r)),"resolve")}var uz=l((t,e)=>{let i=Kh(t,e).substring(1);return i?i.split(oz):[]},"filenameToSteps");je.filenameToSteps=uz;function oP(t){return t>>>0===t}l(oP,"isFd");function hz(t){if(!oP(t))throw TypeError(nz.ERRSTR.FD)}l(hz,"validateFd");function dz(t,e=iz.ENCODING_UTF8){return Gh.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,Gh.bufferFrom)(t):e==="buffer"?(0,Gh.bufferFrom)(String(t),"utf8"):(0,Gh.bufferFrom)(String(t),e)}l(dz,"dataToBuffer")});var Ri=T($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.getWriteSyncArgs=$e.getWriteArgs=$e.bufToUint8=void 0;$e.promisify=mz;$e.validateCallback=aP;$e.modeToNumber=cP;$e.nullCheck=lP;$e.pathToFilename=gz;$e.createError=Cz;$e.genRndStr6=Iz;$e.flagsToNumber=$z;$e.streamToBuffer=Bz;$e.bufferToEncoding=qz;$e.isReadableStream=Uz;var Dc=Bo(),i0=xc(),n0=Fi(),pz=r0(),Yh=Xh();function mz(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(o,f)=>o?s(o):n(r(f)))})}l(mz,"promisify");function aP(t){if(typeof t!="function")throw TypeError(Dc.ERRSTR.CB);return t}l(aP,"validateCallback");function wz(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return cP(e)}l(wz,"_modeToNumber");function cP(t,e){let r=wz(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(Dc.ERRSTR.MODE_INT);return r}l(cP,"modeToNumber");function lP(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,pz.default)(()=>{e(r)}),!1}return!0}l(lP,"nullCheck");function yz(t){if(t.hostname!=="")throw new i0.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new i0.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(yz,"getPathFromURLPosix");function gz(t){if(t instanceof Uint8Array&&(t=(0,n0.bufferFrom)(t)),typeof t!="string"&&!n0.Buffer.isBuffer(t)){try{if(!(t instanceof ie("url").URL))throw new TypeError(Dc.ERRSTR.PATH_STR)}catch{throw new TypeError(Dc.ERRSTR.PATH_STR)}t=yz(t)}let e=String(t);return lP(e),e}l(gz,"pathToFilename");var bz="ENOENT",_z="EBADF",Sz="EINVAL",vz="EPERM",Ez="EPROTO",Fz="EEXIST",Tz="ENOTDIR",kz="EMFILE",Rz="EACCES",Oz="EISDIR",xz="ENOTEMPTY",Az="ENOSYS",Pz="ERR_FS_EISDIR",Nz="ERR_OUT_OF_RANGE";function Dz(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case bz:return`ENOENT: no such file or directory, ${e}${n}`;case _z:return`EBADF: bad file descriptor, ${e}${n}`;case Sz:return`EINVAL: invalid argument, ${e}${n}`;case vz:return`EPERM: operation not permitted, ${e}${n}`;case Ez:return`EPROTO: protocol error, ${e}${n}`;case Fz:return`EEXIST: file already exists, ${e}${n}`;case Tz:return`ENOTDIR: not a directory, ${e}${n}`;case Oz:return`EISDIR: illegal operation on a directory, ${e}${n}`;case Rz:return`EACCES: permission denied, ${e}${n}`;case xz:return`ENOTEMPTY: directory not empty, ${e}${n}`;case kz:return`EMFILE: too many open files, ${e}${n}`;case Az:return`ENOSYS: function not implemented, ${e}${n}`;case Pz:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case Nz:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(Dz,"formatError");function Cz(t,e="",r="",i="",n=Error){let s=new n(Dz(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(Cz,"createError");function Iz(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(Iz,"genRndStr6");function $z(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=Dc.FLAGS[t];if(typeof e<"u")return e}throw new i0.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l($z,"flagsToNumber");function Bz(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(n0.Buffer.concat(e))),t.on("error",i)})}l(Bz,"streamToBuffer");var Mz=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");$e.bufToUint8=Mz;var Lz=l((t,e,r,i,n,s)=>{(0,Yh.validateFd)(t);let o=0,f,c=null,a,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(o=r|0,u=i):m==="function"?(o=r|0,f=i,u=n):(o=r|0,f=i,c=n,u=s):d==="function"?u=r:p==="function"?(c=r,u=i):m==="function"&&(c=r,a=i,u=n);let w=(0,Yh.dataToBuffer)(e,a);h!=="string"?typeof f>"u"&&(f=w.length):(o=0,f=w.length);let y=aP(u);return[t,h==="string",w,o,f,c,y]},"getWriteArgs");$e.getWriteArgs=Lz;var jz=l((t,e,r,i,n)=>{(0,Yh.validateFd)(t);let s,o,f,c,a=typeof e!="string";a?(o=(r||0)|0,f=i,c=n):(c=r,s=i);let u=(0,Yh.dataToBuffer)(e,s);return a?typeof f>"u"&&(f=u.length):(o=0,f=u.length),[t,u,o||0,f,c]},"getWriteSyncArgs");$e.getWriteSyncArgs=jz;function qz(t,e){return!e||e==="buffer"?t:t.toString(e)}l(qz,"bufferToEncoding");function Uz(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(Uz,"isReadableStream")});var mP=T(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.Superblock=void 0;var qe=Co(),Wz=Kg(),fP=Yg(),zz=e0(),Hz=Fi(),uP=Bh(),Tr=ir(),hP=Bo(),J=Ri(),nr=Xh(),Vz=Vg(),Mo=qe.posix?qe.posix.sep:qe.sep,dP=qe.posix?qe.posix.relative:qe.relative,Gz=qe.posix?qe.posix.join:qe.join,{O_RDONLY:s0,O_WRONLY:Zh,O_RDWR:o0,O_CREAT:pP,O_EXCL:Jz,O_TRUNC:Kz,O_APPEND:Xz,O_DIRECTORY:Yz}=Tr.constants,Lo=class Lo{static fromJSON(e,r){let i=new Lo;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new Lo;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,o=!0)=>{let f=this.openFile(i,n,s,o);if(!f)throw(0,J.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,o)=>{let f=typeof i=="number",c;f?c=i:c=this.open((0,J.pathToFilename)(i),s,o);let a=0,u=n.length,h=s&Xz?void 0:0;try{for(;u>0;){let d=this.write(c,n,a,u,h);a+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(c)}},this.read=(i,n,s,o,f)=>{if(n.byteLength<o)throw(0,J.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let c=this.getFileByFdOrThrow(i);if(c.node.isSymlink())throw(0,J.createError)("EPERM","read",c.link.getPath());return c.read(n,Number(s),Number(o),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let o=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let c=0;for(let a of n){let u=o.read(a,0,a.byteLength,f);if(f=void 0,c+=u,u<a.byteLength)break}return c},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"link",i,n)),u}let o=(0,qe.dirname)(n),f;try{f=this.getLinkOrThrow(o,"link")}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"link",i,n)),u}let c=(0,qe.basename)(n);if(f.getChild(c))throw(0,J.createError)("EEXIST","link",i,n);let a=s.getNode();a.nlink++,f.createChild(c,a)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,nr.filenameToSteps)(n),o;try{o=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,J.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(o.getChild(f))throw(0,J.createError)("EEXIST","symlink",i,n);let c=o.getNode();if(!c.canExecute()||!c.canWrite())throw(0,J.createError)("EACCES","symlink",i,n);let a=o.createChild(f);return a.getNode().makeSymlink(i),a},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,J.createError)(h.code,"rename",i,n)),h}let o;try{o=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,J.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,J.createError)("EINVAL","rename",i,n);let c=f.getNode(),a=o.getNode();if(!c.canExecute()||!c.canWrite()||!a.canExecute()||!a.canWrite())throw(0,J.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,qe.basename)(n);s.name=u,s.steps=[...o.steps,u],o.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,nr.filenameToSteps)(i);if(!s.length)throw(0,J.createError)("EEXIST","mkdir",i);let o=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(o.getChild(f))throw(0,J.createError)("EEXIST","mkdir",i);let c=o.getNode();if(!c.canWrite()||!c.canExecute())throw(0,J.createError)("EACCES","mkdir",i);o.createChild(f,this.createNode(Tr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,o=(0,nr.filenameToSteps)(i),f=null,c=o.length;for(c=o.length;c>=0&&(f=this.getResolvedLink(o.slice(0,c)),!f);c--);for(f||(f=this.root,c=0),f=this.getResolvedLinkOrThrow(qe.sep+o.slice(0,c).join(qe.sep),"mkdir"),c;c<o.length;c++){let a=f.getNode();if(a.isDirectory()){if(!a.canExecute()||!a.canWrite())throw(0,J.createError)("EACCES","mkdir",i)}else throw(0,J.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(o[c],this.createNode(Tr.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,J.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let o;try{o=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(o.getNode().isDirectory()&&!s)throw(0,J.createError)("ERR_FS_EISDIR","rm",i);if(!o.parent?.getNode().canWrite())throw(0,J.createError)("EACCES","rm",i);this.deleteLink(o)},this.close=i=>{(0,nr.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Tr.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new fP.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&Tr.constants.S_IFMT?n&Tr.constants.S_IFMT:i?Tr.constants.S_IFDIR:Tr.constants.S_IFREG,c=s&~Tr.constants.S_IFMT|f;return e.createChild(r,this.createNode(c))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:Lo.fd--}createNode(e){let r=new Wz.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let o,f;e instanceof fP.Link?(o=e.steps,f=Mo+o.join(Mo)):typeof e=="string"?(o=(0,nr.filenameToSteps)(e),f=e):(o=e,f=Mo+o.join(Mo));let c=this.root,a=0;for(;a<o.length;){let u=c.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,J.createError)("EACCES",s,f)}else if(a<o.length-1)throw(0,J.createError)("ENOTDIR",s,f);if(c=c.getChild(o[a])??null,!c){if(i)throw(0,J.createError)("ENOENT",s,f);return null}if(u=c?.getNode(),u.isSymlink()&&(r||a<o.length-1)){let h=(0,qe.isAbsolute)(u.symlink)?u.symlink:Gz((0,qe.dirname)(c.getPath()),u.symlink);o=(0,nr.filenameToSteps)(h).concat(o.slice(a+1)),c=this.root,a=0;continue}if(i&&!u.isDirectory()&&a<o.length-1){let h=uP.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,J.createError)(h,s,f)}a++}return c}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,J.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,nr.filenameToSteps)(e)).slice(0,-1),n=Mo+i.join(Mo),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,J.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,nr.isFd)(e))throw TypeError(hP.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,J.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,o=e.children;e.getNode().isFile()&&(o=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let c of o.keys()){if(c==="."||c==="..")continue;s=!1;let a=e.getChild(c);if(!a)throw new Error("_toJSON: unexpected undefined");let u=a.getNode();if(u.isFile()){let h=a.getPath();i&&(h=dP(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(a,r,i,n)}let f=e.getPath();return i&&(f=dP(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let o of e){let f=(0,J.pathToFilename)(o),c=this.getResolvedLink(f);c&&s.push(c)}}else s.push(this.root);if(!s.length)return r;for(let o of s)this._toJSON(o,r,i?o.getPath():"",n);return r}fromJSON(e,r=uP.default.cwd()){for(let i in e){let n=e[i];if(i=(0,nr.resolve)(i,r),typeof n=="string"||n instanceof Hz.Buffer){let s=(0,qe.dirname)(i);this.mkdirp(s,511);let o=(0,nr.dataToBuffer)(n);this.writeFile(i,o,hP.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,Vz.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(Tr.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,J.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(s0|o0|Zh))!==s0)throw(0,J.createError)("EISDIR","open",e.getPath())}else if(r&Yz)throw(0,J.createError)("ENOTDIR","open",e.getPath());if((r&(s0|o0|Zh))!==Zh&&!s.canRead()||r&(Zh|o0)&&!s.canWrite())throw(0,J.createError)("EACCES","open",e.getPath());let o=new zz.File(e,s,r,this.newFdNumber());return this.fds[o.fd]=o,this.openFiles++,r&Kz&&o.truncate(),o}openFile(e,r,i,n=!0){let s=(0,nr.filenameToSteps)(e),o;try{if(o=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),o&&r&pP&&r&Jz)throw(0,J.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&pP){let c=(0,qe.dirname)(e),a=this.getResolvedLinkOrThrow(c),u=a.getNode();if(!u.isDirectory())throw(0,J.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,J.createError)("EACCES","open",e);i??(i=438),o=this.createLink(a,s[s.length-1],!1,i)}else throw f}if(o)return this.openLink(o,r,n);throw(0,J.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let o=this.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,J.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(Lo,"Superblock");var Qh=Lo;ed.Superblock=Qh;Qh.fd=2147483647});var yP=T(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Superblock=qt.File=qt.Link=qt.Node=void 0;var wP=(nl(),Od(il));wP.__exportStar(XA(),qt);wP.__exportStar(Vg(),qt);var Zz=Kg();Object.defineProperty(qt,"Node",{enumerable:!0,get:l(function(){return Zz.Node},"get")});var Qz=Yg();Object.defineProperty(qt,"Link",{enumerable:!0,get:l(function(){return Qz.Link},"get")});var eH=e0();Object.defineProperty(qt,"File",{enumerable:!0,get:l(function(){return eH.File},"get")});var tH=mP();Object.defineProperty(qt,"Superblock",{enumerable:!0,get:l(function(){return tH.Superblock},"get")})});var gP=T(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.StatFs=void 0;var rd=class rd{static build(e,r=!1){let i=new rd,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,o=1e6,f=Math.min(s*2,o),c=o-f;i.blocks=n(o),i.bfree=n(c),i.bavail=n(c);let a=1e6;return i.files=n(a),i.ffree=n(a-s),i}};l(rd,"StatFs");var td=rd;Cc.StatFs=td;Cc.default=td});var bP=T(a0=>{"use strict";Object.defineProperty(a0,"__esModule",{value:!0});function rH(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(rH,"setTimeoutUnref");a0.default=rH});var SP=T(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.Writable=jo.Readable=void 0;var _P=ie("node:stream");Object.defineProperty(jo,"Readable",{enumerable:!0,get:l(function(){return _P.Readable},"get")});Object.defineProperty(jo,"Writable",{enumerable:!0,get:l(function(){return _P.Writable},"get")})});var c0=T(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.EventEmitter=void 0;var iH=ie("node:events");Object.defineProperty(id,"EventEmitter",{enumerable:!0,get:l(function(){return iH.EventEmitter},"get")})});var vP=T(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.FileHandle=void 0;var rt=Ri(),nH=c0(),f0=class f0 extends nH.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,rt.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,rt.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,rt.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,rt.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,rt.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async o=>{try{let f=o.byobRequest?.view;if(!f){let a=new Uint8Array(16384),u=await this.read(a,0,a.length,n);if(u.bytesRead===0){o.close(),s();return}n+=u.bytesRead,o.enqueue(a.slice(0,u.bytesRead));return}let c=await this.read(f,f.byteOffset,f.byteLength,n);if(c.bytesRead===0){o.close(),s();return}n+=c.bytesRead,o.byobRequest.respond(c.bytesRead)}catch(f){o.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,o=await(0,rt.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=o.bytesRead),o}readv(e,r){return(0,rt.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,rt.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,rt.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,rt.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,rt.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,rt.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",o=s?this.position:n,f=await(0,rt.promisify)(this.fs,"write",c=>({bytesWritten:c,buffer:e}))(this.fd,e,r,i,o);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,rt.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,rt.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,rt.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(f0,"FileHandle");var l0=f0;nd.FileHandle=l0});var EP=T(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});sd.FsPromises=void 0;var oe=Ri(),sH=ir(),d0=class d0{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(d0,"FSWatchAsyncIterator");var u0=d0,p0=class p0{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=sH.constants,this.cp=(0,oe.promisify)(this.fs,"cp"),this.opendir=(0,oe.promisify)(this.fs,"opendir"),this.statfs=(0,oe.promisify)(this.fs,"statfs"),this.lutimes=(0,oe.promisify)(this.fs,"lutimes"),this.glob=(0,oe.promisify)(this.fs,"glob"),this.access=(0,oe.promisify)(this.fs,"access"),this.chmod=(0,oe.promisify)(this.fs,"chmod"),this.chown=(0,oe.promisify)(this.fs,"chown"),this.copyFile=(0,oe.promisify)(this.fs,"copyFile"),this.lchmod=(0,oe.promisify)(this.fs,"lchmod"),this.lchown=(0,oe.promisify)(this.fs,"lchown"),this.link=(0,oe.promisify)(this.fs,"link"),this.lstat=(0,oe.promisify)(this.fs,"lstat"),this.mkdir=(0,oe.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,oe.promisify)(this.fs,"mkdtemp"),this.readdir=(0,oe.promisify)(this.fs,"readdir"),this.readlink=(0,oe.promisify)(this.fs,"readlink"),this.realpath=(0,oe.promisify)(this.fs,"realpath"),this.rename=(0,oe.promisify)(this.fs,"rename"),this.rmdir=(0,oe.promisify)(this.fs,"rmdir"),this.rm=(0,oe.promisify)(this.fs,"rm"),this.stat=(0,oe.promisify)(this.fs,"stat"),this.symlink=(0,oe.promisify)(this.fs,"symlink"),this.truncate=(0,oe.promisify)(this.fs,"truncate"),this.unlink=(0,oe.promisify)(this.fs,"unlink"),this.utimes=(0,oe.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,oe.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,oe.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,oe.promisify)(this.fs,"open",o=>new this.FileHandle(this.fs,o))(i,n,s),this.writeFile=(i,n,s)=>((0,oe.isReadableStream)(n)?(0,oe.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,oe.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new u0(this.fs,i,s)}}};l(p0,"FsPromises");var h0=p0;sd.FsPromises=h0});var FP=T(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.newNotAllowedError=it.newTypeMismatchError=it.newNotFoundError=it.assertCanWrite=it.assertName=it.basename=it.ctx=void 0;var oH=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");it.ctx=oH;var aH=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");it.basename=aH;var cH=/^(\.{1,2})$|^(.*([\/\\]).*)$/,lH=l((t,e,r)=>{if(!t||cH.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");it.assertName=lH;var fH=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");it.assertCanWrite=fH;var uH=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");it.newNotFoundError=uH;var hH=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");it.newTypeMismatchError=hH;var dH=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");it.newNotAllowedError=dH});var TP=T(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.toTreeSync=void 0;var pH=vp(),mH=FP(),wH=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,o=" (...)";if(s>0){let c=t.readdirSync(i,{withFileTypes:!0});o=(0,pH.printTree)(n,c.map(a=>u=>a.isDirectory()?(0,Ic.toTreeSync)(t,{dir:i+a.name,depth:s-1,tab:u}):a.isSymbolicLink()?""+a.name+" \u2192 "+t.readlinkSync(i+a.name):""+a.name))}return(0,mH.basename)(i,r)+r+o},"toTreeSync");Ic.toTreeSync=wH});var OP=T(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.getWriteFileOptions=q.writeFileDefaults=q.getRealpathOptsAndCb=q.getRealpathOptions=q.getStatfsOptsAndCb=q.getStatfsOptions=q.getStatOptsAndCb=q.getStatOptions=q.getAppendFileOptsAndCb=q.getAppendFileOpts=q.getOpendirOptsAndCb=q.getOpendirOptions=q.getReaddirOptsAndCb=q.getReaddirOptions=q.getReadFileOptions=q.getRmOptsAndCb=q.getRmdirOptions=q.getDefaultOptsAndCb=q.getDefaultOpts=q.optsDefaults=q.getMkdirOptions=void 0;q.getOptions=RP;q.optsGenerator=Gr;q.optsAndCbGenerator=gn;var od=Bo(),yH=Ac(),m0=Ri(),kP={mode:511,recursive:!1},gH=l(t=>typeof t=="number"?Object.assign({},kP,{mode:t}):Object.assign({},kP,t),"getMkdirOptions");q.getMkdirOptions=gH;var bH=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function RP(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(bH(i))}}else return t;return r.encoding!=="buffer"&&(0,yH.assertEncoding)(r.encoding),r}l(RP,"getOptions");function Gr(t){return e=>RP(t,e)}l(Gr,"optsGenerator");function gn(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,m0.validateCallback)(r)]}l(gn,"optsAndCbGenerator");q.optsDefaults={encoding:"utf8"};q.getDefaultOpts=Gr(q.optsDefaults);q.getDefaultOptsAndCb=gn(q.getDefaultOpts);var _H={recursive:!1},SH=l(t=>Object.assign({},_H,t),"getRmdirOptions");q.getRmdirOptions=SH;var vH=Gr(q.optsDefaults);q.getRmOptsAndCb=gn(vH);var EH={flag:"r"};q.getReadFileOptions=Gr(EH);var FH={encoding:"utf8",recursive:!1,withFileTypes:!1};q.getReaddirOptions=Gr(FH);q.getReaddirOptsAndCb=gn(q.getReaddirOptions);var TH={encoding:"utf8",bufferSize:32,recursive:!1};q.getOpendirOptions=Gr(TH);q.getOpendirOptsAndCb=gn(q.getOpendirOptions);var kH={encoding:"utf8",mode:438,flag:od.FLAGS[od.FLAGS.a]};q.getAppendFileOpts=Gr(kH);q.getAppendFileOptsAndCb=gn(q.getAppendFileOpts);var RH={bigint:!1},OH=l((t={})=>Object.assign({},RH,t),"getStatOptions");q.getStatOptions=OH;var xH=l((t,e)=>typeof t=="function"?[(0,q.getStatOptions)(),t]:[(0,q.getStatOptions)(t),(0,m0.validateCallback)(e)],"getStatOptsAndCb");q.getStatOptsAndCb=xH;var AH={bigint:!1},PH=l((t={})=>Object.assign({},AH,t),"getStatfsOptions");q.getStatfsOptions=PH;var NH=l((t,e)=>typeof t=="function"?[(0,q.getStatfsOptions)(),t]:[(0,q.getStatfsOptions)(t),(0,m0.validateCallback)(e)],"getStatfsOptsAndCb");q.getStatfsOptsAndCb=NH;var DH=q.optsDefaults;q.getRealpathOptions=Gr(DH);q.getRealpathOptsAndCb=gn(q.getRealpathOptions);q.writeFileDefaults={encoding:"utf8",mode:438,flag:od.FLAGS[od.FLAGS.w]};q.getWriteFileOptions=Gr(q.writeFileDefaults)});var AP=T(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.Dir=void 0;var xP=Ri(),CH=Ch(),bn=xc(),y0=class y0{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),CH.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new bn.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,xP.validateCallback)(e),this.closed){process.nextTick(e,new bn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new bn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new bn.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,xP.validateCallback)(e),this.closed){process.nextTick(e,new bn.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new bn.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new bn.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l(y0,"Dir");var w0=y0;ad.Dir=w0});var DP=T(b0=>{"use strict";Object.defineProperty(b0,"__esModule",{value:!0});b0.globSync=jH;var _n=Co(),IH=kp(),PP=Ri(),$H=_n.posix.join,BH=_n.posix.relative,MH=_n.posix.resolve;function NP(t,e){return(0,IH.toRegex)(e).test(t)}l(NP,"matchesPattern");function LH(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>NP(t,i)):!1}l(LH,"isExcluded");function g0(t,e,r,i,n=0){let s=[],o=i.maxdepth??1/0,f=i.cwd?(0,PP.pathToFilename)(i.cwd):process.cwd();if(n>o)return s;try{let c=t.readdirSync(e,{withFileTypes:!0});for(let a of c){let u=$H(e,a.name.toString()),h=BH(f,u);if(LH(h,i.exclude))continue;if(r.some(p=>NP(h,p))&&s.push(h),a.isDirectory()&&n<o){let p=g0(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(g0,"walkDirectory");function jH(t,e,r={}){let i=r.cwd?(0,PP.pathToFilename)(r.cwd):process.cwd(),n=MH(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},o=[];if(_n.posix.isAbsolute(e)){let f=_n.posix.dirname(e),c=_n.posix.basename(e),a=g0(t,f,[c],{...s,cwd:f});o.push(...a.map(u=>_n.posix.resolve(f,u)))}else{let f=g0(t,n,[e],s);o.push(...f)}return o=[...new Set(o)].sort(),o}l(jH,"globSync")});var jP=T(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.FSWatcher=kt.StatWatcher=kt.Volume=void 0;kt.pathToSteps=i5;kt.dataToStr=n5;kt.toUnixTimestamp=Tt;var Ae=Co(),E0=yP(),_0=Bg(),qH=Ch(),UH=gP(),Wo=Fi(),hd=r0(),WH=bP(),dd=SP(),zH=ir(),BP=c0(),Sn=Ac(),HH=vP(),MP=Lg(),VH=EP(),GH=TP(),ld=Bo(),JH=xc(),te=OP(),N=Ri(),KH=AP(),Ve=Xh(),XH=Ae.resolve,{O_SYMLINK:CP,F_OK:S0,R_OK:YH,W_OK:ZH,X_OK:QH,COPYFILE_EXCL:e5,COPYFILE_FICLONE_FORCE:t5}=zH.constants,mZ=Ae.posix?Ae.posix.sep:Ae.sep,cd=Ae.posix?Ae.posix.relative:Ae.relative,v0=Ae.posix?Ae.posix.join:Ae.join,IP=Ae.posix?Ae.posix.dirname:Ae.dirname,$P=Ae.posix?Ae.posix.normalize:Ae.normalize,r5=128;function i5(t){return(0,Ve.filenameToSteps)((0,N.pathToFilename)(t))}l(i5,"pathToSteps");function n5(t,e=Sn.ENCODING_UTF8){return Wo.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Wo.bufferFrom)(t).toString(e):String(t)}l(n5,"dataToStr");function Tt(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(Tt,"toUnixTimestamp");function qo(t){if(typeof t!="number")throw TypeError(ld.ERRSTR.UID)}l(qo,"validateUid");function Uo(t){if(typeof t!="number")throw TypeError(ld.ERRSTR.GID)}l(Uo,"validateGid");var F0=class F0{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new E0.Superblock){this._core=e,this.promisesApi=new VH.FsPromises(this,HH.FileHandle),this.openSync=(c,a,u=438)=>{let h=(0,N.modeToNumber)(u),d=(0,N.pathToFilename)(c),p=(0,N.flagsToNumber)(a);return this._core.open(d,p,h,!(p&CP))},this.open=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,N.modeToNumber)(d),w=(0,N.pathToFilename)(c),y=(0,N.flagsToNumber)(a);this.wrapAsync(this._core.open,[w,y,m,!(y&CP)],p)},this.closeSync=c=>{this._core.close(c)},this.close=(c,a)=>{(0,Ve.validateFd)(c);let u=this._core.getFileByFdOrThrow(c,"close");this.wrapAsync(this._core.close,[u.fd],a)},this.readSync=(c,a,u,h,d)=>((0,Ve.validateFd)(c),this._core.read(c,a,u,h,d)),this.read=(c,a,u,h,d,p)=>{if((0,N.validateCallback)(p),h===0)return(0,hd.default)(()=>{p&&p(null,0,a)});Promise.resolve().then(()=>{try{let m=this._core.read(c,a,u,h,d);p(null,m,a)}catch(m){p(m)}})},this.readv=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.readvSync=(c,a,u)=>((0,Ve.validateFd)(c),this._core.readv(c,a,u??null)),this._readfile=(c,a,u)=>{let h,p=typeof c=="number"&&(0,Ve.isFd)(c),m;if(p)m=c;else{let w=(0,N.pathToFilename)(c),y=String(c),b=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,N.createError)("EISDIR","open",_.getPath());if(b&&F.isFile())throw(0,N.createError)("ENOTDIR","open",y);m=this.openSync(c,a)}try{h=(0,N.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(c,a)=>{let u=(0,te.getReadFileOptions)(a),h=(0,N.flagsToNumber)(u.flag);return this._readfile(c,h,u.encoding)},this.readFile=(c,a,u)=>{let[h,d]=(0,te.optsAndCbGenerator)(te.getReadFileOptions)(a,u),p=(0,N.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[c,p,h.encoding],d)},this.writeSync=(c,a,u,h,d)=>{let[,p,m,w,y]=(0,N.getWriteSyncArgs)(c,a,u,h,d);return this._write(c,p,m,w,y)},this.write=(c,a,u,h,d,p)=>{let[,m,w,y,b,_,F]=(0,N.getWriteArgs)(c,a,u,h,d,p);Promise.resolve().then(()=>{try{let E=this._write(c,w,y,b,_);m?F(null,E,a):F(null,E,w)}catch(E){F(E)}})},this.writev=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,N.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(c,a,d);p(null,m,a)}catch(m){p(m)}})},this.writevSync=(c,a,u)=>((0,Ve.validateFd)(c),this.writevBase(c,a,u??null)),this.writeFileSync=(c,a,u)=>{let h=(0,te.getWriteFileOptions)(u),d=(0,N.flagsToNumber)(h.flag),p=(0,N.modeToNumber)(h.mode),m=(0,Ve.dataToBuffer)(a,h.encoding);this._core.writeFile(c,m,d,p)},this.writeFile=(c,a,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[te.writeFileDefaults,u]);let m=(0,N.validateCallback)(p),w=(0,te.getWriteFileOptions)(d),y=(0,N.flagsToNumber)(w.flag),b=(0,N.modeToNumber)(w.mode),_=(0,Ve.dataToBuffer)(a,w.encoding);this.wrapAsync(this._core.writeFile,[c,_,y,b],m)},this.copyFileSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(c,a,u,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,N.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(c,a,u)=>{if(u.filter&&!u.filter(c,a))return;let h=u.dereference?this.statSync(c):this.lstatSync(c),d=null;try{d=this.lstatSync(a)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,N.createError)("EINVAL","cp",c,a);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,N.createError)("EISDIR","cp",c,a);if(!h.isDirectory()&&d.isDirectory())throw(0,N.createError)("ENOTDIR","cp",c,a)}if(h.isDirectory()&&this.isSrcSubdir(c,a))throw(0,N.createError)("EINVAL","cp",c,a);{let p=IP(a);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,N.createError)("EISDIR","cp",c);this.cpDirSync(h,d,c,a,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,c,a,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,c,a,u);else throw(0,N.createError)("EINVAL","cp",c)},this.linkSync=(c,a)=>{let u=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(a);this._core.link(u,h)},this.link=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=c=>{let a=(0,N.pathToFilename)(c);this._core.unlink(a)},this.unlink=(c,a)=>{let u=(0,N.pathToFilename)(c);this.wrapAsync(this._core.unlink,[u],a)},this.symlinkSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this._core.symlink(h,d)},this.symlink=(c,a,u,h)=>{let d=(0,N.validateCallback)(typeof u=="function"?u:h),p=(0,N.pathToFilename)(c),m=(0,N.pathToFilename)(a);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(c,a=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(c,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return _0.default.build(h.getNode(),a)},this.lstatSync=(c,a)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,te.getStatOptions)(a);return this._lstat((0,N.pathToFilename)(c),h,u)},this.renameSync=(c,a)=>{let u=(0,N.pathToFilename)(c),h=(0,N.pathToFilename)(a);this._core.rename(u,h)},this.rename=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=c=>{try{return this._exists((0,N.pathToFilename)(c))}catch{return!1}},this.exists=(c,a)=>{let u=(0,N.pathToFilename)(c);if(typeof a!="function")throw Error(ld.ERRSTR.CB);Promise.resolve().then(()=>{try{a(this._exists(u))}catch{a(!1)}})},this.accessSync=(c,a=S0)=>{let u=(0,N.pathToFilename)(c);a=a|0,this._access(u,a)},this.access=(c,a,u)=>{let h=S0,d;typeof a!="function"?[h,d]=[a|0,(0,N.validateCallback)(u)]:d=a;let p=(0,N.pathToFilename)(c);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(c,a,u)=>{let h=(0,te.getAppendFileOpts)(u);(!h.flag||(0,Ve.isFd)(c))&&(h.flag="a"),this.writeFileSync(c,a,h)},this.appendFile=(c,a,u,h)=>{let[d,p]=(0,te.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,Ve.isFd)(c))&&(d.flag="a"),this.writeFile(c,a,d,p)},this._readdir=(c,a)=>{let u=(0,Ve.filenameToSteps)(c),h=this._core.getResolvedLinkOrThrow(c,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);if(!d.canRead())throw(0,N.createError)("EACCES","scandir",c);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(qH.default.build(y,a.encoding)),a.recursive&&y.children.size)){let b={...a,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),b);p.push(..._)}}if(!Ve.isWin&&a.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),a.withFileTypes)return p;let m=c;return Ve.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(a.recursive){let y=v0(w.parentPath,w.name.toString());return Ve.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Ae.posix.sep,"")}return w.name})},this.readdirSync=(c,a)=>{let u=(0,te.getReaddirOptions)(a),h=(0,N.pathToFilename)(c);return this._readdir(h,u)},this.readdir=(c,a,u)=>{let[h,d]=(0,te.getReaddirOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(c,a)=>{let h=this._core.getLinkOrThrow(c,"readlink").getNode();if(!h.isSymlink())throw(0,N.createError)("EINVAL","readlink",c);return(0,Sn.strToEncoding)(h.symlink,a)},this.readlinkSync=(c,a)=>{let u=(0,te.getDefaultOpts)(a),h=(0,N.pathToFilename)(c);return this._readlink(h,u.encoding)},this.readlink=(c,a,u)=>{let[h,d]=(0,te.getDefaultOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=c=>{this._core.getFileByFdOrThrow(c,"fsync")},this.fsyncSync=c=>{this._fsync(c)},this.fsync=(c,a)=>{this.wrapAsync(this._fsync,[c],a)},this._fdatasync=c=>{this._core.getFileByFdOrThrow(c,"fdatasync")},this.fdatasyncSync=c=>{this._fdatasync(c)},this.fdatasync=(c,a)=>{this.wrapAsync(this._fdatasync,[c],a)},this._ftruncate=(c,a)=>{this._core.getFileByFdOrThrow(c,"ftruncate").truncate(a)},this.ftruncateSync=(c,a)=>{this._ftruncate(c,a)},this.ftruncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,N.validateCallback)(typeof a=="number"?u:a);this.wrapAsync(this._ftruncate,[c,h],d)},this._truncate=(c,a)=>{let u=this.openSync(c,"r+");try{this.ftruncateSync(u,a)}finally{this.closeSync(u)}},this.truncateSync=(c,a)=>{if((0,Ve.isFd)(c))return this.ftruncateSync(c,a);this._truncate(c,a)},this.truncate=(c,a,u)=>{let h=typeof a=="number"?a:0,d=(0,N.validateCallback)(typeof a=="number"?u:a);if((0,Ve.isFd)(c))return this.ftruncate(c,h,d);this.wrapAsync(this._truncate,[c,h],d)},this._futimes=(c,a,u)=>{let d=this._core.getFileByFdOrThrow(c,"futimes").node;d.atime=new Date(a*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(c,a,u)=>{this._futimes(c,Tt(a),Tt(u))},this.futimes=(c,a,u,h)=>{this.wrapAsync(this._futimes,[c,Tt(a),Tt(u)],h)},this._utimes=(c,a,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(c,"utimes"):d.getLinkOrThrow(c,"lutimes")).getNode();m.atime=new Date(a*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(c,a,u)=>{this._utimes((0,N.pathToFilename)(c),Tt(a),Tt(u),!0)},this.utimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),Tt(a),Tt(u),!0],h)},this.lutimesSync=(c,a,u)=>{this._utimes((0,N.pathToFilename)(c),Tt(a),Tt(u),!1)},this.lutimes=(c,a,u,h)=>{this.wrapAsync(this._utimes,[(0,N.pathToFilename)(c),Tt(a),Tt(u),!1],h)},this.mkdirSync=(c,a)=>{let u=(0,te.getMkdirOptions)(a),h=(0,N.modeToNumber)(u.mode,511),d=(0,N.pathToFilename)(c);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(c,a,u)=>{let h=(0,te.getMkdirOptions)(a),d=(0,N.validateCallback)(typeof a=="function"?a:u),p=(0,N.modeToNumber)(h.mode,511),m=(0,N.pathToFilename)(c);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(c,a,u=5)=>{let h=c+(0,N.genRndStr6)();try{return this._core.mkdir(h,511),(0,Sn.strToEncoding)(h,a)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(c,a,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(c,a)=>{let{encoding:u}=(0,te.getDefaultOpts)(a);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");return(0,N.nullCheck)(c),this._mkdtemp(c,u)},this.mkdtemp=(c,a,u)=>{let[{encoding:h},d]=(0,te.getDefaultOptsAndCb)(a,u);if(!c||typeof c!="string")throw new TypeError("filename prefix is required");(0,N.nullCheck)(c)&&this.wrapAsync(this._mkdtemp,[c,h],d)},this.rmdirSync=(c,a)=>{let u=(0,te.getRmdirOptions)(a);this._core.rmdir((0,N.pathToFilename)(c),u.recursive)},this.rmdir=(c,a,u)=>{let h=(0,te.getRmdirOptions)(a),d=(0,N.validateCallback)(typeof a=="function"?a:u);this.wrapAsync(this._core.rmdir,[(0,N.pathToFilename)(c),h.recursive],d)},this.rmSync=(c,a)=>{this._core.rm((0,N.pathToFilename)(c),a?.force,a?.recursive)},this.rm=(c,a,u)=>{let[h,d]=(0,te.getRmOptsAndCb)(a,u);this.wrapAsync(this._core.rm,[(0,N.pathToFilename)(c),h?.force,h?.recursive],d)},this._fchmod=(c,a)=>{this._core.getFileByFdOrThrow(c,"fchmod").chmod(a)},this.fchmodSync=(c,a)=>{this._fchmod(c,(0,N.modeToNumber)(a))},this.fchmod=(c,a,u)=>{this.wrapAsync(this._fchmod,[c,(0,N.modeToNumber)(a)],u)},this._chmod=(c,a,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(c,"chmod"):this._core.getLinkOrThrow(c,"chmod")).getNode().chmod(a)},this.chmodSync=(c,a)=>{let u=(0,N.modeToNumber)(a),h=(0,N.pathToFilename)(c);this._chmod(h,u,!0)},this.chmod=(c,a,u)=>{let h=(0,N.modeToNumber)(a),d=(0,N.pathToFilename)(c);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(c,a)=>{this._chmod(c,a,!1)},this.lchmodSync=(c,a)=>{let u=(0,N.modeToNumber)(a),h=(0,N.pathToFilename)(c);this._lchmod(h,u)},this.lchmod=(c,a,u)=>{let h=(0,N.modeToNumber)(a),d=(0,N.pathToFilename)(c);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(c,a,u)=>{this._core.getFileByFdOrThrow(c,"fchown").chown(a,u)},this.fchownSync=(c,a,u)=>{qo(a),Uo(u),this._fchown(c,a,u)},this.fchown=(c,a,u,h)=>{qo(a),Uo(u),this.wrapAsync(this._fchown,[c,a,u],h)},this._chown=(c,a,u)=>{this._core.getResolvedLinkOrThrow(c,"chown").getNode().chown(a,u)},this.chownSync=(c,a,u)=>{qo(a),Uo(u),this._chown((0,N.pathToFilename)(c),a,u)},this.chown=(c,a,u,h)=>{qo(a),Uo(u),this.wrapAsync(this._chown,[(0,N.pathToFilename)(c),a,u],h)},this._lchown=(c,a,u)=>{this._core.getLinkOrThrow(c,"lchown").getNode().chown(a,u)},this.lchownSync=(c,a,u)=>{qo(a),Uo(u),this._lchown((0,N.pathToFilename)(c),a,u)},this.lchown=(c,a,u,h)=>{qo(a),Uo(u),this.wrapAsync(this._lchown,[(0,N.pathToFilename)(c),a,u],h)},this.statWatchers={},this.cpSync=(c,a,u)=>{let h=(0,N.pathToFilename)(c),d=(0,N.pathToFilename)(a),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(c,a,u,h)=>{let d=(0,N.pathToFilename)(c),p=(0,N.pathToFilename)(a),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,N.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(c,a)=>{let u=(0,N.pathToFilename)(c),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new JH.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=a?.type||"";return new Blob([p],{type:m})},this.glob=(c,...a)=>{let[u,h]=a.length===1?[{},a[0]]:[a[0],a[1]];this.wrapAsync(this._globSync,[c,u||{}],h)},this.globSync=(c,a={})=>this._globSync(c,a),this._globSync=(c,a={})=>{let{globSync:u}=DP();return u(this,c,a)},this._opendir=(c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"scandir");if(!u.getNode().isDirectory())throw(0,N.createError)("ENOTDIR","scandir",c);return new KH.Dir(u,a)},this.opendirSync=(c,a)=>{let u=(0,te.getOpendirOptions)(a),h=(0,N.pathToFilename)(c);return this._opendir(h,u)},this.opendir=(c,a,u)=>{let[h,d]=(0,te.getOpendirOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends fd{constructor(){super(r)}};let i=kr;this.ReadStream=class extends i{constructor(...c){super(r,...c)}};let n=Wt;this.WriteStream=class extends n{constructor(...c){super(r,...c)}},this.FSWatcher=class extends ud{constructor(){super(r)}};let s=l((c,a)=>{let u=this._core.getResolvedLinkOrThrow(c,"realpath");return(0,Sn.strToEncoding)(u.getPath()||"/",a)},"_realpath"),o=l((c,a,u)=>{let[h,d]=(0,te.getRealpathOptsAndCb)(a,u),p=(0,N.pathToFilename)(c);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((c,a)=>s((0,N.pathToFilename)(c),(0,te.getRealpathOptions)(a).encoding),"realpathSyncImpl");this.realpath=o,this.realpath.native=o,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,N.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Ae.sep}){return(0,GH.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let o=this._core.getFileByFdOrThrow(e,"write");if(o.node.isSymlink())throw(0,N.createError)("EBADF","write",o.link.getPath());return o.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let o=0;for(let f of r){let c=Wo.Buffer.from(f.buffer,f.byteOffset,f.byteLength),a=n.write(c,0,c.byteLength,s);if(s=void 0,o+=a,a<c.byteLength)break}return o}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&e5&&this.existsSync(r))throw(0,N.createError)("EEXIST","copyFile",e,r);if(i&t5)throw(0,N.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,ld.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=$P(e.startsWith("/")?e:"/"+e),n=$P(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=cd(i,n);return s===""||!s.startsWith("..")&&!(0,Ae.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,N.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let o=this.readdirSync(i);for(let f of o){let c=v0(i,String(f)),a=v0(n,String(f));s.filter&&!s.filter(c,a)||this._cp(c,a,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Ae.isAbsolute)(s)&&(s=XH(IP(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},o]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,N.pathToFilename)(e),s,n],o)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return _0.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,te.getStatOptions)(r);return this._stat((0,N.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},o]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,N.pathToFilename)(e),n,s],o)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,N.createError)("EBADF","fstat");return _0.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,te.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,te.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==S0&&(r&YH&&!n.canRead()||r&ZH&&!n.canWrite()||r&QH&&!n.canExecute()))throw(0,N.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,N.pathToFilename)(e),s=r,o=i;if(typeof s=="function"&&(o=r,s=null),typeof o!="function")throw Error('"watchFile()" requires a listener function');let f=5007,c=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(c=s.persistent));let a=this.statWatchers[n];return a||(a=new this.StatWatcher,a.start(n,c,f),this.statWatchers[n]=a),a.addListener("change",o),a}unwatchFile(e,r){let i=(0,N.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,N.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:o,recursive:f,encoding:c}=(0,te.getDefaultOpts)(s);o===void 0&&(o=!0),f===void 0&&(f=!1);let a=new this.FSWatcher;return a.start(n,o,f,c),i&&a.addListener("change",i),a}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),UH.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,te.getStatfsOptions)(r);return this._statfs((0,N.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,te.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,N.pathToFilename)(e),n],s)}};l(F0,"Volume");var vn=F0;kt.Volume=vn;vn.fromJSON=(t,e)=>new vn(E0.Superblock.fromJSON(t,e));vn.fromNestedJSON=(t,e)=>new vn(E0.Superblock.fromNestedJSON(t,e));function s5(t){t.emit("stop")}l(s5,"emitStop");var T0=class T0 extends BP.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,N.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):WH.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,hd.default)(()=>{s5.call(this,this)})}};l(T0,"StatWatcher");var fd=T0;kt.StatWatcher=fd;var Ut;function o5(t){Ut=(0,Wo.bufferAllocUnsafe)(t),Ut.used=0}l(o5,"allocNewPool");(0,MP.inherits)(kr,dd.Readable);kt.ReadStream=kr;function kr(t,e,r){if(!(this instanceof kr))return new kr(t,e,r);if(this._vol=t,r=Object.assign({},(0,te.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),dd.Readable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(kr,"FsReadStream");kr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};kr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Ut||Ut.length-Ut.used<r5)&&o5(this._readableState.highWaterMark);var e=Ut,r=Math.min(Ut.length-Ut.used,t),i=Ut.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,Ut,Ut.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Ut.used+=r;function s(o,f){if(o)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",o);else{var c=null;f>0&&(n.bytesRead+=f,c=e.slice(i,i+f)),n.push(c)}}l(s,"onread")};kr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};kr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",LP);return}return(0,hd.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function LP(t){this.close()}l(LP,"closeOnOpen");(0,MP.inherits)(Wt,dd.Writable);kt.WriteStream=Wt;function Wt(t,e,r){if(!(this instanceof Wt))return new Wt(t,e,r);if(this._vol=t,r=Object.assign({},(0,te.getOptions)(r,{})),dd.Writable.call(this,r),this.path=(0,N.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Wt,"FsWriteStream");Wt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Wt.prototype._write=function(t,e,r){if(!(t instanceof Wo.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Wt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,o=0;o<i;o++){var f=t[o].chunk;n[o]=f,s+=f.length}let c=Wo.Buffer.concat(n);this._vol.write(this.fd,c,0,c.length,this.pos,(a,u)=>{if(a)return r.destroy&&r.destroy(),e(a);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Wt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",LP);return}return(0,hd.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Wt.prototype._destroy=kr.prototype._destroy;Wt.prototype.destroySoon=Wt.prototype.end;var k0=class k0 extends BP.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Sn.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=Sn.ENCODING_UTF8){this._filename=(0,N.pathToFilename)(e),this._steps=(0,Ve.filenameToSteps)(this._filename),this._filenameEncoded=(0,Sn.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(c){let a=new Error(`watch ${this._filename} ${c.code}`);throw a.code=c.code,a.errno=c.code,a}let s=l(c=>{let a=c.getPath(),u=c.getNode(),h=l(()=>{let m=cd(this._filename,a);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),o=l(c=>{let a=c.getNode(),u=l(m=>{this.emit("change","rename",cd(this._filename,m.getPath())),s(m),o(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let b=y.getNode().ino,_=this._listenerRemovers.get(b);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(b));for(let[F,E]of y.children.entries())E&&F!=="."&&F!==".."&&w(E)},"removeLinkNodeListeners");w(m),this.emit("change","rename",cd(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=c.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(a.ino)??[]).push(()=>{d()}),i)for(let[m,w]of c.children.entries())w&&m!=="."&&m!==".."&&o(w)},"watchLinkChildrenChanged");s(this._link),o(this._link);let f=this._link.parent;f&&f.changes.listen(([c,a])=>{c==="child:del"&&this._onParentChild(a)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(k0,"FSWatcher");var ud=k0;kt.FSWatcher=ud});var qP=T(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});pd.fsSynchronousApiList=void 0;pd.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var UP=T(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.fsCallbackApiList=void 0;md.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var zP=T((Rt,wd)=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.memfs=Rt.fs=Rt.vol=Rt.Volume=void 0;Rt.createFsFromVolume=R0;var a5=Bg(),c5=Ch(),yd=jP();Object.defineProperty(Rt,"Volume",{enumerable:!0,get:l(function(){return yd.Volume},"get")});var WP=ir(),l5=qP(),f5=UP(),{F_OK:u5,R_OK:h5,W_OK:d5,X_OK:p5}=WP.constants;Rt.vol=new yd.Volume;function R0(t){let e={F_OK:u5,R_OK:h5,W_OK:d5,X_OK:p5,constants:WP.constants,Stats:a5.default,Dirent:c5.default};for(let r of l5.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of f5.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=yd.toUnixTimestamp,e.__vol=t,e}l(R0,"createFsFromVolume");Rt.fs=R0(Rt.vol);var m5=l((t={},e="/")=>{let r=yd.Volume.fromNestedJSON(t,e);return{fs:R0(r),vol:r}},"memfs");Rt.memfs=m5;wd.exports={...wd.exports,...Rt.fs};wd.exports.semantic=!0});var L0=l(t=>{try{let r=t.split(".")[1];if(!r)throw new Error("Invalid JWT format");let i=r.replace(/-/g,"+").replace(/_/g,"/");for(;i.length%4!==0;)i+="=";let n=atob(i),o=JSON.parse(n).exp;if(!o||typeof o!="number")throw new Error('JWT does not contain a valid "exp" field');return o*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),Yo,Fn,xd=(Fn=class{constructor(e){U(this,"strategy","jwt");U(this,"cachedToken",null);U(this,"tokenExpiry",null);Ko(this,Yo);Xo(this,Yo,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let r=await Jo(this,Yo).call(this);return r?(this.cachedToken=r,this.tokenExpiry=L0(r),{Authorization:`Bearer ${r}`}):!1}readAuthHeaders(e){let r=e.get("Authorization");if(!r)return;let[i,n]=r.split(" ");if(i!=="Bearer"||!n)throw new Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=L0(n)}},Yo=new WeakMap,l(Fn,"AssistantCloudJWTAuthStrategy"),Fn),Zo,Qo,ea,Tn,j0=(Tn=class{constructor(e,r,i){U(this,"strategy","api-key");Ko(this,Zo);Ko(this,Qo);Ko(this,ea);Xo(this,Zo,e),Xo(this,Qo,r),Xo(this,ea,i)}async getAuthHeaders(){return{Authorization:`Bearer ${Jo(this,Zo)}`,"Aui-User-Id":Jo(this,Qo),"Aui-Workspace-Id":Jo(this,ea)}}readAuthHeaders(){}},Zo=new WeakMap,Qo=new WeakMap,ea=new WeakMap,l(Tn,"AssistantCloudAPIKeyAuthStrategy"),Tn),Lc="aui:refresh_token",kn,q0=(kn=class{constructor(e){U(this,"strategy","anon");U(this,"baseUrl");U(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new xd(async()=>{let r=Date.now(),i=localStorage.getItem(Lc),n=i?JSON.parse(i):void 0;if(n)if(new Date(n.expires_at).getTime()-r>30*1e3){let u=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(u.ok){let h=await u.json(),{access_token:d,refresh_token:p}=h;return p&&localStorage.setItem(Lc,JSON.stringify(p)),d}}else localStorage.removeItem(Lc);let s=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!s.ok)return null;let o=await s.json(),{access_token:f,refresh_token:c}=o;return!f||!c?null:(localStorage.setItem(Lc,JSON.stringify(c)),f)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},l(kn,"AssistantCloudAnonymousAuthStrategy"),kn);var Rn,lN=(Rn=class extends Error{constructor(e){super(e),this.name="APIError"}},l(Rn,"CloudAPIError"),Rn),On,U0=(On=class{constructor(e){U(this,"_auth");U(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new xd(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new j0(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new q0(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,r={}){let i=await this._auth.getAuthHeaders();if(!i)throw new Error("Authorization failed");let n={...i,...r.headers,"Content-Type":"application/json"},s=new URLSearchParams;if(r.query)for(let[c,a]of Object.entries(r.query))a!==!1&&(a===!0?s.set(c,"true"):s.set(c,a.toString()));let o=new URL(`${this._baseUrl}/v1${e}`);o.search=s.toString();let f=await fetch(o,{method:r.method??"GET",headers:n,body:r.body?JSON.stringify(r.body):null});if(this._auth.readAuthHeaders(f.headers),!f.ok){let c=await f.text();try{let a=JSON.parse(c);throw new lN(a.message)}catch{throw new Error(`Request failed with status ${f.status}, ${c}`)}}return f}async makeRequest(e,r={}){return(await this.makeRawRequest(e,r)).json()}},l(On,"AssistantCloudAPI"),On);var xn,W0=(xn=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},l(xn,"AssistantCloudAuthTokens"),xn);var ta={toResponse(t,e){return new Response(ta.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return ta.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var jc=l(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var z0=l(()=>{let t=[],e=!1,r,i,n=l(o=>{o.promise||(o.promise=o.reader.read().then(({done:f,value:c})=>{o.promise=void 0,f?(t.splice(t.indexOf(o),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(o){r=o},pull(){return i=jc(),t.forEach(o=>{n(o)}),i.promise},cancel(){t.forEach(o=>{o.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(o){if(e)throw new Error("Cannot add streams after the run callback has settled.");let f={reader:o.getReader()};t.push(f),n(f)},enqueue(o){this.addStream(new ReadableStream({start(f){f.enqueue(o),f.close()}}))}}},"createMergeStream");var An,H0=(An=class{constructor(e){U(this,"_controller");U(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(An,"TextStreamControllerImpl"),An),Ad=l(t=>new ReadableStream({start(e){return t.start?.(new H0(e))},pull(e){return t.pull?.(new H0(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Pd=l(()=>{let t;return[Ad({start(r){t=r}}),t]},"createTextStreamController");var Pn,V0=(Pn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=Ad({start:l(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:l(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(Pn,"ToolCallStreamControllerImpl"),Pn),fN=l(t=>new ReadableStream({start(e){return t.start?.(new V0(e))},pull(e){return t.pull?.(new V0(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),G0=l(()=>{let t;return[fN({start(r){t=r}}),t]},"createToolCallStreamController");var Nn,qc=(Nn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Nn,"Counter"),Nn);var Dn,J0=(Dn=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Dn,"PathAppendEncoder"),Dn),Cn,tV=(Cn=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},l(Cn,"PathAppendDecoder"),Cn),In,K0=(In=class extends TransformStream{constructor(e){let r=new qc,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[o,...f]=n.path;if(o===void 0){s.enqueue(n);return}let c=i.get(o);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...f]})}})}},l(In,"PathMergeEncoder"),In);var $n,X0=($n=class extends TransformStream{constructor(e,r,i){let[n,s]=Y0(),o;super({start(f){return o=n.pipeTo(new WritableStream({write(c){f.enqueue(c)},abort(c){f.error(c)},close(){f.terminate()}})).catch(c=>{f.error(c)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await o}},r,i)}},l($n,"AssistantTransformStream"),$n);var Bn,Z0=(Bn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(Bn,"PipeableTransformStream"),Bn);var Uc=l((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var Q0=Uc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Pi,uN=(Pi=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:z0(),contentCounter:new qc}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new J0(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new K0(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=Pd();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Pd();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??Q0(),[s,o]=G0();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(o.argsText.append(r.argsText),o.argsText.close()),r.args!==void 0&&(o.argsText.append(JSON.stringify(r.args)),o.argsText.close()),r.response!==void 0&&o.setResponse(r.response),o}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new Pi(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Pi,"_AssistantStreamControllerImpl"),Pi);function hN(t){let e=new uN;return l(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}l(hN,"createAssistantStream");function Y0(){let{resolve:t,promise:e}=jc(),r;return[hN(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(Y0,"createAssistantStreamController");var Mn,Nd=(Mn=class extends Z0{constructor(){super(e=>{let r=new X0({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(Mn,"PlainTextDecoder"),Mn);var Ln,eb=(Ln=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:l(async()=>{let r=await this.cloud._auth.getAuthHeaders();if(!r)throw new Error("Authorization failed");return{...r,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let r=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return ta.fromResponse(r,new Nd)}},l(Ln,"AssistantCloudRuns"),Ln);var jn,tb=(jn=class{constructor(e){this.cloud=e}async list(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:r})}async create(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:r})}},l(jn,"AssistantCloudThreadMessages"),jn);var qn,rb=(qn=class{constructor(e){U(this,"messages");this.cloud=e,this.messages=new tb(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:r})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},l(qn,"AssistantCloudThreads"),qn);var Un,ib=(Un=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},l(Un,"AssistantCloudFiles"),Un);var Wn,Dd=(Wn=class{constructor(e){U(this,"threads");U(this,"auth");U(this,"runs");U(this,"files");let r=new U0(e);this.threads=new rb(r),this.auth={tokens:new W0(r)},this.runs=new eb(r),this.files=new ib(r)}},l(Wn,"AssistantCloud"),Wn);var Ni={toResponse(t,e){return new Response(Ni.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return Ni.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var Wc=l(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var nb=l(()=>{let t=[],e=!1,r,i,n=l(o=>{o.promise||(o.promise=o.reader.read().then(({done:f,value:c})=>{o.promise=void 0,f?(t.splice(t.indexOf(o),1),e&&t.length===0&&r.close()):r.enqueue(c),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(c=>{c.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(o){r=o},pull(){return i=Wc(),t.forEach(o=>{n(o)}),i.promise},cancel(){t.forEach(o=>{o.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(o){if(e)throw new Error("Cannot add streams after the run callback has settled.");let f={reader:o.getReader()};t.push(f),n(f)},enqueue(o){this.addStream(new ReadableStream({start(f){f.enqueue(o),f.close()}}))}}},"createMergeStream");var zn,sb=(zn=class{constructor(e){U(this,"_controller");U(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(zn,"TextStreamControllerImpl"),zn),Cd=l(t=>new ReadableStream({start(e){return t.start?.(new sb(e))},pull(e){return t.pull?.(new sb(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),Id=l(()=>{let t;return[Cd({start(r){t=r}}),t]},"createTextStreamController");var Hn,ob=(Hn=class{constructor(e){U(this,"_isClosed",!1);U(this,"_mergeTask");U(this,"_argsTextController");this._controller=e;let r=Cd({start:l(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:l(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(Hn,"ToolCallStreamControllerImpl"),Hn),dN=l(t=>new ReadableStream({start(e){return t.start?.(new ob(e))},pull(e){return t.pull?.(new ob(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),ab=l(()=>{let t;return[dN({start(r){t=r}}),t]},"createToolCallStreamController");var Vn,zc=(Vn=class{constructor(){U(this,"value",-1)}up(){return++this.value}},l(Vn,"Counter"),Vn);var Gn,cb=(Gn=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(Gn,"PathAppendEncoder"),Gn),Jn,f7=(Jn=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},l(Jn,"PathAppendDecoder"),Jn),Kn,lb=(Kn=class extends TransformStream{constructor(e){let r=new zc,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[o,...f]=n.path;if(o===void 0){s.enqueue(n);return}let c=i.get(o);if(c===void 0)throw new Error("Path not found");s.enqueue({...n,path:[c,...f]})}})}},l(Kn,"PathMergeEncoder"),Kn);var Xn,fb=(Xn=class extends TransformStream{constructor(e,r,i){let[n,s]=ra(),o;super({start(f){return o=n.pipeTo(new WritableStream({write(c){f.enqueue(c)},abort(c){f.error(c)},close(){f.terminate()}})).catch(c=>{f.error(c)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await o}},r,i)}},l(Xn,"AssistantTransformStream"),Xn);var Yn,Hc=(Yn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(Yn,"PipeableTransformStream"),Yn);var fe=(t=>(t.TextDelta="0",t.Data="2",t.Error="3",t.Annotation="8",t.ToolCall="9",t.ToolCallResult="a",t.StartToolCall="b",t.ToolCallArgsTextDelta="c",t.FinishMessage="d",t.FinishStep="e",t.StartStep="f",t.ReasoningDelta="g",t.Source="h",t.RedactedReasoning="i",t.ReasoningSignature="j",t.File="k",t.AuiUpdateStateOperations="aui-state",t.AuiTextDelta="aui-text-delta",t.AuiReasoningDelta="aui-reasoning-delta",t))(fe||{});var Zn,ub=(Zn=class extends TransformStream{constructor(){super({transform:l((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
105
- `)},"transform")})}},l(Zn,"DataStreamChunkEncoder"),Zn),Qn,pN=(Qn=class extends TransformStream{constructor(){super({transform:l((e,r)=>{let i=e.indexOf(":");if(i===-1)throw new Error("Invalid stream part");r.enqueue({type:e.slice(0,i),value:JSON.parse(e.slice(i+1))})},"transform")})}},l(Qn,"DataStreamChunkDecoder"),Qn);var es,hb=(es=class extends TransformStream{constructor(){let e=[];super({transform(r,i){if(r.type==="part-start"){if(r.path.length!==0){i.error(new Error("Nested parts are not supported"));return}e.push(r.part),i.enqueue(r);return}if(r.type==="text-delta"||r.type==="result"||r.type==="part-finish"||r.type==="tool-call-args-text-finish"){if(r.path.length!==1){i.error(new Error(`${r.type} chunks must have a path of length 1`));return}let n=r.path[0];if(n<0||n>=e.length){i.error(new Error(`Invalid path index: ${n}`));return}let s=e[n];i.enqueue({...r,meta:s});return}i.enqueue(r)}})}},l(es,"AssistantMetaTransformStream"),es);var ts,$d=(ts=class extends Hc{constructor(){super(r=>{let i=new TransformStream({transform(n,s){let o=n.type;switch(o){case"part-start":{let f=n.part;if(f.type==="tool-call"){let{type:c,...a}=f;s.enqueue({type:fe.StartToolCall,value:a})}if(f.type==="source"){let{type:c,...a}=f;s.enqueue({type:fe.Source,value:a})}break}case"text-delta":{let f=n.meta;switch(f.type){case"text":{f.parentId?s.enqueue({type:fe.AuiTextDelta,value:{textDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:fe.TextDelta,value:n.textDelta});break}case"reasoning":{f.parentId?s.enqueue({type:fe.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:fe.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:fe.ToolCallArgsTextDelta,value:{toolCallId:f.toolCallId,argsTextDelta:n.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${f.type}`)}break}case"result":{let f=n.meta;if(f.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${f.type}`);s.enqueue({type:fe.ToolCallResult,value:{toolCallId:f.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:f,...c}=n;s.enqueue({type:fe.StartStep,value:c});break}case"step-finish":{let{type:f,...c}=n;s.enqueue({type:fe.FinishStep,value:c});break}case"message-finish":{let{type:f,...c}=n;s.enqueue({type:fe.FinishMessage,value:c});break}case"error":{s.enqueue({type:fe.Error,value:n.error});break}case"annotations":{s.enqueue({type:fe.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:fe.Data,value:n.data});break}case"update-state":{s.enqueue({type:fe.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let f=o;throw new Error(`Unsupported chunk type: ${f}`)}}}});return r.pipeThrough(new hb).pipeThrough(i).pipeThrough(new ub).pipeThrough(new TextEncoderStream)});U(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},l(ts,"DataStreamEncoder"),ts),R7=[fe.StartToolCall,fe.ToolCall,fe.TextDelta,fe.ReasoningDelta,fe.Source,fe.Error,fe.FinishStep,fe.FinishMessage,fe.AuiTextDelta,fe.AuiReasoningDelta];var db=Uc("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var Di,mN=(Di=class{constructor(e){U(this,"_state");U(this,"_parentId");this._state=e||{merger:nb(),contentCounter:new zc}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new cb(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new lb(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=Id();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=Id();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??db(),[s,o]=ab();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(o.argsText.append(r.argsText),o.argsText.close()),r.args!==void 0&&(o.argsText.append(JSON.stringify(r.args)),o.argsText.close()),r.response!==void 0&&o.setResponse(r.response),o}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new Di(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(Di,"_AssistantStreamControllerImpl"),Di);function pb(t){let e=new mN;return l(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}l(pb,"createAssistantStream");function ra(){let{resolve:t,promise:e}=Wc(),r;return[pb(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(ra,"createAssistantStreamController");var rs,Bd=(rs=class extends Hc{constructor(){super(e=>{let r=new fb({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(rs,"PlainTextDecoder"),rs);var Sh=ce(ws(),1),kA=ce(Vp(),1),vh=ce(ws(),1),OA=ce(Vp(),1),Eh=ce(ws(),1),kg=ce(Fe(),1),Fh=ce(ws(),1),Fr=ce(Fe(),1),dn=ce(Fe(),1),IA=ce(Fe(),1),ph=ce(Fe(),1),ct=ce(Fe(),1);import*as Tg from"path";import*as vA from"path";import*as uh from"path";import*as AA from"path";import*as Rg from"path";var lA=ce(iR(),1);function U4(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(U4,"fromValue");function W4(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:U4(t)}l(W4,"getIterator");async function fA(t,e){let r=W4(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(fA,"forAwait");function z4(t){let{PassThrough:e}=cA(),r=new e;return setTimeout(async()=>{await fA(t,i=>r.write(i)),r.end()},1),r}l(z4,"asyncIteratorToStream");async function H4(t){let e=0,r=[];await fA(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(H4,"collect");function V4(t){let e=Object.getOwnPropertyDescriptor(t,Symbol.asyncIterator);if(e&&e.enumerable)return t;let r=!1,i=[],n={};return t.on("data",s=>{i.push(s),n.resolve&&(n.resolve({value:i.shift(),done:!1}),n={})}),t.on("error",s=>{n.reject&&(n.reject(s),n={})}),t.on("end",()=>{r=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next(){return new Promise((s,o)=>{if(i.length===0&&r)return s({done:!0});if(i.length>0)return s({value:i.shift(),done:!1});i.length===0&&!r&&(n={resolve:s,reject:o})})},return(){t.removeAllListeners(),t.destroy&&t.destroy()},[Symbol.asyncIterator](){return this}}}l(V4,"fromNodeStream");async function G4({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await H4(s)):s&&(s=z4(s)),new Promise((o,f)=>{(0,lA.default)({url:e,method:r,headers:i,agent:n,body:s},(c,a)=>{if(c)return f(c);try{let u=V4(a);o({url:a.url,method:a.method,statusCode:a.statusCode,statusMessage:a.statusMessage,body:u,headers:a.headers})}catch(u){f(u)}})})}l(G4,"request");var J4={request:G4},lh=J4;var et=ce(Fe(),1),Th=ce(ws(),1),Pg=ce(Fe(),1),ae=ce(Fe(),1),Cg=ce(Fe(),1),_o=ce(Fe(),1),hh=ce(Fe(),1),dh=ce(Fe(),1),rr=ce(Fe(),1),Fc=ce(Fe(),1),Ig=ce(Fe(),1),vr=ce(Fe(),1),UA=ce(Fe(),1),wh=ce(Fe(),1),pn=ce(Fe(),1);var gA=Object.defineProperty,K4=l((t,e,r)=>e in t?gA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"Ft"),g=l((t,e)=>gA(t,"name",{value:e,configurable:!0}),"o"),W=l((t,e,r)=>K4(t,typeof e!="symbol"?e+"":e,r),"p"),vo,bA=(vo=class{constructor(e,r){W(this,"entries",[]),W(this,"currentIndex",0),W(this,"closed",!1),W(this,"compositFs"),W(this,"dirPath"),W(this,"initialized",!1),this.compositFs=e,this.dirPath=r}async initialize(){if(this.initialized)return;let e=new Set;for(let r of[...this.compositFs.subFilesystems].reverse()){let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}for(let r of Array.from(e)){let i=this.dirPath+"/"+r;await this.compositFs.hiddenFilesFileSystem?.responsible(i)||this.entries.push({name:r,path:i})}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);yield{name:e.name,isFile:g(()=>r.isFile(),"isFile"),isDirectory:g(()=>r.isDirectory(),"isDirectory"),isBlockDevice:g(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:g(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:g(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:g(()=>r.isFIFO(),"isFIFO"),isSocket:g(()=>r.isSocket(),"isSocket")}}catch(r){console.debug(`Failed to stat ${e.path}:`,r)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);return{name:e.name,isFile:g(()=>r.isFile(),"isFile"),isDirectory:g(()=>r.isDirectory(),"isDirectory"),isBlockDevice:g(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:g(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:g(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:g(()=>r.isFIFO(),"isFIFO"),isSocket:g(()=>r.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},l(vo,"he"),vo);g(bA,"CompositeFsDir");var _A=bA,Eo,SA=(Eo=class{constructor(e){W(this,"delegate"),W(this,"compositeFs"),W(this,"_subFsFileDescriptor"),W(this,"handleType","file"),W(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let r=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:r}),await this.delegate.appendFile(this,e,r)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:r}),this.delegate.fchown(this,e,r)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:r,length:i,position:n}),await this.delegate.read(this,e,r,i,n)}async readv(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:r}),this.delegate.readv(this,e,r)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:r}),this.delegate.futimes(this,e,r)}async write(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:r,length:i,position:n}),this.delegate.write(this,e,r,i,n)}async writev(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:r}),this.delegate.writev(this,e,r)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},l(Eo,"pe"),Eo);g(SA,"CompositFsFileHandle");var _h=SA,Fo,EA=(Fo=class{constructor({name:e,parentFs:r,gitRoot:i}){W(this,"compositFs"),W(this,"gitRoot"),W(this,"name"),this.name=e,this.compositFs=r,this.gitRoot=i}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,r,i){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${this.toStr(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,r,i,n,s){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,r,i){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,r){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,r,i){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,r){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,r,i,n,s){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,r,i){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,r,i){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,r){throw new Error(`readFile not implemented for: ${this.toStr(e)}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},l(Fo,"ue"),Fo);g(EA,"BaseCompositeSubFs");var Rc=EA,To,FA=(To=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,passThroughFs:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,Sh.createFsFromVolume)(new Sh.Volume)),W(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.targetFs=n}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=vA.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new _h({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,...r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,...r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){let i=await this.targetFs.promises.opendir(e,r);return new _A(this.compositFs,e.toString())}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){await this.targetFs.promises.mkdir(e,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(this.openFh.delete(e.subFsFileDescriptor),await r.close())}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return this.targetFs.promises.readFile(e,r)}async writeFile(e,r,i){return this.targetFs.promises.writeFile(e,r,i)}},l(To,"Fe"),To);g(FA,"PassThroughToAsyncFsSubFs");var X4=FA,ko,TA=(ko=class{constructor({name:e,storageFs:r,gitRoot:i,defaultBranch:n="main"}){W(this,"promises"),W(this,"gitRoot"),W(this,"ephemeralFilesFileSystem"),W(this,"hiddenFilesFileSystem"),W(this,"passThroughFileSystem"),W(this,"subFilesystems",[]),W(this,"parentFs"),W(this,"name"),W(this,"defaultBranch"),W(this,"gitCache"),W(this,"pathToFileDescriptors",new Map),W(this,"openFileHandles",new Map),W(this,"logOperation"),this.name=e,this.gitRoot=i,this.defaultBranch=n,this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)},this.passThroughFileSystem=new X4({name:e+"-passthrough",passThroughFs:r,gitRoot:i,parentFs:this})}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,r,i){if(!this.logOperation)return;let n=[];for(let[s,o]of this.pathToFileDescriptors.entries())o.includes(e.fd)&&n.push(s);if(n.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:n[0],operation:r,operationArgs:i})}getFilehandle(e){return this.openFileHandles.get(e)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let r of this.subFilesystems)if(await r.responsible(e.toString()))return r;return this.passThroughFileSystem}async access(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e,operation:"access",operationArgs:{mode:r}}),i.access(e,r)}async opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();if(!i.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+i+") outside of the legit folder: "+this.gitRoot);return new _A(this,i)}async mkdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"mkdir",operationArgs:{options:r}}),i.mkdir(e,r)}async readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set;for(let n of[...this.subFilesystems].reverse()){let s=await n.readdir(e,r);for(let o of s)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+o)||i.add(o)}try{let n=await this.passThroughFileSystem.readdir(e,r);for(let s of n)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+s)||i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}try{let n=await this.ephemeralFilesFileSystem.readdir(e,r);for(let s of n)i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}for(let n of i){let s=(e=="/"?"":e)+"/"+n;await this.hiddenFilesFileSystem.responsible(s)&&i.delete(n)}return Array.from(i)}async open(e,r,i){let n=await this.getResponsibleFs(e);await this.logOperation?.({fsName:n.name,path:e,operation:"open",operationArgs:{flags:r,mode:i}});let s=await n.open(e,r,i),o=this.getNextFileDescriptor();return s.realize(o),this.openFileHandles.set(o,s),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(o),s}async close(e){try{await e.delegate.close(e)}catch(r){throw r}finally{for(let[r,i]of this.pathToFileDescriptors.entries()){let n=i.indexOf(e.fd);if(n!==-1){i.splice(n,1),i.length===0&&this.pathToFileDescriptors.delete(r);break}}this.openFileHandles.delete(e.fd)}}async stat(e,r){let i=e.toString(),n=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:n.name,path:i,operation:"stat",operationArgs:{opts:r}}),n.stat(e)}async lstat(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"lstat",operationArgs:{opts:r}}),i.lstat(e,r)}async link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}async unlink(e){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"unlink",operationArgs:{}}),r.unlink(e)}async rename(e,r){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(Tg.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(Tg.basename(r.toString())))throw new Error("Renaming to hidden Files is not allowed "+r)}let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i===n)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),i.rename(e,r);let s=await i.open(e.toString(),"r");try{let o=await i.fstat(s),f=Buffer.alloc(o.size);await i.read(s,f,0,o.size,0),await i.close(s),await n.writeFile(r.toString(),f,"utf8"),await i.unlink(e)}catch(o){try{await i.close(s)}catch{}throw o}}async rmdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:r}}),i.rmdir(e,r)}async symlink(e,r,i){throw new Error("not implemented")}async readFile(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:r}});let i=!0,n;if(typeof e=="number"){i=!1;let s=this.getFilehandle(e);if(!s)throw new Error("Invalid file descriptor");n=s}else if(typeof e=="string")n=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let s=(await n.stat()).size;if(typeof s=="bigint"){if(s>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");s=Number(s)}let o=Buffer.alloc(s),{bytesRead:f}=await n.read(o,0,s,0);if(r&&typeof r.encoding=="string")return o.slice(0,f).toString(r.encoding);if(typeof r=="string"){if(r==="utf8"||r==="utf-8")return o.slice(0,f).toString(r);throw new Error("Unsupported encoding: "+r)}return o.slice(0,f)}finally{n&&i&&await n.close()}}async writeFile(e,r,i){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:r,options:i}});let n=typeof e!="number",s,o,f,c="w";if(typeof i=="string"?o=i:i&&typeof i=="object"&&(o=i.encoding,f=i.mode,c=i.flag||"w"),typeof e=="number"){let a=this.getFilehandle(e);if(!a)throw new Error("Invalid file descriptor");s=a}else if(typeof e=="string")s=await this.open(e,c,f);else throw new Error("only filehandle and path are supported atm");try{let a;if(typeof r=="string")a=Buffer.from(r,o||"utf8");else if(r instanceof Buffer)a=r;else if(r instanceof Uint8Array)a=Buffer.from(r);else throw new Error("Invalid data type for writeFile");let u=0;for(;u<a.length;){let{bytesWritten:h}=await s.write(a,u,a.length-u,u);u+=h}}finally{s&&n&&await s.close()}}},l(ko,"we"),ko);g(TA,"CompositeFs");var Y4=TA,Ro,RA=(Ro=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,hiddenFiles:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"ig"),this.ig=(0,kA.default)(),this.ig.add(n)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${this.toStr(e)}`)}async open(e,r,i){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,r){throw this.error(r)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,r,i,n,s){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},l(Ro,"ye"),Ro);g(RA,"HiddenFileSubFs");var Z4=RA,Oo,xA=(Oo=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i,ephemeralPatterns:n}){super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,vh.createFsFromVolume)(new vh.Volume)),W(this,"ig"),W(this,"patterns"),this.compositFs=r,this.gitRoot=i,this.ig=(0,OA.default)(),this.ig.add(n),this.patterns=n}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 5}async open(e,r,i){let n=this.normalizePath(e),s=uh.dirname(n);s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0});let o=await this.memFs.promises.open(n,r,i);return this.openFh.set(o.fd,o),new _h({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[o.fd]})}async access(e,r){let i=this.normalizePath(e);return await this.memFs.promises.access(i,r)}async stat(e,r){let i=this.normalizePath(e);return this.memFs.promises.stat(i,{bigint:!1})}async lstat(e,r){let i=this.normalizePath(e);return this.memFs.promises.lstat(i,{bigint:!1})}async opendir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.opendir(i,r)}async link(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizePath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=uh.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.memFs.promises.stat(n)}catch{await this.memFs.promises.mkdir(n,{recursive:!0})}}await this.memFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=await this.memFs.promises.readdir(i,...r);return console.log("EPHEMERAL: READDIR: ",n),n}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let r=this.normalizePath(e);return await this.memFs.promises.unlink(r)}async rename(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizePath(e),s=this.normalizePath(r);return await this.memFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e=="string"||Buffer.isBuffer(e)){let i=this.normalizePath(e);return this.memFs.promises.readFile(i,r)}return super.readFile(e,r)}async writeFile(e,r,i){let n=this.normalizePath(e),s=uh.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},l(Oo,"be"),Oo);g(xA,"EphemeralSubFs");var Q4=xA,xo,e3=(xo=class extends Rc{constructor({name:e,parentFs:r,gitRoot:i}){if(super({name:e,parentFs:r,gitRoot:i}),W(this,"openFh",new Map),W(this,"memFs",(0,Eh.createFsFromVolume)(new Eh.Volume)),W(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=AA.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new _h({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[s.fd]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){return await this.targetFs.promises.opendir(e,r)}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){let i=typeof e=="string"?e:e.toString();return await this.targetFs.promises.mkdir(i,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return typeof e=="string"||Buffer.isBuffer(e)?this.targetFs.readFile(e.toString(),r):super.readFile(e,r)}async writeFile(e,r,i){let n=typeof i=="object"&&i.flag?i.flag:"w",s=await this.targetFs.open(e,n);try{let o;if(typeof r=="string"){let f=typeof i=="object"&&i.encoding?i.encoding:"utf8";o=Buffer.from(r,f)}else Buffer.isBuffer(r)?o=r:o=Buffer.from(r);await s.write(o,0,o.length,0)}finally{await this.targetFs.close(s)}}},l(xo,"ve"),xo);g(e3,"PassThroughSubFs");var Ao,PA=(Ao=class{constructor(e){this.routes=e,W(this,"compiledRoutes");let r={},i=g((n,s)=>{if(typeof n.type=="string"){r[s]={handler:n,siblings:[]};let o=n}else{let o=[];for(let[f,c]of Object.entries(n))if(f==="."){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:c,siblings:o}}else if(f.startsWith("[[")&&f.endsWith("]]")){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:c,siblings:o},f.startsWith("[[...")?r[s?`${s}/${f}`:f]={handler:c,siblings:[]}:i(c,s?`${s}/${f}`:f)}else f.startsWith("[")&&f.endsWith("]")?f.startsWith("[...")?r[s?`${s}/${f}`:f]={handler:c,siblings:[]}:i(c,s?`${s}/${f}`:f):(o.push({segment:f,type:c["."]?"folder":"file"}),i(c,s?`${s}/${f}`:f))}},"walk");i(e,""),this.compiledRoutes=Object.entries(r).map(([n,s])=>{let o=[],f=n.split("/").map(c=>{if(c.startsWith("[[")&&c.endsWith("]]")){let a=c.slice(2,-2).replace(/^\.\.\./,"");return o.push(a),"(.*)"}if(c.startsWith("[")&&c.endsWith("]")){let a=c.slice(1,-1);return o.push(a),"([^/]+)"}return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${f}$`),paramNames:o,staticSiblings:s.siblings,handler:s.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:r,paramNames:i,handler:n,staticSiblings:s}of this.compiledRoutes){let o=e.match(r);if(!o)continue;let f={};for(let c=0;c<i.length;c++)f[i[c]]=decodeURIComponent(o[c+1]||"");return{handler:n,params:f,staticSiblings:s}}}},l(Ao,"Pe"),Ao);g(PA,"LegitPathRouter");var t3=PA,r3=new Set([" ","~","^",":","?","*","[","\\"]),i3=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],NA="\u2002";function Og(t){let e=t.codePointAt(0);return!(e>=0&&e<=31||e===127||r3.has(t))}l(Og,"Ue");g(Og,"isValidChar");function DA(t){let e="";for(let r of t)r===" "?e+=NA:Og(r)?e+=r:e+="%"+r.codePointAt(0);for(let r of i3)if(r.test(e))return Array.from(e).map(i=>Og(i)?i:"%"+i.codePointAt(0)).join("");return e}l(DA,"Je");g(DA,"encodeName");function CA(t){return t.replace(/%(\d+)/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(new RegExp(NA,"g")," ")}l(CA,"Ke");g(CA,"decodeName");function Po(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}l(Po,"M");g(Po,"encodeBranchNameForVfs");function lt(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}l(lt,"B");g(lt,"decodeBranchNameFromVfs");async function ue(t,e,r,i){try{return await Fr.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${lt(r)}`})}catch{return}}l(ue,"b");g(ue,"tryResolveRef");async function Wr({dir:t,fs:e,treeOid:r,deletePathParts:i,addPathParts:n,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f,keepFilename:c=".keep",gitCache:a}){let[u,...h]=n??[],[d,...p]=i??[],m=[];if(r){let{tree:w}=await Fr.default.readTree({fs:e,dir:t,oid:r,cache:a||{}});m=[...w]}if(u===d){let w=u;if(w===void 0)throw new Error("illegal arguement - called with out a path part");if(h.length===0)throw new Error("can not move into it self");if(p.length===0)throw new Error("can not move from it self");let y=m.findIndex(E=>E.path===w),b=(y!==-1?m[y]:void 0)?.oid,_=await Wr({dir:t,fs:e,treeOid:b,addPathParts:h,deletePathParts:p,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(_===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let F=!1;if(_!==b){F=!0;let E={mode:"040000",path:w,oid:_,type:"tree"};y!==-1?m[y]=E:m.push(E)}if(r==null&&!F)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(F)return await Fr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}else{let w=!1,y;if(d){let b=m.findIndex(F=>F.path===d),_=b!==-1?m[b]:void 0;if(_===void 0)throw new Error("Element doesnt exist in tree");if(p.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let F=await Wr({dir:t,fs:e,treeOid:_.oid,addPathParts:void 0,deletePathParts:p,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(F===_.oid)throw new Error("in case of a delete we expect a different subtree oid");w=!0,F===void 0?m.splice(b,1):m[b]={mode:"040000",path:d,oid:F,type:"tree"}}else if(w=!0,m.splice(b,1),m.length===0&&o){let F=new Uint8Array(0),E=await Fr.default.writeBlob({fs:e,dir:t,blob:F});m.push({mode:"100644",oid:E,path:c,type:"blob"})}y=_}if(u){let b=m.findIndex(F=>F.path===u),_=b!==-1?m[b]:void 0;if(h.length>0){if(_&&_.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let F=await Wr({dir:t,fs:e,treeOid:_?.oid,addPathParts:h,deletePathParts:void 0,addObj:s,addKeepIfEmpty:o,deleteKeepIfNotEmpty:f});if(F===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(F!==_?.oid){w=!0;let E={mode:"040000",path:u,oid:F,type:"tree"};if(b!==-1)m[b]=E;else if(m.push(E),f&&m.length>1){let R=m.findIndex(D=>D.path===c);R!==-1&&m.splice(R,1)}}}else{if(w=!0,s){let F={mode:s.type==="tree"?"040000":"100644",path:u,oid:s.oid,type:s.type};if(b!==-1)m[b]=F;else{if(f&&m.length>0){let E=m.findIndex(R=>R.path===c);E!==-1&&m.splice(E,1)}m.push(F)}}if(o&&m.length===0){let F=new Uint8Array(0),E=await Fr.default.writeBlob({fs:e,dir:t,blob:F});m.push({mode:"100644",oid:E,path:c,type:"blob"})}}}if(m.length===0)return;if(w)return await Fr.default.writeTree({fs:e,dir:t,tree:m});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}}l(Wr,"x");g(Wr,"buildUpdatedTree");async function $g(t,e,r,i,n=0,s={}){let{tree:o}=await Fr.default.readTree({fs:t,dir:e,oid:r,cache:s});if(i.length===n)return{type:"tree",entries:o.map(a=>Lt({parent:i.join("/"),name:a.path,isDir:a.type==="tree"})),oid:r};let f=i[n],c=o.find(a=>a.path===f);if(c){if(i.length===n+1){if(c.type==="blob")return{type:"blob",oid:c.oid};if(c.type==="tree"){let a=await Fr.default.readTree({fs:t,dir:e,oid:c.oid,cache:s});return{type:"tree",entries:a.tree.map(u=>Lt({parent:i.join("/"),name:u.path,isDir:u.type==="tree"})),oid:a.oid}}}else if(c.type==="tree")return await $g(t,e,c.oid,i,n+1,s)}}l($g,"qe");g($g,"findGitObjectAtPath");async function So({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n,gitCache:s}){let o=s||{};if(!n.filePath){let c=await Fr.default.readTree({fs:r,dir:e,oid:i,cache:o});return{type:"tree",entries:c.tree.map(a=>Lt({parent:t,name:a.path,isDir:a.type==="tree"})),oid:c.oid}}let f=n.filePath?n.filePath.split("/"):[];return await $g(r,e,i,f,0,o)}l(So,"j");g(So,"resolveGitObjAtPath");function Lt(t){return{name:t.name,isFile:g(()=>!t.isDir,"isFile"),isDirectory:g(()=>t.isDir,"isDirectory"),isBlockDevice:g(()=>!0,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isFIFO:g(()=>!1,"isFIFO"),isSocket:g(()=>!1,"isSocket"),parentPath:t.parent,path:t.parent}}l(Lt,"T");g(Lt,"toDirEntry");var mn,xg=(mn=class extends Rc{constructor({name:e,parentFs:r,gitStorageFs:i,gitRoot:n,routerConfig:s}){super({name:e,parentFs:r,gitRoot:n}),W(this,"pathRouter"),W(this,"memFs"),W(this,"openFh",{}),W(this,"storageFs"),this.pathRouter=new t3(s),this.gitRoot=n,this.storageFs=i,this.memFs=(0,Fh.createFsFromVolume)(new Fh.Volume)}async getAuthor(){let e=await kg.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),r=await kg.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),i=Math.floor(Date.now()/1e3),n=new Date().getTimezoneOffset();return{name:e,email:r,date:i,timezoneOffset:n}}async responsible(e){return!0}getRouteHandler(e){let r=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?r=e.slice(this.gitRoot.length):r=e.slice(this.gitRoot.length+1));let i=r.indexOf(`/${mn.LEGIT_DIR}`);if(i===-1)return this.pathRouter.match(r);let n=r.slice(i+1);return this.pathRouter.match(r)}async open(e,r,i){let n=this.getRouteHandler(e);if(!n)throw new Error("Not a virtual legit file");if(n?.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${n?.handler.type}`);if(r.includes("x")&&n?.handler.type!=="gitBranchFileVirtualFile"&&n?.handler.type!=="claudeVirtualSessionFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${n?.handler.type}`);let s=await this.getAuthor(),o=await n.handler.getFile({cacheFs:this.memFs,filePath:e,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:s}),f=!1;for(let d of Object.values(this.openFh))d.path===e&&(f=!0);if((o||f)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!o&&!f&&!(r.includes("w")||r.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let c=Rg.dirname(e);if(await this.memFs.promises.mkdir(c,{recursive:!0}),o===void 0&&!r.includes("x")||o&&o.type==="file")try{let d=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let a=await this.memFs.promises.open(e,r,i),u=a.fd,h=new _h({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:u,parentFsFileDescriptors:[]});return this.openFh[u]={path:e,mode:r,fh:a,openSha:o?.oid,readSha:void 0,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[u].unflushed.push({length:0,start:0}),h}async mkdir(e,r){let i=e.toString(),n=this.getRouteHandler(i),s=r?{options:r}:{};try{let o=await this.getAuthor();await n?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,...s,author:o});let f=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,f);let c=i.split("/"),a="";for(let u=1;u<=c.length;u++){a=c.slice(0,u).join("/");try{if((await this.memFs.promises.stat(a)).isDirectory()){let h=await this.memFs.promises.open(a,"r");this.openFh[h.fd]={path:a,mode:"r",fh:h,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(o){throw o}}async access(e,r){await this.stat(e)}async futimes(e,r,i){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(r,i)}async fstat(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return this.stat(i.path,r)}async ftruncate(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return i.unflushed.push({length:0,start:0}),await i.fh.truncate(r)}async stat(e,r){let i=e.toString(),n=Object.values(this.openFh).find(f=>f.path===i&&f.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(r);let s=this.getRouteHandler(i);if(!s)throw new Error(`ENOENT: no such file or directory, stat '${i}'`);let o=await this.getAuthor();return await s.handler.getStats({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s.params,author:o})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteHandler(i);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${i}'`);let s=await this.getAuthor(),o=await n?.handler.getFile({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:s});if(o){if(o.type!=="directory")throw new Error("not a folder");let f=n?.staticSiblings??[],c=Array.from(new Set([...o.content,...f.map(a=>Lt({name:a.segment,parent:i,isDir:a.type==="folder"}))])).sort((a,u)=>a.name.localeCompare(u.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?c:c.map(a=>a.name)}return[]}async read(e,r,i,n,s){let o=e.subFsFileDescriptor,f=this.openFh[o];if(!f)throw new Error("Invalid file handle");if(f.unflushed.length===0){let c=this.getRouteHandler(f.path),a=await this.getAuthor(),u=await c.handler.getFile({cacheFs:this.memFs,filePath:f.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:c?.params,author:a});if(!u?.content)throw new Error("couldnt access content");if(u.type!=="file")throw new Error("not a file");let h=typeof u.content=="string"?Buffer.from(u.content):u.content,d=typeof s=="number"?s:0,p=Math.min(d+n,h.length),m=Math.max(0,p-d);return h.copy(r,i,d,d+m),{bytesRead:m,buffer:r}}return await f.fh.read(r,i,n,s)}async write(e,r,i,n,s){let o=this.openFh[e.subFsFileDescriptor];if(!o)throw new Error("Invalid file handle");let f=o.mode;if(!f.includes("w")&&!f.includes("a")&&!f.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(o.unflushed.length===0){let h=this.getRouteHandler(o.path),d=await this.getAuthor(),p=await h.handler.getFile({cacheFs:this.memFs,filePath:o.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h.params,author:d});p&&p.oid&&(await this.memFs.promises.writeFile(o.path,p.content),o.readSha=p.oid)}let c=await o.fh.write(r,i,n,s),a=i??0,u=s??0;return o.unflushed.push({start:u,length:n||r.byteLength-a+u}),c}async close(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");try{await this.dataSync(e),await i.fh.close()}finally{delete this.openFh[r]}}async dataSync(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");if(i.unflushed.length>0){let n=this.getRouteHandler(i.path);if(n&&n.handler.writeFile){let s=await this.memFs.promises.readFile(i.path),o=await this.getAuthor();await n.handler.writeFile({cacheFs:this.memFs,filePath:i.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:s,pathParams:n.params,author:o})}i.unflushed=[]}}async readFile(e,r){let i=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof r=="string"?n=r:r&&typeof r=="object"&&r.encoding&&(n=r.encoding);let s=await this.open(i,"r");try{let o=(await this.fstat(s)).size,f=Buffer.alloc(o);return await this.read(s,f,0,o,0),await this.close(s),n?f.toString(n):f}catch(o){try{await this.close(s)}catch{}throw o}}async writeFile(e,r,i){let n="w",s="utf8",o;typeof i=="string"?s=i:i&&typeof i=="object"&&(i.flag&&(n=String(i.flag)),i.encoding&&(s=i.encoding),i.mode&&(o=typeof i.mode=="string"?parseInt(i.mode,8):i.mode));let f=await this.open(e,n,o);try{let c;typeof r=="string"?c=Buffer.from(r,s):Buffer.isBuffer(r)?c=r:r instanceof Uint8Array?c=Buffer.from(r):ArrayBuffer.isView(r)?c=Buffer.from(r.buffer,r.byteOffset,r.byteLength):c=Buffer.from(r),await this.write(f,c,0,c.length,0)}finally{await this.close(f)}}async rename(e,r){let i=e.toString(),n=r.toString(),s=this.getRouteHandler(i),o=this.getRouteHandler(n);if(s?.handler.type==="gitBranchFileVirtualFile"&&o?.handler.type==="gitBranchFileVirtualFile"){let f=!0;try{await this.memFs.promises.access(n)}catch{f=!1}let c=!0;try{await this.stat(n)}catch{c=!1}let a=!0;try{await this.stat(i)}catch{a=!1}let u=!0;try{await this.memFs.promises.access(i)}catch{u=!1}if(u){let m=Rg.dirname(n);try{await this.memFs.promises.access(m)}catch{await this.memFs.promises.mkdir(m,{recursive:!0})}await this.memFs.promises.rename(e,r)}let h=this.getRouteHandler(i);if(!h)throw new Error("VF not found");let d=await this.getAuthor(),p=await h.handler.rename({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:h?.params??{},newPathParams:o?.params??{},author:d})}else throw new Error(`Unsupported rename operation from ${s?.handler.type} to ${o?.handler.type}`)}async fchmod(e,r){}async unlink(e){let r=e.toString(),i=this.getRouteHandler(r);if(i?.handler.unlink!==void 0)try{let n=await this.getAuthor();await i.handler.unlink({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,author:n})}catch(n){let s=!1;for(let[o,f]of Object.entries(this.openFh))f.path===r&&f.unflushed.length>0&&(s=!0);if(!s)throw n}finally{let n=!1;for(let[s,o]of Object.entries(this.openFh))o.path===r&&(n=!0,await o.fh.close(),delete this.openFh[Number(s)]);n&&await this.memFs.promises.unlink(r)}else throw new Error(`Cannot unlink ${i?.handler.type} files`)}async rmdir(e,...r){let i=e.toString(),n=this.getRouteHandler(i);if(n?.handler.rmdir!==void 0){let s=await this.getAuthor();await n.handler.rmdir({cacheFs:this.memFs,filePath:i,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,author:s});let o=!1;for(let[f,c]of Object.entries(this.openFh))c.path===i&&(o=!0,await c.fh.close(),delete this.openFh[Number(f)]);o&&await this.memFs.promises.rmdir(i,{recursive:!0})}else throw new Error(`Cannot rmdir
106
- ${n?.handler.type} directories`)}fileType(){return 10}},l(mn,"J"),mn);g(xg,"GitSubFs"),W(xg,"LEGIT_DIR",".legit");var n3=xg,$A="-operation";async function jt(t,e,r){return(await IA.default.listBranches({fs:t,dir:e})).filter(i=>i.endsWith("__"+r+$A))[0]}l(jt,"C");g(jt,"resolveOperationBranchName");async function me(t,e){try{let r=await ph.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return Po(r)}catch{}try{let r=await ph.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Po(r)||"main"}catch{return"main"}}l(me,"k");g(me,"getCurrentBranch");async function BA(t,e,r){await ph.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:lt(r)})}l(BA,"Qe");g(BA,"setCurrentBranch");var Ag={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s,o=!1;if(n)try{s=await dn.default.resolveRef({fs:r,dir:e,ref:n}),o=!0}catch{try{s=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),o=!0}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}}else try{s=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let f=await dn.default.readCommit({fs:r,dir:e,oid:s}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:(o?await Ag.getFile(t):void 0)?.content?.length??0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s=[];if(n){let c=await dn.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!1,u=c;for(;u&&!a;){let h=await dn.default.readCommit({fs:r,dir:e,oid:u});s.push({oid:h.oid,parentOids:h.commit.parent,message:h.commit.message,originBranchOid:"unset"}),u=h.commit.parent&&h.commit.parent.length>0?h.commit.parent[0]:null,h.commit.parent.length===2&&h.commit.parent[0]===h.commit.parent[1]&&(a=!0)}}let o;for(let c=s.length-1;c>=0;c--){let a=s[c];if(o===void 0){if(a.parentOids.length!==2&&a.parentOids[0]!==a.parentOids[1])throw new Error(`Operation commit ${a.oid} does not have two parents as expected`);o=a.parentOids[1]}a.parentOids.length===2&&(o=a.parentOids[1]),a.originBranchOid=o}let f=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:g(async function(t){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},vi="legit",s3=g(({fs:t,gitRepoPath:e,serverUrl:r="https://hub.legitcontrol.com",auth:i,anonymousBranch:n,authHeaderPrefix:s="Bearer "})=>{let o=!1;async function f(y){let b=await i.getMaxAccessTokenForBranch(y);if(!b)throw new Error(`No access token for branch ${y}`);await ct.default.fetch({fs:t,http:lh,dir:e,singleBranch:!0,ref:`${y}`,remote:vi,url:r,headers:{Authorization:`${s}${b}`}});let _=await ct.default.resolveRef({fs:t,dir:e,ref:`${vi}/${y}`});await ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${y}`,value:_})}l(f,"l"),g(f,"loadBranch");let c=[];async function a(){let y=await i.getMaxAccessTokenForBranch("todo");await ct.default.fetch({fs:t,http:lh,dir:e,remote:vi,url:r,headers:{Authorization:`${s}${y}`}});let b=await ct.default.listBranches({fs:t,dir:e});for(let _ of b){if(_===n)continue;let F=`${vi}/${_}`,E,R;try{E=await ct.default.resolveRef({fs:t,dir:e,ref:_})}catch(D){console.log(`Could not resolve local ref ${_}:`,D)}try{R=await ct.default.resolveRef({fs:t,dir:e,ref:F})}catch{R=void 0}if(E&&R){if(E!==R){let D=await ct.default.findMergeBase({fs:t,dir:e,oids:[E,R]});if(D[0]!==E&&D[0]!==R){let S=await ct.default.merge({fs:t,dir:e,ours:E,theirs:R,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:g(async({branches:O,contents:v,path:A})=>{let[x,I,M]=v;return console.log(`Merging ${O[0]} with ${O[1]}...`),console.log("merged:"),console.log(v),{cleanMerge:!0,mergedText:M===void 0?I:M}},"mergeDriver")});await ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:S.oid,force:!0})}D[0]===E?(console.log(`branch ${_} differs - remote ahaed, not behind`),await ct.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:R,force:!0})):D[0]===R?(console.log(`branch ${_} differs - local ahead, not behind`),c.push(_)):(console.log(`branch ${_} differs - both changed`),c.push(_))}}else E&&!R&&c.push(_)}}l(a,"m"),g(a,"pull");async function u(y){if((await i.getUser()).type!=="local")for(let b of y){let _=await i.getMaxAccessTokenForBranch(b);await ct.default.push({fs:t,http:lh,dir:e,remote:vi,url:r,ref:b,headers:{Authorization:`Bearer ${_}`}})}}l(u,"d"),g(u,"push");let h=Promise.resolve();async function d(y){h=h.then(()=>u(y)),await h}l(d,"h"),g(d,"sequentialPush");async function p(){await ct.default.getConfig({fs:t,dir:e,path:`remote.${vi}.fetch`})||await ct.default.setConfig({fs:t,dir:e,path:`remote.${vi}.fetch`,value:`+refs/heads/*:refs/remotes/${vi}/*`});try{await a();let y=[...new Set(c)].filter(b=>b.indexOf(n)===-1);await d(y),c=[]}catch(y){console.error("Error monitoring changes:",y)}finally{o&&setTimeout(p,1e3)}}l(p,"F"),g(p,"pullPushTick");function m(){o=!0,p()}l(m,"u"),g(m,"startSync");function w(){o=!1}return l(w,"v"),g(w,"stopSync"),{start:g(()=>{o||(m(),o=!0)},"start"),stop:g(()=>{w()},"stop"),isRunning:g(()=>o,"isRunning"),loadBranch:f,sequentialPush:d}},"createLegitSyncService"),o3=g((t,e)=>{let r={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:g(async()=>r,"getUser"),signInAnonymously:g(async()=>{r.type="anonymous",r.id=crypto.randomUUID(),r.email=`anonymous-sha1-${r.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:g(async i=>{let n=await t.getUserTokens(r.id);n.accessTokens.push(i),await t.setUserTokens(r.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:g(async i=>{let n=await t.getUserTokens(r.id);if(!(n.accessTokens===void 0||n.accessTokens.length===0))return n.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager");function MA(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),i="";return typeof btoa=="function"?i=btoa(String.fromCharCode(...r)):i=Buffer.from(r).toString("base64"),i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}l(MA,"et");g(MA,"encodeConfigJson");function LA(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((t.length+3)%4),r;typeof atob=="function"?r=atob(e):r=Buffer.from(e,"base64").toString("binary");let i=Uint8Array.from(r,s=>s.charCodeAt(0)),n=new TextDecoder().decode(i);return JSON.parse(n)}l(LA,"tt");g(LA,"decodeConfigJson");var uA="user.legit-tokens";function jA({storageFs:t,gitRoot:e}){return{getUserTokens:g(async r=>{let i=await Pg.default.getConfig({fs:t,dir:e,path:uA});return i?LA(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:g(async(r,i)=>await Pg.default.setConfig({fs:t,dir:e,path:uA,value:MA(i)}),"setUserTokens")}}l(jA,"st");g(jA,"createGitConfigTokenStore");var wn,qA=(wn=class extends Error{constructor(e,r){super(e),W(this,"code","ENOENT"),W(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,wn.prototype)}},l(wn,"se"),wn);g(qA,"ENOENTError");var Ng=qA;function Tc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?Tc(t.parentFs):{}}l(Tc,"ne");g(Tc,"getGitCacheFromFs");var Dg={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n,userSpaceFs:s})=>{n.branchName===void 0&&(n.branchName=await me(t,e));let o=await ue(e,t,n.branchName);if(!o)throw new Ng(`ENOENT: no such file or directory, stat '${r}'`,r);let f=await So({filePath:r,gitRoot:t,nodeFs:e,commitSha:o,pathParams:n,gitCache:Tc(s)});if(!f)throw new Ng(`ENOENT: no such file or directory, stat '${r}'`,r);let c=await ae.default.readCommit({fs:e,dir:t,oid:o}),{commit:a}=c,u=await ae.default.log({fs:e,dir:t,ref:o,filepath:n.filePath,depth:1}),h=a.committer.timestamp*1e3,d=u.length>0?u[0].commit.committer.timestamp*1e3:h;if(f.type==="tree")return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:h,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d)};{let{blob:p}=await ae.default.readBlob({fs:e,dir:t,oid:f.oid});return{mode:420,size:p.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(p.length/4096),atimeMs:d,mtimeMs:d,ctimeMs:d,birthtimeMs:d,atime:new Date(d),mtime:new Date(d),ctime:new Date(d),birthtime:new Date(d)}}},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,userSpaceFs:s})=>{n.branchName===void 0&&(n.branchName=await me(e,r));try{let o=await ue(r,e,n.branchName);if(!o){let c=await ae.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ae.default.branch({fs:r,dir:e,ref:n.branchName,object:c}),o=await ue(r,e,n.branchName),!o)throw new Error("Could not create branch for getFile")}let f=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:o,pathParams:n,gitCache:Tc(s)});if(!f)return;if(f.type==="blob"){let{blob:c}=await ae.default.readBlob({fs:r,dir:e,oid:f.oid});return{type:"file",content:Buffer.from(c),mode:420,size:c.length,oid:f.oid}}else{let c=[];try{let a=await i.promises.stat(t);if(a&&a.isDirectory()){let u=await i.promises.readdir(t,{withFileTypes:!0});c.push(...u)}}catch{}return{type:"directory",content:Array.from(new Set([...c,...f.entries])).map(a=>({...a,name:a.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await me(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let o=await ue(r,e,n.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let f=await ae.default.readTree({fs:r,dir:e,oid:o}),c=await Wr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==f.oid){let a=await ae.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[o],author:s});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(n.branchName)}`,value:a,force:!0})}},"unlink"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:o})=>{if(s.branchName===void 0&&(s.branchName=await me(e,r)),s.filePath===void 0)throw new Error("filePath should be in pathParams");let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let c=await ae.default.writeBlob({fs:r,dir:e,blob:f}),a=await ue(r,e,s.branchName);if(!a){let d=await ae.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ae.default.branch({fs:r,dir:e,ref:lt(s.branchName),object:d}),a=await ue(r,e,s.branchName),!a)throw new Error("Could not create branch for writeFile")}let u=await ae.default.readTree({fs:r,dir:e,oid:a}),h=await Wr({dir:e,fs:r,treeOid:u.oid,deletePathParts:void 0,addPathParts:s.filePath.split("/"),addObj:{type:"blob",oid:c},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(h!==u.oid){let d=await ae.default.commit({fs:r,dir:e,message:`\u{1F4BE} Change '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[a],author:o});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(s.branchName)}`,value:d,force:!0});let p=await ue(r,e,s.branchName);if(d!==p)throw new Error("Failed to update branch after file deletion")}},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:o,userSpaceFs:f}){if(n.branchName===void 0&&(n.branchName=await me(r,i)),n.filePath===void 0)throw new Error("filePath should be in pathParams");if(s.branchName===void 0&&(s.branchName=await me(r,i)),s.filePath===void 0)throw new Error("filePath should be in newPathParams");let c=await ue(i,r,n.branchName);if(!c)throw new Error("Invalid branch file path - source branch must exist");let a=await ue(i,r,s.branchName);if(!a){let p=await ae.default.resolveRef({fs:i,dir:r,ref:"HEAD"});if(await ae.default.branch({fs:i,dir:r,ref:lt(s.branchName),object:p}),a=await ue(i,r,s.branchName),a===void 0)throw new Error("Could not create branch for rename operation")}if(s.branchName!==n.branchName)throw new Error("cross branch move not implemented yet");let u=await So({gitRoot:r,nodeFs:i,commitSha:c,filePath:t,pathParams:n,gitCache:Tc(f)});if(u===void 0)throw new Error("no obj at path exists");let h=await Wr({dir:r,fs:i,deletePathParts:n.filePath.split("/"),addPathParts:s.filePath.split("/"),addObj:u.type==="blob"?{type:"blob",oid:u.oid}:{type:"tree",oid:u.oid,entries:u.entries.map(p=>p.name.toString())},treeOid:a,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),d=await ae.default.readTree({fs:i,dir:r,oid:c});if(h!==d.oid){let p=await ae.default.commit({fs:i,dir:r,message:`\u{1F500} Rename '${n.filePath}' to '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[a],author:o});await ae.default.writeRef({fs:i,dir:r,ref:`refs/heads/${lt(s.branchName)}`,value:p,force:!0})}},"rename"),mkdir:g(async function(t){t.pathParams.branchName===void 0&&(t.pathParams.branchName=await me(t.gitRoot,t.nodeFs));let e=await ue(t.nodeFs,t.gitRoot,t.pathParams.branchName);if(t.pathParams.filePath===void 0&&(t.pathParams.filePath="/",e!==void 0))throw new Error("Folder exists");try{throw await Dg.getStats(t),new Error("Folder exists")}catch{}if(t.filePath.endsWith("/")&&(t.filePath=t.filePath.replace(/\/+$/,"")),t.pathParams&&typeof t.pathParams.filePath=="string"&&(t.pathParams.filePath=t.pathParams.filePath.replace(/\/+$/,"")),!e){let o=await ae.default.resolveRef({fs:t.nodeFs,dir:t.gitRoot,ref:"HEAD"});if(await ae.default.branch({fs:t.nodeFs,dir:t.gitRoot,ref:lt(t.pathParams.branchName),object:o}),e=await ue(t.nodeFs,t.gitRoot,t.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let r=await ae.default.readTree({fs:t.nodeFs,dir:t.gitRoot,oid:e}),i=new Uint8Array(0),n=await ae.default.writeBlob({fs:t.nodeFs,dir:t.gitRoot,blob:i}),s=await Wr({dir:t.gitRoot,fs:t.nodeFs,treeOid:r.oid,deletePathParts:void 0,addPathParts:[...t.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:n},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(s!==r.oid){let o=await ae.default.commit({fs:t.nodeFs,dir:t.gitRoot,message:`\u{1F4BE} Change '${t.pathParams.filePath}'`,tree:s,noUpdateBranch:!0,parent:[e],author:t.author});await ae.default.writeRef({fs:t.nodeFs,dir:t.gitRoot,ref:`refs/heads/${lt(t.pathParams.branchName)}`,value:o,force:!0})}},"mkdir"),rmdir:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await me(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let o=await ue(r,e,n.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let f=await ae.default.readTree({fs:r,dir:e,oid:o}),c=await Wr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(c!==f.oid){let a=await ae.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:c,noUpdateBranch:!0,parent:[o],author:s});await ae.default.writeRef({fs:r,dir:e,ref:`refs/heads/${lt(n.branchName)}`,value:a,force:!0})}},"rmdir")},a3={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.promises.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,filePath:r})=>{try{let i=await Cg.default.listBranches({fs:e,dir:t}),n=await Promise.all(i.map(async s=>{let o=await Cg.default.resolveRef({fs:e,dir:t,ref:s});return Lt({parent:r,name:Po(s),isDir:!0})}));return{type:"directory",content:n,mode:493,size:n}}catch(i){throw i}},"getFile"),rename:g(async t=>{throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function mh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?mh(t.parentFs):{}}l(mh,"Oe");g(mh,"getGitCacheFromFs");var hA={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let n=await ue(e,t,r.branchName);if(!n)throw new Error(`Branch ${r.branchName} does not exist in the repository`);let s=await _o.default.readCommit({fs:e,dir:t,oid:n,cache:mh(i)}),{commit:o}=s,f=o.committer.timestamp*1e3;return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{r.branchName===void 0&&(r.branchName=await me(t,e));try{let n;try{n=await _o.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{n=await _o.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}return{type:"file",content:n+`
107
- `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,userSpaceFs:o})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:s,content:i}),s.branchName===void 0&&(s.branchName=await me(e,r));let f=i.toString().trim();try{await _o.default.readCommit({fs:r,dir:e,oid:f,cache:mh(o)})}catch{throw new Error(`Commit ${f} does not exist in the repository`)}await _o.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:f,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},dA={type:"legitVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.promises.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e})=>({type:"directory",content:[],mode:493,size:0}),"getFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function kc(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?kc(t.parentFs):{}}l(kc,"ae");g(kc,"getGitCacheFromFs");var c3={type:"gitCommitFileVirtualFile",rootType:"file",getStats:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i,userSpaceFs:n})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let s=i.sha_1_1_2+i.sha1_3__40,o=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:i,gitCache:kc(n)});if(!o)throw new Ng(`ENOENT: no such file or directory, stat '${t}'`,t);let f=await hh.default.readCommit({fs:r,dir:e,oid:s}),{commit:c}=f,a=c.committer.timestamp*1e3;if(o.type==="tree")return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)};{let{blob:u}=await hh.default.readBlob({fs:r,dir:e,oid:o.oid});return{mode:420,size:u.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(u.length/4096),atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)}}},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i,userSpaceFs:n})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let s=i.sha_1_1_2+i.sha1_3__40;try{let o=await So({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:i,gitCache:kc(n)});if(!o)return;if(o.type==="blob"){let{blob:f}=await hh.default.readBlob({fs:r,dir:e,oid:o.oid,cache:kc(n)});return{type:"file",content:Buffer.from(f),mode:420,size:f.length,oid:o.oid}}else return{type:"directory",content:Array.from(new Set([...o.entries.filter(f=>f.name!==".keep")])).map(f=>({...f,name:f.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}catch{return}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},pA={type:"gitCommitVirtualFolder",rootType:"folder",getStats:g(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.promises.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{let n=await dh.default.listBranches({fs:r,dir:e}),s=new Set,o=new Set;for(let a of n){let u=`refs/heads/${a}`;try{let h=await dh.default.resolveRef({fs:r,dir:e,ref:u});s.add(h)}catch{}}for(let a of s){let u=await dh.default.log({fs:r,dir:e,ref:a});for(let h of u)o.add(h.oid)}if(!i.sha_1_1_2){let a=new Set;for(let h of o)if(a.add(h.slice(0,2)),a.size>=256)break;let u=Array.from(a).sort().map(h=>Lt({parent:t,name:h,isDir:!0}));return{type:"directory",content:u,mode:493,size:u}}let f=new Set;for(let a of o)a.startsWith(i.sha_1_1_2)&&f.add(a.slice(2,40));let c=Array.from(f).sort().map(a=>Lt({parent:t,name:a,isDir:!0}));return{type:"directory",content:c,mode:493,size:c.length}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},mA={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await ue(r,e,i.branchName);if(!n)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);let s=await jt(r,e,i.branchName),o=!1;if(s)try{n=await rr.default.resolveRef({fs:r,dir:e,ref:s}),o=!0}catch{try{n=await rr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),o=!0}catch{}}let f=await rr.default.readCommit({fs:r,dir:e,oid:n}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await me(e,r));let n=await jt(r,e,i.branchName),s,o=!1;if(n){if(s=await ue(r,e,n),o=!0,!s)throw new Error(`Base Branch ${n} for operations does not exis`)}else if(s=await ue(r,e,i.branchName),!s)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);return{type:"file",content:Buffer.from(s),mode:420,size:s.length}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:o})=>{s.branchName===void 0&&(s.branchName=await me(e,r));let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let c=await rr.default.writeBlob({fs:r,dir:e,blob:f}),a=await ue(r,e,s.branchName);if(!a)throw new Error("Invalid branch file path - branch doesn't exist");let u=await jt(r,e,s.branchName),h=!1;u||(u="legit/__"+s.branchName+$A,await rr.default.branch({fs:r,dir:e,ref:u,object:a}),h=!0);let d=await rr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${u}`}),p=await rr.default.readTree({fs:r,dir:e,oid:a}),m;i instanceof ArrayBuffer?m=Buffer.from(i).toString("utf-8"):typeof i=="string"?m=i:i instanceof Uint8Array?m=Buffer.from(i).toString("utf-8"):m=String(i);let w=!1;if(!h){let b=await rr.default.findMergeBase({fs:r,dir:e,oids:w?[d]:[d,a]});b.length===1&&b[0]===a&&(w=!0)}let y=await rr.default.commit({fs:r,dir:e,message:m,tree:p.oid,noUpdateBranch:!0,author:o,parent:w?h?[a,a]:[d]:[d,a]});await rr.default.writeRef({fs:r,dir:e,ref:`refs/heads/${u}`,value:y,force:!0})},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},l3={type:"getThreadName",rootType:"file",getStats:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await ue(r,e,i.branchName);if(!n)throw new Error(`Base Branch ${i.branchName} for operations does not exis`);let s=await jt(r,e,i.branchName),o=!1;if(s)try{n=await Fc.default.resolveRef({fs:r,dir:e,ref:s}),o=!0}catch{try{n=await Fc.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),o=!0}catch{}}let f=await Fc.default.readCommit({fs:r,dir:e,oid:n}),{commit:c}=f,a=c.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await jt(r,e,i.branchName),s;if(n){let o="legit/",f=`__${i.branchName}-operation`;return n.startsWith(o)&&n.endsWith(f)?s=n.slice(o.length,n.length-f.length):s=n,{type:"file",content:Buffer.from(CA(s)),mode:420,size:s.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{if(s.branchName===void 0)throw new Error("branchName should be in pathParams");let o=await jt(r,e,s.branchName);if(o){let f=`legit/${DA(i.toString())}__${s.branchName}-operation`;await Fc.default.renameBranch({fs:r,dir:e,oldref:o,ref:f}),o=f}},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},wA={type:"gitBranchHistory",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await ue(e,t,r.branchName);if(!i)throw new Error(`Branch ${r.branchName} does not exist`);let n=await Ig.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,o=s.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)}},"getStats"),getFile:g(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=i.branchName;n===void 0&&(n=await me(e,r));let s=[];if(n){let f=await ue(r,e,n),c=!1,a=f;for(;a&&!c;){let u=await Ig.default.readCommit({fs:r,dir:e,oid:a});s.push({oid:u.oid,...u.commit}),a=u.commit.parent[0]}}let o=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:o,mode:420,size:o.length}},"getFile"),rename:g(async t=>{throw new Error("not implemented")},"rename"),mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},yA={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await jt(e,t,r.branchName);if(!i){let c=new Date(0);return{mode:420,size:0,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:c.getTime(),mtimeMs:c.getTime(),ctimeMs:c.getTime(),birthtimeMs:c.getTime(),atime:c,mtime:c,ctime:c,birthtime:c}}let n;try{n=await vr.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await vr.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}let s=await vr.default.readCommit({fs:e,dir:t,oid:n}),{commit:o}=s,f=o.committer.timestamp*1e3;return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await me(t,e));let i=await jt(e,t,r.branchName);if(!i)return{type:"file",content:"",mode:420,size:0};try{let n;try{n=await vr.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await vr.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}return{type:"file",content:n+`
108
- `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await me(e,r));let o=await jt(r,e,s.branchName),f=await vr.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${o}`});if(!o)throw new Error(`Operation branch name could not be resolved for branch ${s.branchName}`);let c=i.toString().trim(),a,u,h=!1;if(!f)throw new Error(`Operation branch ref could not be resolved for branch ${o}`);let d=f;for(;d&&!h;){let p=await vr.default.readCommit({fs:r,dir:e,oid:d});if(p.oid===c&&(a=p.oid),d=p.commit.parent&&p.commit.parent.length>0?p.commit.parent[0]:null,p.commit.parent.length===2){if(p.commit.parent[0]===p.commit.parent[1])h=!0;else if(a!==void 0){u=p.commit.parent[1];break}}}if(a===void 0)throw new Error(`Cant rollback to ${c} couldn't find newOperationBranchHead ${a}`);if(u===void 0)throw new Error(`Cant rollback to ${c} couldn't find newBranchHead ${u}`);await vr.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+o,value:a,force:!0}),await vr.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:u,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};async function yh(t,e){try{let r=await wh.default.getConfig({fs:e,dir:t,path:"user.legit-target-branch"});if(r)return Po(r)}catch{}try{let r=await wh.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return Po(r)||"main"}catch{return"main"}}l(yh,"q");g(yh,"getTargetBranch");async function WA(t,e,r){await wh.default.setConfig({fs:e,dir:t,path:"user.legit-target-branch",value:lt(r)})}l(WA,"ct");g(WA,"setTargetBranch");var f3={type:"gitCurrentBranchVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=(await me(t,e)).length;return{mode:420,size:r,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(r/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e})=>{let r=await me(t,e);return{type:"file",content:r+`
109
- `,mode:420,size:r.length+1}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await ue(e,t,i)){let n=await yh(t,e),s=await ue(e,t,n);if(!s)throw new Error(`Ref branch ${n} does not exist in the repository`);await UA.default.branch({fs:e,dir:t,ref:lt(i),object:s})}await BA(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},Er="session_data",fh=JSON.stringify({env:{CLAUDE_CONFIG_DIR:`.claude/${Er}`}},null,2),u3={type:"claudeVirtualSessionFileVirtualFile",rootType:"folder",getStats:g(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n})=>{let s=r.replace(/\\/g,"/");if(s.endsWith(".claude")||s.endsWith(`.claude/${Er}`)||s.endsWith(`.claude/${Er}/debug`)||s.endsWith(`.claude/${Er}/projects`)||new RegExp(`\\.claude\\/${Er}\\/projects\\/[^/]+$`).test(s)){let f=new Date(0);return{mode:16877,size:0,isFile:g(()=>!1,"isFile"),isDirectory:g(()=>!0,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:f,mtime:f,ctime:f,birthtime:f}}let o=new Date(0);return s.endsWith(".claude/settings.json")?{mode:420,size:fh.length,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(fh.length/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:o,mtime:o,ctime:o,birthtime:o}:await i.promises.stat(r)},"getStats"),getFile:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n})=>{let s=t.replace(/\\/g,"/");if((s.endsWith(".claude")||s.endsWith(".claude/session_data")||s.endsWith(".claude/session_data/projects")||s.endsWith(".claude/session_data/debug")||/\.claude\/session_data\/projects\/[^/]+$/.test(s))&&await i.promises.mkdir(t,{recursive:!0}),s.endsWith(".claude/settings.json"))return{type:"file",content:fh,mode:420,size:fh.length,oid:"unknown"};try{if((await i.promises.stat(t)).isFile()){let o=await i.promises.readFile(t);return{type:"file",content:o,mode:420,size:o.length,oid:"unknown"}}else{let o=await i.promises.readdir(t,{withFileTypes:!0});if(s.endsWith(".claude")){let f=o.find(a=>a.name.toString()==="settings.json");f||o.push(Lt({name:"settings.json",parent:t,isDir:!1}));let c=o.find(a=>a.name.toString()===Er);f||o.push(Lt({name:Er,parent:t,isDir:!0}))}if(s.endsWith(`.claude/${Er}`)&&(o.find(f=>f.name.toString()==="projects")||o.push(Lt({name:"projects",parent:t,isDir:!0}))),s.endsWith(`.claude/${Er}/projects`)&&!o.find(f=>f.name.toString()==="projects")){let f=s.replace(`.claude/${Er}/projects`,"");o.push(Lt({name:f.replaceAll("/","-"),parent:t,isDir:!0}))}return{type:"directory",content:o.map(f=>({...f,name:f.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{await i.promises.unlink(t)},"unlink"),writeFile:g(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,userSpaceFs:s,pathParams:o,author:f})=>{let c=t.replace(/\\/g,"/"),a=/\/projects\/([^/]+)\/([^/]+\.jsonl)$/,u=c.match(a);if(u){let h=u[1],d=u[2];console.log({folder:h,file:d}),await n.promises.stat(t).then(()=>!0).catch(()=>!1)||await n.promises.writeFile(t,"");let p=(await n.promises.readFile(t,"utf-8")).split(`
110
- `);if(p.length>1){let m=p[p.length-2]||"",w=JSON.parse(m),y="";if(w.type==="user"){let b=w.message?.content;if(Array.isArray(b)&&b[0]?.type==="tool_result"){let _=b[0],F=typeof _.content=="string"?_.content:JSON.stringify(_.content);y=`\u{1F47E} Tool Result (${w.toolUseResult?.type||"unknown"}): ${F}
104
+ `,"utf8");let I=E[E.length-1].split(" ")[1];await w.writeStashRef(I)}else await p.rm(k)})}c(od,"uy"),h(od,"_stashDrop");async function Rw({fs:p,dir:s,gitdir:u}){return new wo({fs:p,dir:s,gitdir:u}).readStashReflogs({parsed:!0})}c(Rw,"Sx"),h(Rw,"_stashList");async function Tw({fs:p,dir:s,gitdir:u}){let d=new wo({fs:p,dir:s,gitdir:u}),w=[d.refStashPath,d.refLogsStashPath];await cn(w,async()=>{await Promise.all(w.map(async _=>{if(await p.exists(_))return p.rm(_)}))})}c(Tw,"Ex"),h(Tw,"_stashClear");async function Ow({fs:p,dir:s,gitdir:u,refIdx:d=0}){await ad({fs:p,dir:s,gitdir:u,refIdx:d}),await od({fs:p,dir:s,gitdir:u,refIdx:d})}c(Ow,"kx"),h(Ow,"_stashPop");async function ld({fs:p,dir:s,gitdir:u=Y(s,".git"),op:d="push",message:w="",refIdx:_=0}){ie("fs",p),ie("dir",s),ie("gitdir",u),ie("op",d);let E={push:Fw,apply:ad,drop:od,list:Rw,clear:Tw,pop:Ow,create:kw},k=["apply","drop","pop"];try{let I=new ct(p);["refs","logs","logs/refs"].map(x=>Y(u,x)).forEach(async x=>{await I.exists(x)||await I.mkdir(x)});let O=E[d];if(O){if(k.includes(d)&&_<0)throw new wi(`stash@${_}`,"number that is in range of [0, num of stash pushed]");return await O({fs:I,dir:s,gitdir:u,message:w,refIdx:_})}throw new Error(`To be implemented: ${d}`)}catch(I){throw I.caller="git.stash",I}}c(ld,"dy"),h(ld,"stash");async function cd({fs:p,dir:s,gitdir:u=Y(s,".git"),filepath:d,cache:w={}}){try{ie("fs",p),ie("gitdir",u),ie("filepath",d);let _=new ct(p);if(await gs.isIgnored({fs:_,gitdir:u,dir:s,filepath:d}))return"ignored";let E=await xw({fs:_,cache:w,gitdir:u}),k=await fd({fs:_,cache:w,gitdir:u,tree:E,path:d}),I=await me.acquire({fs:_,gitdir:u,cache:w},async function(ce){for(let Re of ce)if(Re.path===d)return Re;return null}),O=await _.lstat(Y(s,d)),x=k!==null,L=I!==null,q=O!==null,ae=h(async()=>{if(L&&!le(I,O))return I.oid;{let ce=await _.read(Y(s,d)),Re=await Qu({gitdir:u,type:"blob",object:ce});return L&&I.oid===Re&&O.size!==-1&&me.acquire({fs:_,gitdir:u,cache:w},async function(Be){Be.insert({filepath:d,stats:O,oid:Re})}),Re}},"getWorkdirOid");if(!x&&!q&&!L)return"absent";if(!x&&!q&&L)return"*absent";if(!x&&q&&!L)return"*added";if(!x&&q&&L)return await ae()===I.oid?"added":"*added";if(x&&!q&&!L)return"deleted";if(x&&!q&&L)return I.oid,"*deleted";if(x&&q&&!L)return await ae()===k?"*undeleted":"*undeletemodified";if(x&&q&&L){let ce=await ae();return ce===k?ce===I.oid?"unmodified":"*unmodified":ce===I.oid?"modified":"*modified"}}catch(_){throw _.caller="git.status",_}}c(cd,"hy"),h(cd,"status");async function fd({fs:p,cache:s,gitdir:u,tree:d,path:w}){typeof w=="string"&&(w=w.split("/"));let _=w.shift();for(let E of d)if(E.path===_){if(w.length===0)return E.oid;let{type:k,object:I}=await jt({fs:p,cache:s,gitdir:u,oid:E.oid});if(k==="tree"){let O=Lr.from(I);return fd({fs:p,cache:s,gitdir:u,tree:O,path:w})}if(k==="blob")throw new _e(E.oid,k,"blob",w.join("/"))}return null}c(fd,"py"),h(fd,"getOidAtPath");async function xw({fs:p,cache:s,gitdir:u}){let d;try{d=await ze.resolve({fs:p,gitdir:u,ref:"HEAD"})}catch(_){if(_ instanceof se)return[]}let{tree:w}=await on({fs:p,cache:s,gitdir:u,oid:d});return w}c(xw,"xx"),h(xw,"getHeadTree");async function hd({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d="HEAD",filepaths:w=["."],filter:_,cache:E={},ignored:k=!1}){try{ie("fs",p),ie("gitdir",u),ie("ref",d);let I=new ct(p);return await bi({fs:I,cache:E,dir:s,gitdir:u,trees:[Or({ref:d}),nn(),G()],map:h(async function(O,[x,L,q]){if(!x&&!q&&L&&!k&&await gs.isIgnored({fs:I,dir:s,filepath:O})||!w.some(nt=>Sy(O,nt)))return null;if(_&&!_(O))return;let[ae,ce,Re]=await Promise.all([x&&x.type(),L&&L.type(),q&&q.type()]),Be=[ae,ce,Re].includes("blob");if((ae==="tree"||ae==="special")&&!Be)return;if(ae==="commit")return null;if((ce==="tree"||ce==="special")&&!Be)return;if(Re==="commit")return null;if((Re==="tree"||Re==="special")&&!Be)return;let qe=ae==="blob"?await x.oid():void 0,We=Re==="blob"?await q.oid():void 0,Qe;ae!=="blob"&&ce==="blob"&&Re!=="blob"?Qe="42":ce==="blob"&&(Qe=await L.oid());let at=[void 0,qe,Qe,We],ot=at.map(nt=>at.indexOf(nt));return ot.shift(),[O,...ot]},"map")})}catch(I){throw I.caller="git.statusMatrix",I}}c(hd,"my"),h(hd,"statusMatrix");async function ud({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,object:w,force:_=!1}){try{ie("fs",p),ie("gitdir",u),ie("ref",d);let E=new ct(p);if(d===void 0)throw new Ur("ref");d=d.startsWith("refs/tags/")?d:`refs/tags/${d}`;let k=await ze.resolve({fs:E,gitdir:u,ref:w||"HEAD"});if(!_&&await ze.exists({fs:E,gitdir:u,ref:d}))throw new yi("tag",d);await ze.writeRef({fs:E,gitdir:u,ref:d,value:k})}catch(E){throw E.caller="git.tag",E}}c(ud,"wy"),h(ud,"tag");async function dd({fs:p,dir:s,gitdir:u=Y(s,".git"),cache:d={},filepath:w,oid:_,mode:E,add:k,remove:I,force:O}){try{ie("fs",p),ie("gitdir",u),ie("filepath",w);let x=new ct(p);if(I)return await me.acquire({fs:x,gitdir:u,cache:d},async function(q){if(!O){let ae=await x.lstat(Y(s,w));if(ae){if(ae.isDirectory())throw new ps("directory");return}}q.has({filepath:w})&&q.delete({filepath:w})});let L;if(!_){if(L=await x.lstat(Y(s,w)),!L)throw new se(`file at "${w}" on disk and "remove" not set`);if(L.isDirectory())throw new ps("directory")}return await me.acquire({fs:x,gitdir:u,cache:d},async function(q){if(!k&&!q.has({filepath:w}))throw new se(`file at "${w}" in index and "add" not set`);let ae;if(_)ae={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:E,uid:0,gid:0,size:0};else{ae=L;let ce=ae.isSymbolicLink()?await x.readlink(Y(s,w)):await x.read(Y(s,w));_=await vr({fs:x,gitdir:u,type:"blob",format:"content",object:ce})}return q.insert({filepath:w,oid:_,stats:ae}),_})}catch(x){throw x.caller="git.updateIndex",x}}c(dd,"gy"),h(dd,"updateIndex$1");function pd(){try{return El.version}catch(p){throw p.caller="git.version",p}}c(pd,"yy"),h(pd,"version");async function md({fs:p,dir:s,gitdir:u=Y(s,".git"),trees:d,map:w,reduce:_,iterate:E,cache:k={}}){try{return ie("fs",p),ie("gitdir",u),ie("trees",d),await bi({fs:new ct(p),cache:k,dir:s,gitdir:u,trees:d,map:w,reduce:_,iterate:E})}catch(I){throw I.caller="git.walk",I}}c(md,"by"),h(md,"walk");async function gd({fs:p,dir:s,gitdir:u=Y(s,".git"),blob:d}){try{return ie("fs",p),ie("gitdir",u),ie("blob",d),await vr({fs:new ct(p),gitdir:u,type:"blob",object:d,format:"content"})}catch(w){throw w.caller="git.writeBlob",w}}c(gd,"_y"),h(gd,"writeBlob");async function yd({fs:p,dir:s,gitdir:u=Y(s,".git"),commit:d}){try{return ie("fs",p),ie("gitdir",u),ie("commit",d),await rd({fs:new ct(p),gitdir:u,commit:d})}catch(w){throw w.caller="git.writeCommit",w}}c(yd,"vy"),h(yd,"writeCommit");async function wd({fs:p,dir:s,gitdir:u=Y(s,".git"),type:d,object:w,format:_="parsed",oid:E,encoding:k=void 0}){try{let I=new ct(p);if(_==="parsed"){switch(d){case"commit":w=Wr.from(w).toObject();break;case"tree":w=Lr.from(w).toObject();break;case"blob":w=Buffer.from(w,k);break;case"tag":w=ei.from(w).toObject();break;default:throw new _e(E||"",d,"blob|commit|tag|tree")}_="content"}return E=await vr({fs:I,gitdir:u,type:d,object:w,oid:E,format:_}),E}catch(I){throw I.caller="git.writeObject",I}}c(wd,"Fy"),h(wd,"writeObject");async function bd({fs:p,dir:s,gitdir:u=Y(s,".git"),ref:d,value:w,force:_=!1,symbolic:E=!1}){try{ie("fs",p),ie("gitdir",u),ie("ref",d),ie("value",w);let k=new ct(p);if(!_s(d,!0))throw new wi(d,l.clean(d));if(!_&&await ze.exists({fs:k,gitdir:u,ref:d}))throw new yi("ref",d);E?await ze.writeSymbolicRef({fs:k,gitdir:u,ref:d,value:w}):(w=await ze.resolve({fs:k,gitdir:u,ref:w}),await ze.writeRef({fs:k,gitdir:u,ref:d,value:w}))}catch(k){throw k.caller="git.writeRef",k}}c(bd,"Sy"),h(bd,"writeRef");async function Aw({fs:p,gitdir:s,tag:u}){let d=ei.from(u).toObject();return await vr({fs:p,gitdir:s,type:"tag",object:d,format:"content"})}c(Aw,"Px"),h(Aw,"_writeTag");async function _d({fs:p,dir:s,gitdir:u=Y(s,".git"),tag:d}){try{return ie("fs",p),ie("gitdir",u),ie("tag",d),await Aw({fs:new ct(p),gitdir:u,tag:d})}catch(w){throw w.caller="git.writeTag",w}}c(_d,"Ey"),h(_d,"writeTag");async function vd({fs:p,dir:s,gitdir:u=Y(s,".git"),tree:d}){try{return ie("fs",p),ie("gitdir",u),ie("tree",d),await bs({fs:new ct(p),gitdir:u,tree:d})}catch(w){throw w.caller="git.writeTree",w}}c(vd,"ky"),h(vd,"writeTree");var bS={Errors:Yg,STAGE:G,TREE:Or,WORKDIR:nn,add:Dh,abortMerge:Oh,addNote:jh,addRemote:$h,annotatedTag:Lh,branch:Uh,checkout:wl,clone:Qh,commit:Zh,getConfig:mu,getConfigAll:gu,setConfig:td,currentBranch:eu,deleteBranch:tu,deleteRef:ru,deleteRemote:iu,deleteTag:nu,expandOid:su,expandRef:au,fastForward:fu,fetch:hu,findMergeBase:uu,findRoot:pu,getRemoteInfo:yu,getRemoteInfo2:bu,hashBlob:_u,indexPack:vu,init:Su,isDescendent:Fu,isIgnored:ku,listBranches:Ru,listFiles:Ou,listNotes:xu,listRefs:Au,listRemotes:Pu,listServerRefs:Du,listTags:Nu,log:Bu,merge:ju,packObjects:$u,pull:Lu,push:Uu,readBlob:zu,readCommit:Ol,readNote:Hu,readObject:Gu,readTag:Vu,readTree:Ku,remove:Ju,removeNote:Yu,renameBranch:Xu,resetIndex:Zu,updateIndex:dd,resolveRef:ed,status:cd,statusMatrix:hd,tag:ud,version:pd,walk:md,writeBlob:gd,writeCommit:yd,writeObject:wd,writeRef:bd,writeTag:_d,writeTree:vd,stash:ld};i.Errors=Yg,i.STAGE=G,i.TREE=Or,i.WORKDIR=nn,i.abortMerge=Oh,i.add=Dh,i.addNote=jh,i.addRemote=$h,i.annotatedTag=Lh,i.branch=Uh,i.checkout=wl,i.clone=Qh,i.commit=Zh,i.currentBranch=eu,i.default=bS,i.deleteBranch=tu,i.deleteRef=ru,i.deleteRemote=iu,i.deleteTag=nu,i.expandOid=su,i.expandRef=au,i.fastForward=fu,i.fetch=hu,i.findMergeBase=uu,i.findRoot=pu,i.getConfig=mu,i.getConfigAll=gu,i.getRemoteInfo=yu,i.getRemoteInfo2=bu,i.hashBlob=_u,i.indexPack=vu,i.init=Su,i.isDescendent=Fu,i.isIgnored=ku,i.listBranches=Ru,i.listFiles=Ou,i.listNotes=xu,i.listRefs=Au,i.listRemotes=Pu,i.listServerRefs=Du,i.listTags=Nu,i.log=Bu,i.merge=ju,i.packObjects=$u,i.pull=Lu,i.push=Uu,i.readBlob=zu,i.readCommit=Ol,i.readNote=Hu,i.readObject=Gu,i.readTag=Vu,i.readTree=Ku,i.remove=Ju,i.removeNote=Yu,i.renameBranch=Xu,i.resetIndex=Zu,i.resolveRef=ed,i.setConfig=td,i.stash=ld,i.status=cd,i.statusMatrix=hd,i.tag=ud,i.updateIndex=dd,i.version=pd,i.walk=md,i.writeBlob=gd,i.writeCommit=yd,i.writeObject=wd,i.writeRef=bd,i.writeTag=_d,i.writeTree=vd}),SR=De((i,e)=>{e.exports=function(t,r){var n=[];t.on("data",function(o){n.push(o)}),t.once("end",function(){r&&r(null,Buffer.concat(n)),r=null}),t.once("error",function(o){r&&r(o),r=null})}}),ER=De((i,e)=>{"use strict";var t=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];e.exports=(r,n)=>{if(n._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let o=new Set(Object.keys(r).concat(t)),f={};for(let m of o)m in n||(f[m]={get(){let l=r[m];return typeof l=="function"?l.bind(r):l},set(l){r[m]=l},enumerable:!0,configurable:!1});return Object.defineProperties(n,f),r.once("aborted",()=>{n.destroy(),n.emit("aborted")}),r.once("close",()=>{r.complete&&n.readable?n.once("end",()=>{n.emit("close")}):n.emit("close")}),n}}),FR=De((i,e)=>{"use strict";var{Transform:t,PassThrough:r}=Nt("stream"),n=Nt("zlib"),o=ER();e.exports=f=>{let m=(f.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(m))return f;let l=m==="br";if(l&&typeof n.createBrotliDecompress!="function")return f.destroy(new Error("Brotli is not supported on Node.js < 12")),f;let a=!0,g=new t({transform(S,F,T){a=!1,T(null,S)},flush(S){S()}}),y=new r({autoDestroy:!1,destroy(S,F){f.destroy(),F(S)}}),b=l?n.createBrotliDecompress():n.createUnzip();return b.once("error",S=>{if(a&&!f.readable){y.end();return}y.destroy(S)}),o(f,y),f.pipe(g).pipe(b).pipe(y),y}}),kR=De((i,e)=>{e.exports=t;function t(r,n){if(r&&n)return t(r)(n);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(f){o[f]=r[f]}),o;function o(){for(var f=new Array(arguments.length),m=0;m<f.length;m++)f[m]=arguments[m];var l=r.apply(this,f),a=f[f.length-1];return typeof l=="function"&&l!==a&&Object.keys(a).forEach(function(g){l[g]=a[g]}),l}}c(t,"My"),h(t,"wrappy")}),RR=De((i,e)=>{var t=kR();e.exports=t(r),e.exports.strict=t(n),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:h(function(){return r(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:h(function(){return n(this)},"value"),configurable:!0})});function r(o){var f=h(function(){return f.called?f.value:(f.called=!0,f.value=o.apply(this,arguments))},"f");return f.called=!1,f}c(r,"Qo"),h(r,"once");function n(o){var f=h(function(){if(f.called)throw new Error(f.onceError);return f.called=!0,f.value=o.apply(this,arguments)},"f"),m=o.name||"Function wrapped with `once`";return f.onceError=m+" shouldn't be called more than once",f.called=!1,f}c(n,"Uy"),h(n,"onceStrict")}),TR=De((i,e)=>{e.exports=g;var t=SR(),r=FR(),n=Nt("http"),o=Nt("https"),f=RR(),m=Nt("querystring"),l=Nt("url"),a=h(y=>y!==null&&typeof y=="object"&&typeof y.pipe=="function","isStream");function g(y,b){if(y=Object.assign({maxRedirects:10},typeof y=="string"?{url:y}:y),b=f(b),y.url){let{hostname:$,port:R,protocol:M,auth:C,path:U}=l.parse(y.url);delete y.url,!$&&!R&&!M&&!C?y.path=U:Object.assign(y,{hostname:$,port:R,protocol:M,auth:C,path:U})}let S={"accept-encoding":"gzip, deflate"};y.headers&&Object.keys(y.headers).forEach($=>S[$.toLowerCase()]=y.headers[$]),y.headers=S;let F;y.body?F=y.json&&!a(y.body)?JSON.stringify(y.body):y.body:y.form&&(F=typeof y.form=="string"?y.form:m.stringify(y.form),y.headers["content-type"]="application/x-www-form-urlencoded"),F&&(y.method||(y.method="POST"),a(F)||(y.headers["content-length"]=Buffer.byteLength(F)),y.json&&!y.form&&(y.headers["content-type"]="application/json")),delete y.body,delete y.form,y.json&&(y.headers.accept="application/json"),y.method&&(y.method=y.method.toUpperCase());let T=y.hostname,P=(y.protocol==="https:"?o:n).request(y,$=>{if(y.followRedirects!==!1&&$.statusCode>=300&&$.statusCode<400&&$.headers.location){y.url=$.headers.location,delete y.headers.host,$.resume();let M=l.parse(y.url).hostname;return M!==null&&M!==T&&(delete y.headers.cookie,delete y.headers.authorization),y.method==="POST"&&[301,302].includes($.statusCode)&&(y.method="GET",delete y.headers["content-length"],delete y.headers["content-type"]),y.maxRedirects--===0?b(new Error("too many redirects")):g(y,b)}let R=typeof r=="function"&&y.method!=="HEAD";b(null,R?r($):$)});return P.on("timeout",()=>{P.abort(),b(new Error("Request timed out"))}),P.on("error",b),a(F)?F.on("error",b).pipe(P):P.end(F),P}c(g,"Ti"),h(g,"simpleGet"),g.concat=(y,b)=>g(y,(S,F)=>{if(S)return b(S);t(F,(T,P)=>{if(T)return b(T);if(y.json)try{P=JSON.parse(P.toString())}catch($){return b($,F,P)}b(null,F,P)})}),["get","post","put","patch","head","delete"].forEach(y=>{g[y]=(b,S)=>(typeof b=="string"&&(b={url:b}),g(Object.assign({method:y.toUpperCase()},b),S))})}),Wt=De((i,e)=>{"use strict";var n;var t=(n=class extends Error{constructor(f){if(!Array.isArray(f))throw new TypeError(`Expected input to be an Array, got ${typeof f}`);let m="";for(let l=0;l<f.length;l++)m+=` ${f[l].stack}
105
+ `;super(m),this.name="AggregateError",this.errors=f}},c(n,"ff"),n);h(t,"AggregateError");var r=t;e.exports={AggregateError:r,ArrayIsArray(o){return Array.isArray(o)},ArrayPrototypeIncludes(o,f){return o.includes(f)},ArrayPrototypeIndexOf(o,f){return o.indexOf(f)},ArrayPrototypeJoin(o,f){return o.join(f)},ArrayPrototypeMap(o,f){return o.map(f)},ArrayPrototypePop(o,f){return o.pop(f)},ArrayPrototypePush(o,f){return o.push(f)},ArrayPrototypeSlice(o,f,m){return o.slice(f,m)},Error,FunctionPrototypeCall(o,f,...m){return o.call(f,...m)},FunctionPrototypeSymbolHasInstance(o,f){return Function.prototype[Symbol.hasInstance].call(o,f)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(o,f){return Object.defineProperties(o,f)},ObjectDefineProperty(o,f,m){return Object.defineProperty(o,f,m)},ObjectGetOwnPropertyDescriptor(o,f){return Object.getOwnPropertyDescriptor(o,f)},ObjectKeys(o){return Object.keys(o)},ObjectSetPrototypeOf(o,f){return Object.setPrototypeOf(o,f)},Promise,PromisePrototypeCatch(o,f){return o.catch(f)},PromisePrototypeThen(o,f,m){return o.then(f,m)},PromiseReject(o){return Promise.reject(o)},PromiseResolve(o){return Promise.resolve(o)},ReflectApply:Reflect.apply,RegExpPrototypeTest(o,f){return o.test(f)},SafeSet:Set,String,StringPrototypeSlice(o,f,m){return o.slice(f,m)},StringPrototypeToLowerCase(o){return o.toLowerCase()},StringPrototypeToUpperCase(o){return o.toUpperCase()},StringPrototypeTrim(o){return o.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(o,f,m){return o.set(f,m)},Boolean,Uint8Array}}),b_=De((i,e)=>{"use strict";e.exports={format(t,...r){return t.replace(/%([sdifj])/g,function(...[n,o]){let f=r.shift();return o==="f"?f.toFixed(6):o==="j"?JSON.stringify(f):o==="s"&&typeof f=="object"?`${f.constructor!==Object?f.constructor.name:""} {}`.trim():f.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}}),Rr=De((i,e)=>{"use strict";var M;var{format:t,inspect:r}=b_(),{AggregateError:n}=Wt(),o=globalThis.AggregateError||n,f=Symbol("kIsNodeError"),m=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,a="__node_internal_",g={};function y(C,U){if(!C)throw new g.ERR_INTERNAL_ASSERTION(U)}c(y,"Dr"),h(y,"assert");function b(C){let U="",J=C.length,ne=C[0]==="-"?1:0;for(;J>=ne+4;J-=3)U=`_${C.slice(J-3,J)}${U}`;return`${C.slice(0,J)}${U}`}c(b,"Xy"),h(b,"addNumericalSeparator");function S(C,U,J){if(typeof U=="function")return y(U.length<=J.length,`Code: ${C}; The provided arguments length (${J.length}) does not match the required ones (${U.length}).`),U(...J);let ne=(U.match(/%[dfijoOs]/g)||[]).length;return y(ne===J.length,`Code: ${C}; The provided arguments length (${J.length}) does not match the required ones (${ne}).`),J.length===0?U:t(U,...J)}c(S,"Kx"),h(S,"getMessage");function F(C,U,J){var z;J||(J=Error);let ne=(z=class extends J{constructor(...H){super(S(C,U,H))}toString(){return`${this.name} [${C}]: ${this.message}`}},c(z,"n"),z);h(ne,"NodeError");let oe=ne;Object.defineProperties(oe.prototype,{name:{value:J.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${C}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),oe.prototype.code=C,oe.prototype[f]=!0,g[C]=oe}c(F,"Fe"),h(F,"E");function T(C){let U=a+C.name;return Object.defineProperty(C,"name",{value:U}),C}c(T,"Jy"),h(T,"hideStackFrames");function P(C,U){if(C&&U&&C!==U){if(Array.isArray(U.errors))return U.errors.push(C),U;let J=new o([U,C],U.message);return J.code=U.code,J}return C||U}c(P,"Yx"),h(P,"aggregateTwoErrors");var $=(M=class extends Error{constructor(U="The operation was aborted",J=void 0){if(J!==void 0&&typeof J!="object")throw new g.ERR_INVALID_ARG_TYPE("options","Object",J);super(U,J),this.code="ABORT_ERR",this.name="AbortError"}},c(M,"hf"),M);h($,"AbortError");var R=$;F("ERR_ASSERTION","%s",Error),F("ERR_INVALID_ARG_TYPE",(C,U,J)=>{y(typeof C=="string","'name' must be a string"),Array.isArray(U)||(U=[U]);let ne="The ";C.endsWith(" argument")?ne+=`${C} `:ne+=`"${C}" ${C.includes(".")?"property":"argument"} `,ne+="must be ";let oe=[],z=[],ee=[];for(let j of U)y(typeof j=="string","All expected entries have to be of type string"),m.includes(j)?oe.push(j.toLowerCase()):l.test(j)?z.push(j):(y(j!=="object",'The value "object" should be written as "Object"'),ee.push(j));if(z.length>0){let j=oe.indexOf("object");j!==-1&&(oe.splice(oe,j,1),z.push("Object"))}if(oe.length>0){switch(oe.length){case 1:ne+=`of type ${oe[0]}`;break;case 2:ne+=`one of type ${oe[0]} or ${oe[1]}`;break;default:{let j=oe.pop();ne+=`one of type ${oe.join(", ")}, or ${j}`}}(z.length>0||ee.length>0)&&(ne+=" or ")}if(z.length>0){switch(z.length){case 1:ne+=`an instance of ${z[0]}`;break;case 2:ne+=`an instance of ${z[0]} or ${z[1]}`;break;default:{let j=z.pop();ne+=`an instance of ${z.join(", ")}, or ${j}`}}ee.length>0&&(ne+=" or ")}switch(ee.length){case 0:break;case 1:ee[0].toLowerCase()!==ee[0]&&(ne+="an "),ne+=`${ee[0]}`;break;case 2:ne+=`one of ${ee[0]} or ${ee[1]}`;break;default:{let j=ee.pop();ne+=`one of ${ee.join(", ")}, or ${j}`}}if(J==null)ne+=`. Received ${J}`;else if(typeof J=="function"&&J.name)ne+=`. Received function ${J.name}`;else if(typeof J=="object"){var H;if((H=J.constructor)!==null&&H!==void 0&&H.name)ne+=`. Received an instance of ${J.constructor.name}`;else{let j=r(J,{depth:-1});ne+=`. Received ${j}`}}else{let j=r(J,{colors:!1});j.length>25&&(j=`${j.slice(0,25)}...`),ne+=`. Received type ${typeof J} (${j})`}return ne},TypeError),F("ERR_INVALID_ARG_VALUE",(C,U,J="is invalid")=>{let ne=r(U);return ne.length>128&&(ne=ne.slice(0,128)+"..."),`The ${C.includes(".")?"property":"argument"} '${C}' ${J}. Received ${ne}`},TypeError),F("ERR_INVALID_RETURN_VALUE",(C,U,J)=>{var ne;let oe=J!=null&&(ne=J.constructor)!==null&&ne!==void 0&&ne.name?`instance of ${J.constructor.name}`:`type ${typeof J}`;return`Expected ${C} to be returned from the "${U}" function but got ${oe}.`},TypeError),F("ERR_MISSING_ARGS",(...C)=>{y(C.length>0,"At least one arg needs to be specified");let U,J=C.length;switch(C=(Array.isArray(C)?C:[C]).map(ne=>`"${ne}"`).join(" or "),J){case 1:U+=`The ${C[0]} argument`;break;case 2:U+=`The ${C[0]} and ${C[1]} arguments`;break;default:{let ne=C.pop();U+=`The ${C.join(", ")}, and ${ne} arguments`}break}return`${U} must be specified`},TypeError),F("ERR_OUT_OF_RANGE",(C,U,J)=>{y(U,'Missing "range" argument');let ne;if(Number.isInteger(J)&&Math.abs(J)>2**32)ne=b(String(J));else if(typeof J=="bigint"){ne=String(J);let oe=BigInt(2)**BigInt(32);(J>oe||J<-oe)&&(ne=b(ne)),ne+="n"}else ne=r(J);return`The value of "${C}" is out of range. It must be ${U}. Received ${ne}`},RangeError),F("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),F("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),F("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),F("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),F("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),F("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),F("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),F("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),F("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),F("ERR_STREAM_WRITE_AFTER_END","write after end",Error),F("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:R,aggregateTwoErrors:T(P),hideStackFrames:T,codes:g}}),OR=De((i,e)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=new WeakMap,r=new WeakMap;function n(ee){let H=t.get(ee);return console.assert(H!=null,"'this' is expected an Event object, but got",ee),H}c(n,"ee"),h(n,"pd");function o(ee){if(ee.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",ee.passiveListener);return}ee.event.cancelable&&(ee.canceled=!0,typeof ee.event.preventDefault=="function"&&ee.event.preventDefault())}c(o,"eb"),h(o,"setCancelFlag");function f(ee,H){t.set(this,{eventTarget:ee,event:H,eventPhase:2,currentTarget:ee,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:H.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let j=Object.keys(H);for(let V=0;V<j.length;++V){let X=j[V];X in this||Object.defineProperty(this,X,m(X))}}c(f,"Ai"),h(f,"Event"),f.prototype={get type(){return n(this).event.type},get target(){return n(this).eventTarget},get currentTarget(){return n(this).currentTarget},composedPath(){let ee=n(this).currentTarget;return ee==null?[]:[ee]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return n(this).eventPhase},stopPropagation(){let ee=n(this);ee.stopped=!0,typeof ee.event.stopPropagation=="function"&&ee.event.stopPropagation()},stopImmediatePropagation(){let ee=n(this);ee.stopped=!0,ee.immediateStopped=!0,typeof ee.event.stopImmediatePropagation=="function"&&ee.event.stopImmediatePropagation()},get bubbles(){return!!n(this).event.bubbles},get cancelable(){return!!n(this).event.cancelable},preventDefault(){o(n(this))},get defaultPrevented(){return n(this).canceled},get composed(){return!!n(this).event.composed},get timeStamp(){return n(this).timeStamp},get srcElement(){return n(this).eventTarget},get cancelBubble(){return n(this).stopped},set cancelBubble(ee){if(!ee)return;let H=n(this);H.stopped=!0,typeof H.event.cancelBubble=="boolean"&&(H.event.cancelBubble=!0)},get returnValue(){return!n(this).canceled},set returnValue(ee){ee||o(n(this))},initEvent(){}},Object.defineProperty(f.prototype,"constructor",{value:f,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(f.prototype,window.Event.prototype),r.set(window.Event.prototype,f));function m(ee){return{get(){return n(this).event[ee]},set(H){n(this).event[ee]=H},configurable:!0,enumerable:!0}}c(m,"ob"),h(m,"defineRedirectDescriptor");function l(ee){return{value(){let H=n(this).event;return H[ee].apply(H,arguments)},configurable:!0,enumerable:!0}}c(l,"Xx"),h(l,"defineCallDescriptor");function a(ee,H){let j=Object.keys(H);if(j.length===0)return ee;function V(X,pe){ee.call(this,X,pe)}c(V,"i"),h(V,"CustomEvent"),V.prototype=Object.create(ee.prototype,{constructor:{value:V,configurable:!0,writable:!0}});for(let X=0;X<j.length;++X){let pe=j[X];if(!(pe in ee.prototype)){let we=typeof Object.getOwnPropertyDescriptor(H,pe).value=="function";Object.defineProperty(V.prototype,pe,we?l(pe):m(pe))}}return V}c(a,"Jx"),h(a,"defineWrapper");function g(ee){if(ee==null||ee===Object.prototype)return f;let H=r.get(ee);return H==null&&(H=a(g(Object.getPrototypeOf(ee)),ee),r.set(ee,H)),H}c(g,"sb"),h(g,"getWrapper");function y(ee,H){let j=g(Object.getPrototypeOf(H));return new j(ee,H)}c(y,"Qx"),h(y,"wrapEvent");function b(ee){return n(ee).immediateStopped}c(b,"eP"),h(b,"isStopped");function S(ee,H){n(ee).eventPhase=H}c(S,"tP"),h(S,"setEventPhase");function F(ee,H){n(ee).currentTarget=H}c(F,"rP"),h(F,"setCurrentTarget");function T(ee,H){n(ee).passiveListener=H}c(T,"tb"),h(T,"setPassiveListener");var P=new WeakMap,$=1,R=2,M=3;function C(ee){return ee!==null&&typeof ee=="object"}c(C,"is"),h(C,"isObject");function U(ee){let H=P.get(ee);if(H==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return H}c(U,"Un"),h(U,"getListeners");function J(ee){return{get(){let H=U(this).get(ee);for(;H!=null;){if(H.listenerType===M)return H.listener;H=H.next}return null},set(H){typeof H!="function"&&!C(H)&&(H=null);let j=U(this),V=null,X=j.get(ee);for(;X!=null;)X.listenerType===M?V!==null?V.next=X.next:X.next!==null?j.set(ee,X.next):j.delete(ee):V=X,X=X.next;if(H!==null){let pe={listener:H,listenerType:M,passive:!1,once:!1,next:null};V===null?j.set(ee,pe):V.next=pe}},configurable:!0,enumerable:!0}}c(J,"iP"),h(J,"defineEventAttributeDescriptor");function ne(ee,H){Object.defineProperty(ee,`on${H}`,J(H))}c(ne,"mf"),h(ne,"defineEventAttribute");function oe(ee){function H(){z.call(this)}c(H,"t"),h(H,"CustomEventTarget"),H.prototype=Object.create(z.prototype,{constructor:{value:H,configurable:!0,writable:!0}});for(let j=0;j<ee.length;++j)ne(H.prototype,ee[j]);return H}c(oe,"nb"),h(oe,"defineCustomEventTarget");function z(){if(this instanceof z){P.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return oe(arguments[0]);if(arguments.length>0){let ee=new Array(arguments.length);for(let H=0;H<arguments.length;++H)ee[H]=arguments[H];return oe(ee)}throw new TypeError("Cannot call a class as a function")}c(z,"ct"),h(z,"EventTarget"),z.prototype={addEventListener(ee,H,j){if(H==null)return;if(typeof H!="function"&&!C(H))throw new TypeError("'listener' should be a function or an object.");let V=U(this),X=C(j),pe=(X?j.capture:j)?$:R,we={listener:H,listenerType:pe,passive:X&&!!j.passive,once:X&&!!j.once,next:null},he=V.get(ee);if(he===void 0){V.set(ee,we);return}let Ae=null;for(;he!=null;){if(he.listener===H&&he.listenerType===pe)return;Ae=he,he=he.next}Ae.next=we},removeEventListener(ee,H,j){if(H==null)return;let V=U(this),X=(C(j)?j.capture:j)?$:R,pe=null,we=V.get(ee);for(;we!=null;){if(we.listener===H&&we.listenerType===X){pe!==null?pe.next=we.next:we.next!==null?V.set(ee,we.next):V.delete(ee);return}pe=we,we=we.next}},dispatchEvent(ee){if(ee==null||typeof ee.type!="string")throw new TypeError('"event.type" should be a string.');let H=U(this),j=ee.type,V=H.get(j);if(V==null)return!0;let X=y(this,ee),pe=null;for(;V!=null;){if(V.once?pe!==null?pe.next=V.next:V.next!==null?H.set(j,V.next):H.delete(j):pe=V,T(X,V.passive?V.listener:null),typeof V.listener=="function")try{V.listener.call(this,X)}catch(we){typeof console<"u"&&typeof console.error=="function"&&console.error(we)}else V.listenerType!==M&&typeof V.listener.handleEvent=="function"&&V.listener.handleEvent(X);if(b(X))break;V=V.next}return T(X,null),S(X,0),F(X,null),!X.defaultPrevented}},Object.defineProperty(z.prototype,"constructor",{value:z,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(z.prototype,window.EventTarget.prototype),i.defineEventAttribute=ne,i.EventTarget=z,i.default=z,e.exports=z,e.exports.EventTarget=e.exports.default=z,e.exports.defineEventAttribute=ne}),zo=De((i,e)=>{"use strict";var b,S;Object.defineProperty(i,"__esModule",{value:!0});var t=OR(),r=(b=class extends t.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let T=m.get(this);if(typeof T!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return T}},c(b,"gf"),b);h(r,"AbortSignal");var n=r;t.defineEventAttribute(n.prototype,"abort");function o(){let F=Object.create(n.prototype);return t.EventTarget.call(F),m.set(F,!1),F}c(o,"nP"),h(o,"createAbortSignal");function f(F){m.get(F)===!1&&(m.set(F,!0),F.dispatchEvent({type:"abort"}))}c(f,"aP"),h(f,"abortSignal");var m=new WeakMap;Object.defineProperties(n.prototype,{aborted:{enumerable:!0}}),typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(n.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var l=(S=class{constructor(){g.set(this,o())}get signal(){return y(this)}abort(){f(y(this))}},c(S,"yf"),S);h(l,"AbortController");var a=l,g=new WeakMap;function y(F){let T=g.get(F);if(T==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${F===null?"null":typeof F}`);return T}c(y,"fb"),h(y,"getSignal"),Object.defineProperties(a.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(a.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),i.AbortController=a,i.AbortSignal=n,i.default=a,e.exports=a,e.exports.AbortController=e.exports.default=a,e.exports.AbortSignal=n}),Ar=De((i,e)=>{"use strict";var t=Nt("buffer"),{format:r,inspect:n}=b_(),{codes:{ERR_INVALID_ARG_TYPE:o}}=Rr(),{kResistStopPropagation:f,AggregateError:m,SymbolDispose:l}=Wt(),a=globalThis.AbortSignal||zo().AbortSignal,g=globalThis.AbortController||zo().AbortController,y=Object.getPrototypeOf(async function(){}).constructor,b=globalThis.Blob||t.Blob,S=h(typeof b<"u"?function(P){return P instanceof b}:function(P){return!1},"isBlob"),F=h((P,$)=>{if(P!==void 0&&(P===null||typeof P!="object"||!("aborted"in P)))throw new o($,"AbortSignal",P)},"validateAbortSignal"),T=h((P,$)=>{if(typeof P!="function")throw new o($,"Function",P)},"validateFunction");e.exports={AggregateError:m,kEmptyObject:Object.freeze({}),once(P){let $=!1;return function(...R){$||($=!0,P.apply(this,R))}},createDeferredPromise:h(function(){let P,$;return{promise:new Promise((R,M)=>{P=R,$=M}),resolve:P,reject:$}},"createDeferredPromise"),promisify(P){return new Promise(($,R)=>{P((M,...C)=>M?R(M):$(...C))})},debuglog(){return function(){}},format:r,inspect:n,types:{isAsyncFunction(P){return P instanceof y},isArrayBufferView(P){return ArrayBuffer.isView(P)}},isBlob:S,deprecate(P,$){return P},addAbortListener:Nt("events").addAbortListener||h(function(P,$){if(P===void 0)throw new o("signal","AbortSignal",P);F(P,"signal"),T($,"listener");let R;return P.aborted?queueMicrotask(()=>$()):(P.addEventListener("abort",$,{__proto__:null,once:!0,[f]:!0}),R=h(()=>{P.removeEventListener("abort",$)},"removeEventListener")),{__proto__:null,[l](){var M;(M=R)===null||M===void 0||M()}}},"addAbortListener"),AbortSignalAny:a.any||h(function(P){if(P.length===1)return P[0];let $=new g,R=h(()=>$.abort(),"abort");return P.forEach(M=>{F(M,"signals"),M.addEventListener("abort",R,{once:!0})}),$.signal.addEventListener("abort",()=>{P.forEach(M=>M.removeEventListener("abort",R))},{once:!0}),$.signal},"AbortSignalAny")},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),Ko=De((i,e)=>{"use strict";var{ArrayIsArray:t,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:n,ArrayPrototypeMap:o,NumberIsInteger:f,NumberIsNaN:m,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:a,NumberParseInt:g,ObjectPrototypeHasOwnProperty:y,RegExpPrototypeExec:b,String:S,StringPrototypeToUpperCase:F,StringPrototypeTrim:T}=Wt(),{hideStackFrames:P,codes:{ERR_SOCKET_BAD_PORT:$,ERR_INVALID_ARG_TYPE:R,ERR_INVALID_ARG_VALUE:M,ERR_OUT_OF_RANGE:C,ERR_UNKNOWN_SIGNAL:U}}=Rr(),{normalizeEncoding:J}=Ar(),{isAsyncFunction:ne,isArrayBufferView:oe}=Ar().types,z={};function ee(Q){return Q===(Q|0)}c(ee,"OP"),h(ee,"isInt32");function H(Q){return Q===Q>>>0}c(H,"DP"),h(H,"isUint32");var j=/^[0-7]+$/,V="must be a 32-bit unsigned integer or an octal string";function X(Q,ge,Ie){if(typeof Q>"u"&&(Q=Ie),typeof Q=="string"){if(b(j,Q)===null)throw new M(ge,Q,V);Q=g(Q,8)}return he(Q,ge),Q}c(X,"IP"),h(X,"parseFileMode");var pe=P((Q,ge,Ie=a,xe=l)=>{if(typeof Q!="number")throw new R(ge,"number",Q);if(!f(Q))throw new C(ge,"an integer",Q);if(Q<Ie||Q>xe)throw new C(ge,`>= ${Ie} && <= ${xe}`,Q)}),we=P((Q,ge,Ie=-2147483648,xe=2147483647)=>{if(typeof Q!="number")throw new R(ge,"number",Q);if(!f(Q))throw new C(ge,"an integer",Q);if(Q<Ie||Q>xe)throw new C(ge,`>= ${Ie} && <= ${xe}`,Q)}),he=P((Q,ge,Ie=!1)=>{if(typeof Q!="number")throw new R(ge,"number",Q);if(!f(Q))throw new C(ge,"an integer",Q);let xe=Ie?1:0,Ye=4294967295;if(Q<xe||Q>Ye)throw new C(ge,`>= ${xe} && <= ${Ye}`,Q)});function Ae(Q,ge){if(typeof Q!="string")throw new R(ge,"string",Q)}c(Ae,"Ef"),h(Ae,"validateString");function lt(Q,ge,Ie=void 0,xe){if(typeof Q!="number")throw new R(ge,"number",Q);if(Ie!=null&&Q<Ie||xe!=null&&Q>xe||(Ie!=null||xe!=null)&&m(Q))throw new C(ge,`${Ie!=null?`>= ${Ie}`:""}${Ie!=null&&xe!=null?" && ":""}${xe!=null?`<= ${xe}`:""}`,Q)}c(lt,"$P"),h(lt,"validateNumber");var le=P((Q,ge,Ie)=>{if(!r(Ie,Q)){let xe="must be one of: "+n(o(Ie,Ye=>typeof Ye=="string"?`'${Ye}'`:S(Ye)),", ");throw new M(ge,Q,xe)}});function $e(Q,ge){if(typeof Q!="boolean")throw new R(ge,"boolean",Q)}c($e,"vb"),h($e,"validateBoolean");function K(Q,ge,Ie){return Q==null||!y(Q,ge)?Ie:Q[ge]}c(K,"vf"),h(K,"getOwnPropertyValueOrDefault");var Oe=P((Q,ge,Ie=null)=>{let xe=K(Ie,"allowArray",!1),Ye=K(Ie,"allowFunction",!1);if(!K(Ie,"nullable",!1)&&Q===null||!xe&&t(Q)||typeof Q!="object"&&(!Ye||typeof Q!="function"))throw new R(ge,"Object",Q)}),je=P((Q,ge)=>{if(Q!=null&&typeof Q!="object"&&typeof Q!="function")throw new R(ge,"a dictionary",Q)}),Te=P((Q,ge,Ie=0)=>{if(!t(Q))throw new R(ge,"Array",Q);if(Q.length<Ie){let xe=`must be longer than ${Ie}`;throw new M(ge,Q,xe)}});function Ge(Q,ge){Te(Q,ge);for(let Ie=0;Ie<Q.length;Ie++)Ae(Q[Ie],`${ge}[${Ie}]`)}c(Ge,"HP"),h(Ge,"validateStringArray");function me(Q,ge){Te(Q,ge);for(let Ie=0;Ie<Q.length;Ie++)$e(Q[Ie],`${ge}[${Ie}]`)}c(me,"qP"),h(me,"validateBooleanArray");function Je(Q,ge){Te(Q,ge);for(let Ie=0;Ie<Q.length;Ie++){let xe=Q[Ie],Ye=`${ge}[${Ie}]`;if(xe==null)throw new R(Ye,"AbortSignal",xe);ye(xe,Ye)}}c(Je,"UP"),h(Je,"validateAbortSignalArray");function He(Q,ge="signal"){if(Ae(Q,ge),z[Q]===void 0)throw z[F(Q)]!==void 0?new U(Q+" (signals must use all capital letters)"):new U(Q)}c(He,"zP"),h(He,"validateSignalName");var it=P((Q,ge="buffer")=>{if(!oe(Q))throw new R(ge,["Buffer","TypedArray","DataView"],Q)});function Ke(Q,ge){let Ie=J(ge),xe=Q.length;if(Ie==="hex"&&xe%2!==0)throw new M("encoding",ge,`is invalid for data of length ${xe}`)}c(Ke,"VP"),h(Ke,"validateEncoding");function ve(Q,ge="Port",Ie=!0){if(typeof Q!="number"&&typeof Q!="string"||typeof Q=="string"&&T(Q).length===0||+Q!==+Q>>>0||Q>65535||Q===0&&!Ie)throw new $(ge,Q,Ie);return Q|0}c(ve,"GP"),h(ve,"validatePort");var ye=P((Q,ge)=>{if(Q!==void 0&&(Q===null||typeof Q!="object"||!("aborted"in Q)))throw new R(ge,"AbortSignal",Q)}),Fe=P((Q,ge)=>{if(typeof Q!="function")throw new R(ge,"Function",Q)}),G=P((Q,ge)=>{if(typeof Q!="function"||ne(Q))throw new R(ge,"Function",Q)}),te=P((Q,ge)=>{if(Q!==void 0)throw new R(ge,"undefined",Q)});function se(Q,ge,Ie){if(!r(Ie,Q))throw new R(ge,`('${n(Ie,"|")}')`,Q)}c(se,"XP"),h(se,"validateUnion");var ke=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function _e(Q,ge){if(typeof Q>"u"||!b(ke,Q))throw new M(ge,Q,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}c(_e,"wb"),h(_e,"validateLinkHeaderFormat");function Pe(Q){if(typeof Q=="string")return _e(Q,"hints"),Q;if(t(Q)){let ge=Q.length,Ie="";if(ge===0)return Ie;for(let xe=0;xe<ge;xe++){let Ye=Q[xe];_e(Ye,"hints"),Ie+=Ye,xe!==ge-1&&(Ie+=", ")}return Ie}throw new M("hints",Q,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}c(Pe,"QP"),h(Pe,"validateLinkHeaderValue"),e.exports={isInt32:ee,isUint32:H,parseFileMode:X,validateArray:Te,validateStringArray:Ge,validateBooleanArray:me,validateAbortSignalArray:Je,validateBoolean:$e,validateBuffer:it,validateDictionary:je,validateEncoding:Ke,validateFunction:Fe,validateInt32:we,validateInteger:pe,validateNumber:lt,validateObject:Oe,validateOneOf:le,validatePlainFunction:G,validatePort:ve,validateSignalName:He,validateString:Ae,validateUint32:he,validateUndefined:te,validateUnion:se,validateAbortSignal:ye,validateLinkHeaderValue:Pe}}),Ni=De((i,e)=>{"use strict";var{SymbolAsyncIterator:t,SymbolIterator:r,SymbolFor:n}=Wt(),o=n("nodejs.stream.destroyed"),f=n("nodejs.stream.errored"),m=n("nodejs.stream.readable"),l=n("nodejs.stream.writable"),a=n("nodejs.stream.disturbed"),g=n("nodejs.webstream.isClosedPromise"),y=n("nodejs.webstream.controllerErrorFunction");function b(K,Oe=!1){var je;return!!(K&&typeof K.pipe=="function"&&typeof K.on=="function"&&(!Oe||typeof K.pause=="function"&&typeof K.resume=="function")&&(!K._writableState||((je=K._readableState)===null||je===void 0?void 0:je.readable)!==!1)&&(!K._writableState||K._readableState))}c(b,"os"),h(b,"isReadableNodeStream");function S(K){var Oe;return!!(K&&typeof K.write=="function"&&typeof K.on=="function"&&(!K._readableState||((Oe=K._writableState)===null||Oe===void 0?void 0:Oe.writable)!==!1))}c(S,"ss"),h(S,"isWritableNodeStream");function F(K){return!!(K&&typeof K.pipe=="function"&&K._readableState&&typeof K.on=="function"&&typeof K.write=="function")}c(F,"rT"),h(F,"isDuplexNodeStream");function T(K){return K&&(K._readableState||K._writableState||typeof K.write=="function"&&typeof K.on=="function"||typeof K.pipe=="function"&&typeof K.on=="function")}c(T,"Et"),h(T,"isNodeStream");function P(K){return!!(K&&!T(K)&&typeof K.pipeThrough=="function"&&typeof K.getReader=="function"&&typeof K.cancel=="function")}c(P,"Ab"),h(P,"isReadableStream");function $(K){return!!(K&&!T(K)&&typeof K.getWriter=="function"&&typeof K.abort=="function")}c($,"Ob"),h($,"isWritableStream");function R(K){return!!(K&&!T(K)&&typeof K.readable=="object"&&typeof K.writable=="object")}c(R,"Db"),h(R,"isTransformStream");function M(K){return P(K)||$(K)||R(K)}c(M,"iT"),h(M,"isWebStream");function C(K,Oe){return K==null?!1:Oe===!0?typeof K[t]=="function":Oe===!1?typeof K[r]=="function":typeof K[t]=="function"||typeof K[r]=="function"}c(C,"nT"),h(C,"isIterable");function U(K){if(!T(K))return null;let Oe=K._writableState,je=K._readableState,Te=Oe||je;return!!(K.destroyed||K[o]||Te!=null&&Te.destroyed)}c(U,"ls"),h(U,"isDestroyed");function J(K){if(!S(K))return null;if(K.writableEnded===!0)return!0;let Oe=K._writableState;return Oe!=null&&Oe.errored?!1:typeof Oe?.ended!="boolean"?null:Oe.ended}c(J,"Rb"),h(J,"isWritableEnded");function ne(K,Oe){if(!S(K))return null;if(K.writableFinished===!0)return!0;let je=K._writableState;return je!=null&&je.errored?!1:typeof je?.finished!="boolean"?null:!!(je.finished||Oe===!1&&je.ended===!0&&je.length===0)}c(ne,"aT"),h(ne,"isWritableFinished");function oe(K){if(!b(K))return null;if(K.readableEnded===!0)return!0;let Oe=K._readableState;return!Oe||Oe.errored?!1:typeof Oe?.ended!="boolean"?null:Oe.ended}c(oe,"oT"),h(oe,"isReadableEnded");function z(K,Oe){if(!b(K))return null;let je=K._readableState;return je!=null&&je.errored?!1:typeof je?.endEmitted!="boolean"?null:!!(je.endEmitted||Oe===!1&&je.ended===!0&&je.length===0)}c(z,"Cb"),h(z,"isReadableFinished");function ee(K){return K&&K[m]!=null?K[m]:typeof K?.readable!="boolean"?null:U(K)?!1:b(K)&&K.readable&&!z(K)}c(ee,"Ib"),h(ee,"isReadable");function H(K){return K&&K[l]!=null?K[l]:typeof K?.writable!="boolean"?null:U(K)?!1:S(K)&&K.writable&&!J(K)}c(H,"Bb"),h(H,"isWritable");function j(K,Oe){return T(K)?U(K)?!0:!(Oe?.readable!==!1&&ee(K)||Oe?.writable!==!1&&H(K)):null}c(j,"sT"),h(j,"isFinished");function V(K){var Oe,je;return T(K)?K.writableErrored?K.writableErrored:(Oe=(je=K._writableState)===null||je===void 0?void 0:je.errored)!==null&&Oe!==void 0?Oe:null:null}c(V,"lT"),h(V,"isWritableErrored");function X(K){var Oe,je;return T(K)?K.readableErrored?K.readableErrored:(Oe=(je=K._readableState)===null||je===void 0?void 0:je.errored)!==null&&Oe!==void 0?Oe:null:null}c(X,"cT"),h(X,"isReadableErrored");function pe(K){if(!T(K))return null;if(typeof K.closed=="boolean")return K.closed;let Oe=K._writableState,je=K._readableState;return typeof Oe?.closed=="boolean"||typeof je?.closed=="boolean"?Oe?.closed||je?.closed:typeof K._closed=="boolean"&&we(K)?K._closed:null}c(pe,"fT"),h(pe,"isClosed");function we(K){return typeof K._closed=="boolean"&&typeof K._defaultKeepAlive=="boolean"&&typeof K._removedConnection=="boolean"&&typeof K._removedContLen=="boolean"}c(we,"Nb"),h(we,"isOutgoingMessage");function he(K){return typeof K._sent100=="boolean"&&we(K)}c(he,"$b"),h(he,"isServerResponse");function Ae(K){var Oe;return typeof K._consuming=="boolean"&&typeof K._dumped=="boolean"&&((Oe=K.req)===null||Oe===void 0?void 0:Oe.upgradeOrConnect)===void 0}c(Ae,"uT"),h(Ae,"isServerRequest");function lt(K){if(!T(K))return null;let Oe=K._writableState,je=K._readableState,Te=Oe||je;return!Te&&he(K)||!!(Te&&Te.autoDestroy&&Te.emitClose&&Te.closed===!1)}c(lt,"dT"),h(lt,"willEmitClose");function le(K){var Oe;return!!(K&&((Oe=K[a])!==null&&Oe!==void 0?Oe:K.readableDidRead||K.readableAborted))}c(le,"hT"),h(le,"isDisturbed");function $e(K){var Oe,je,Te,Ge,me,Je,He,it,Ke,ve;return!!(K&&((Oe=(je=(Te=(Ge=(me=(Je=K[f])!==null&&Je!==void 0?Je:K.readableErrored)!==null&&me!==void 0?me:K.writableErrored)!==null&&Ge!==void 0?Ge:(He=K._readableState)===null||He===void 0?void 0:He.errorEmitted)!==null&&Te!==void 0?Te:(it=K._writableState)===null||it===void 0?void 0:it.errorEmitted)!==null&&je!==void 0?je:(Ke=K._readableState)===null||Ke===void 0?void 0:Ke.errored)!==null&&Oe!==void 0?Oe:!((ve=K._writableState)===null||ve===void 0)&&ve.errored))}c($e,"pT"),h($e,"isErrored"),e.exports={isDestroyed:U,kIsDestroyed:o,isDisturbed:le,kIsDisturbed:a,isErrored:$e,kIsErrored:f,isReadable:ee,kIsReadable:m,kIsClosedPromise:g,kControllerErrorFunction:y,kIsWritable:l,isClosed:pe,isDuplexNodeStream:F,isFinished:j,isIterable:C,isReadableNodeStream:b,isReadableStream:P,isReadableEnded:oe,isReadableFinished:z,isReadableErrored:X,isNodeStream:T,isWebStream:M,isWritable:H,isWritableNodeStream:S,isWritableStream:$,isWritableEnded:J,isWritableFinished:ne,isWritableErrored:V,isServerRequest:Ae,isServerResponse:he,willEmitClose:lt,isTransformStream:R}}),Ki=De((i,e)=>{"use strict";var t=Nt("process/"),{AbortError:r,codes:n}=Rr(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_PREMATURE_CLOSE:f}=n,{kEmptyObject:m,once:l}=Ar(),{validateAbortSignal:a,validateFunction:g,validateObject:y,validateBoolean:b}=Ko(),{Promise:S,PromisePrototypeThen:F,SymbolDispose:T}=Wt(),{isClosed:P,isReadable:$,isReadableNodeStream:R,isReadableStream:M,isReadableFinished:C,isReadableErrored:U,isWritable:J,isWritableNodeStream:ne,isWritableStream:oe,isWritableFinished:z,isWritableErrored:ee,isNodeStream:H,willEmitClose:j,kIsClosedPromise:V}=Ni(),X;function pe(le){return le.setHeader&&typeof le.abort=="function"}c(pe,"AT"),h(pe,"isRequest");var we=h(()=>{},"nop");function he(le,$e,K){var Oe,je;if(arguments.length===2?(K=$e,$e=m):$e==null?$e=m:y($e,"options"),g(K,"callback"),a($e.signal,"options.signal"),K=l(K),M(le)||oe(le))return Ae(le,$e,K);if(!H(le))throw new o("stream",["ReadableStream","WritableStream","Stream"],le);let Te=(Oe=$e.readable)!==null&&Oe!==void 0?Oe:R(le),Ge=(je=$e.writable)!==null&&je!==void 0?je:ne(le),me=le._writableState,Je=le._readableState,He=h(()=>{le.writable||ve()},"onlegacyfinish"),it=j(le)&&R(le)===Te&&ne(le)===Ge,Ke=z(le,!1),ve=h(()=>{Ke=!0,le.destroyed&&(it=!1),!(it&&(!le.readable||Te))&&(!Te||ye)&&K.call(le)},"onfinish"),ye=C(le,!1),Fe=h(()=>{ye=!0,le.destroyed&&(it=!1),!(it&&(!le.writable||Ge))&&(!Ge||Ke)&&K.call(le)},"onend"),G=h(Q=>{K.call(le,Q)},"onerror"),te=P(le),se=h(()=>{te=!0;let Q=ee(le)||U(le);if(Q&&typeof Q!="boolean")return K.call(le,Q);if(Te&&!ye&&R(le,!0)&&!C(le,!1))return K.call(le,new f);if(Ge&&!Ke&&!z(le,!1))return K.call(le,new f);K.call(le)},"onclose"),ke=h(()=>{te=!0;let Q=ee(le)||U(le);if(Q&&typeof Q!="boolean")return K.call(le,Q);K.call(le)},"onclosed"),_e=h(()=>{le.req.on("finish",ve)},"onrequest");pe(le)?(le.on("complete",ve),it||le.on("abort",se),le.req?_e():le.on("request",_e)):Ge&&!me&&(le.on("end",He),le.on("close",He)),!it&&typeof le.aborted=="boolean"&&le.on("aborted",se),le.on("end",Fe),le.on("finish",ve),$e.error!==!1&&le.on("error",G),le.on("close",se),te?t.nextTick(se):me!=null&&me.errorEmitted||Je!=null&&Je.errorEmitted?it||t.nextTick(ke):(!Te&&(!it||$(le))&&(Ke||J(le)===!1)||!Ge&&(!it||J(le))&&(ye||$(le)===!1)||Je&&le.req&&le.aborted)&&t.nextTick(ke);let Pe=h(()=>{K=we,le.removeListener("aborted",se),le.removeListener("complete",ve),le.removeListener("abort",se),le.removeListener("request",_e),le.req&&le.req.removeListener("finish",ve),le.removeListener("end",He),le.removeListener("close",He),le.removeListener("finish",ve),le.removeListener("end",Fe),le.removeListener("error",G),le.removeListener("close",se)},"cleanup");if($e.signal&&!te){let Q=h(()=>{let ge=K;Pe(),ge.call(le,new r(void 0,{cause:$e.signal.reason}))},"abort");if($e.signal.aborted)t.nextTick(Q);else{X=X||Ar().addAbortListener;let ge=X($e.signal,Q),Ie=K;K=l((...xe)=>{ge[T](),Ie.apply(le,xe)})}}return Pe}c(he,"Kb"),h(he,"eos");function Ae(le,$e,K){let Oe=!1,je=we;if($e.signal)if(je=h(()=>{Oe=!0,K.call(le,new r(void 0,{cause:$e.signal.reason}))},"abort"),$e.signal.aborted)t.nextTick(je);else{X=X||Ar().addAbortListener;let Ge=X($e.signal,je),me=K;K=l((...Je)=>{Ge[T](),me.apply(le,Je)})}let Te=h((...Ge)=>{Oe||t.nextTick(()=>K.apply(le,Ge))},"resolverFn");return F(le[V].promise,Te,Te),we}c(Ae,"OT"),h(Ae,"eosWeb");function lt(le,$e){var K;let Oe=!1;return $e===null&&($e=m),(K=$e)!==null&&K!==void 0&&K.cleanup&&(b($e.cleanup,"cleanup"),Oe=$e.cleanup),new S((je,Te)=>{let Ge=he(le,$e,me=>{Oe&&Ge(),me?Te(me):je()})})}c(lt,"DT"),h(lt,"finished"),e.exports=he,e.exports.finished=lt}),Xa=De((i,e)=>{"use strict";var t=Nt("process/"),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:n},AbortError:o}=Rr(),{Symbol:f}=Wt(),{kIsDestroyed:m,isDestroyed:l,isFinished:a,isServerRequest:g}=Ni(),y=f("kDestroy"),b=f("kConstruct");function S(j,V,X){j&&(j.stack,V&&!V.errored&&(V.errored=j),X&&!X.errored&&(X.errored=j))}c(S,"e0"),h(S,"checkError");function F(j,V){let X=this._readableState,pe=this._writableState,we=pe||X;return pe!=null&&pe.destroyed||X!=null&&X.destroyed?(typeof V=="function"&&V(),this):(S(j,pe,X),pe&&(pe.destroyed=!0),X&&(X.destroyed=!0),we.constructed?T(this,j,V):this.once(y,function(he){T(this,r(he,j),V)}),this)}c(F,"MT"),h(F,"destroy");function T(j,V,X){let pe=!1;function we(he){if(pe)return;pe=!0;let Ae=j._readableState,lt=j._writableState;S(he,lt,Ae),lt&&(lt.closed=!0),Ae&&(Ae.closed=!0),typeof X=="function"&&X(he),he?t.nextTick(P,j,he):t.nextTick($,j)}c(we,"n"),h(we,"onDestroy");try{j._destroy(V||null,we)}catch(he){we(he)}}c(T,"Yb"),h(T,"_destroy");function P(j,V){R(j,V),$(j)}c(P,"jT"),h(P,"emitErrorCloseNT");function $(j){let V=j._readableState,X=j._writableState;X&&(X.closeEmitted=!0),V&&(V.closeEmitted=!0),(X!=null&&X.emitClose||V!=null&&V.emitClose)&&j.emit("close")}c($,"t0"),h($,"emitCloseNT");function R(j,V){let X=j._readableState,pe=j._writableState;pe!=null&&pe.errorEmitted||X!=null&&X.errorEmitted||(pe&&(pe.errorEmitted=!0),X&&(X.errorEmitted=!0),j.emit("error",V))}c(R,"Cf"),h(R,"emitErrorNT");function M(){let j=this._readableState,V=this._writableState;j&&(j.constructed=!0,j.closed=!1,j.closeEmitted=!1,j.destroyed=!1,j.errored=null,j.errorEmitted=!1,j.reading=!1,j.ended=j.readable===!1,j.endEmitted=j.readable===!1),V&&(V.constructed=!0,V.destroyed=!1,V.closed=!1,V.closeEmitted=!1,V.errored=null,V.errorEmitted=!1,V.finalCalled=!1,V.prefinished=!1,V.ended=V.writable===!1,V.ending=V.writable===!1,V.finished=V.writable===!1)}c(M,"HT"),h(M,"undestroy");function C(j,V,X){let pe=j._readableState,we=j._writableState;if(we!=null&&we.destroyed||pe!=null&&pe.destroyed)return this;pe!=null&&pe.autoDestroy||we!=null&&we.autoDestroy?j.destroy(V):V&&(V.stack,we&&!we.errored&&(we.errored=V),pe&&!pe.errored&&(pe.errored=V),X?t.nextTick(R,j,V):R(j,V))}c(C,"If"),h(C,"errorOrDestroy");function U(j,V){if(typeof j._construct!="function")return;let X=j._readableState,pe=j._writableState;X&&(X.constructed=!1),pe&&(pe.constructed=!1),j.once(b,V),!(j.listenerCount(b)>1)&&t.nextTick(J,j)}c(U,"qT"),h(U,"construct");function J(j){let V=!1;function X(pe){if(V){C(j,pe??new n);return}V=!0;let we=j._readableState,he=j._writableState,Ae=he||we;we&&(we.constructed=!0),he&&(he.constructed=!0),Ae.destroyed?j.emit(y,pe):pe?C(j,pe,!0):t.nextTick(ne,j)}c(X,"r"),h(X,"onConstruct");try{j._construct(pe=>{t.nextTick(X,pe)})}catch(pe){t.nextTick(X,pe)}}c(J,"UT"),h(J,"constructNT");function ne(j){j.emit(b)}c(ne,"zT"),h(ne,"emitConstructNT");function oe(j){return j?.setHeader&&typeof j.abort=="function"}c(oe,"Xb"),h(oe,"isRequest");function z(j){j.emit("close")}c(z,"r0"),h(z,"emitCloseLegacy");function ee(j,V){j.emit("error",V),t.nextTick(z,j)}c(ee,"WT"),h(ee,"emitErrorCloseLegacy");function H(j,V){!j||l(j)||(!V&&!a(j)&&(V=new o),g(j)?(j.socket=null,j.destroy(V)):oe(j)?j.abort():oe(j.req)?j.req.abort():typeof j.destroy=="function"?j.destroy(V):typeof j.close=="function"?j.close():V?t.nextTick(ee,j,V):t.nextTick(z,j),j.destroyed||(j[m]=!0))}c(H,"VT"),h(H,"destroyer"),e.exports={construct:U,destroyer:H,destroy:F,undestroy:M,errorOrDestroy:C}}),am=De((i,e)=>{"use strict";var{ArrayIsArray:t,ObjectSetPrototypeOf:r}=Wt(),{EventEmitter:n}=Nt("events");function o(m){n.call(this,m)}c(o,"fs"),h(o,"Stream"),r(o.prototype,n.prototype),r(o,n),o.prototype.pipe=function(m,l){let a=this;function g($){m.writable&&m.write($)===!1&&a.pause&&a.pause()}c(g,"i"),h(g,"ondata"),a.on("data",g);function y(){a.readable&&a.resume&&a.resume()}c(y,"n"),h(y,"ondrain"),m.on("drain",y),!m._isStdio&&(!l||l.end!==!1)&&(a.on("end",S),a.on("close",F));let b=!1;function S(){b||(b=!0,m.end())}c(S,"s"),h(S,"onend");function F(){b||(b=!0,typeof m.destroy=="function"&&m.destroy())}c(F,"l"),h(F,"onclose");function T($){P(),n.listenerCount(this,"error")===0&&this.emit("error",$)}c(T,"u"),h(T,"onerror"),f(a,"error",T),f(m,"error",T);function P(){a.removeListener("data",g),m.removeListener("drain",y),a.removeListener("end",S),a.removeListener("close",F),a.removeListener("error",T),m.removeListener("error",T),a.removeListener("end",P),a.removeListener("close",P),m.removeListener("close",P)}return c(P,"c"),h(P,"cleanup"),a.on("end",P),a.on("close",P),m.on("close",P),m.emit("pipe",a),m};function f(m,l,a){if(typeof m.prependListener=="function")return m.prependListener(l,a);!m._events||!m._events[l]?m.on(l,a):t(m._events[l])?m._events[l].unshift(a):m._events[l]=[a,m._events[l]]}c(f,"Bf"),h(f,"prependListener"),e.exports={Stream:o,prependListener:f}}),Yc=De((i,e)=>{"use strict";var{SymbolDispose:t}=Wt(),{AbortError:r,codes:n}=Rr(),{isNodeStream:o,isWebStream:f,kControllerErrorFunction:m}=Ni(),l=Ki(),{ERR_INVALID_ARG_TYPE:a}=n,g,y=h((b,S)=>{if(typeof b!="object"||!("aborted"in b))throw new a(S,"AbortSignal",b)},"validateAbortSignal");e.exports.addAbortSignal=h(function(b,S){if(y(b,"signal"),!o(S)&&!f(S))throw new a("stream",["ReadableStream","WritableStream","Stream"],S);return e.exports.addAbortSignalNoValidate(b,S)},"addAbortSignal"),e.exports.addAbortSignalNoValidate=function(b,S){if(typeof b!="object"||!("aborted"in b))return S;let F=o(S)?()=>{S.destroy(new r(void 0,{cause:b.reason}))}:()=>{S[m](new r(void 0,{cause:b.reason}))};if(b.aborted)F();else{g=g||Ar().addAbortListener;let T=g(b,F);l(S,T[t])}return S}}),xR=De((i,e)=>{"use strict";var a;var{StringPrototypeSlice:t,SymbolIterator:r,TypedArrayPrototypeSet:n,Uint8Array:o}=Wt(),{Buffer:f}=Nt("buffer"),{inspect:m}=Ar(),l;e.exports=(l=(a=class{constructor(){this.head=null,this.tail=null,this.length=0}push(y){let b={data:y,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length}unshift(y){let b={data:y,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}shift(){if(this.length===0)return;let y=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,y}clear(){this.head=this.tail=null,this.length=0}join(y){if(this.length===0)return"";let b=this.head,S=""+b.data;for(;(b=b.next)!==null;)S+=y+b.data;return S}concat(y){if(this.length===0)return f.alloc(0);let b=f.allocUnsafe(y>>>0),S=this.head,F=0;for(;S;)n(b,S.data,F),F+=S.data.length,S=S.next;return b}consume(y,b){let S=this.head.data;if(y<S.length){let F=S.slice(0,y);return this.head.data=S.slice(y),F}return y===S.length?this.shift():b?this._getString(y):this._getBuffer(y)}first(){return this.head.data}*[r](){for(let y=this.head;y;y=y.next)yield y.data}_getString(y){let b="",S=this.head,F=0;do{let T=S.data;if(y>T.length)b+=T,y-=T.length;else{y===T.length?(b+=T,++F,S.next?this.head=S.next:this.head=this.tail=null):(b+=t(T,0,y),this.head=S,S.data=t(T,y));break}++F}while((S=S.next)!==null);return this.length-=F,b}_getBuffer(y){let b=f.allocUnsafe(y),S=y,F=this.head,T=0;do{let P=F.data;if(y>P.length)n(b,P,S-y),y-=P.length;else{y===P.length?(n(b,P,S-y),++T,F.next?this.head=F.next:this.head=this.tail=null):(n(b,new o(P.buffer,P.byteOffset,y),S-y),this.head=F,F.data=P.slice(y));break}++T}while((F=F.next)!==null);return this.length-=T,b}[Symbol.for("nodejs.util.inspect.custom")](y,b){return m(this,{...b,depth:0,customInspect:!1})}},c(a,"Ii"),a),h(l,"BufferList"),l)}),Xc=De((i,e)=>{"use strict";var{MathFloor:t,NumberIsInteger:r}=Wt(),{validateInteger:n}=Ko(),{ERR_INVALID_ARG_VALUE:o}=Rr().codes,f=16*1024,m=16;function l(b,S,F){return b.highWaterMark!=null?b.highWaterMark:S?b[F]:null}c(l,"sA"),h(l,"highWaterMarkFrom");function a(b){return b?m:f}c(a,"p0"),h(a,"getDefaultHighWaterMark");function g(b,S){n(S,"value",0),b?m=S:f=S}c(g,"lA"),h(g,"setDefaultHighWaterMark");function y(b,S,F,T){let P=l(S,T,F);if(P!=null){if(!r(P)||P<0){let $=T?`options.${F}`:"options.highWaterMark";throw new o($,P)}return t(P)}return a(b.objectMode)}c(y,"cA"),h(y,"getHighWaterMark"),e.exports={getHighWaterMark:y,getDefaultHighWaterMark:a,setDefaultHighWaterMark:g}}),AR=De(i=>{"use strict";var e=Kc().Buffer,t=e.isEncoding||function(R){switch(R=""+R,R&&R.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(R){if(!R)return"utf8";for(var M;;)switch(R){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return R;default:if(M)return;R=(""+R).toLowerCase(),M=!0}}c(r,"fA"),h(r,"_normalizeEncoding");function n(R){var M=r(R);if(typeof M!="string"&&(e.isEncoding===t||!t(R)))throw new Error("Unknown encoding: "+R);return M||R}c(n,"uA"),h(n,"normalizeEncoding"),i.StringDecoder=o;function o(R){this.encoding=n(R);var M;switch(this.encoding){case"utf16le":this.text=b,this.end=S,M=4;break;case"utf8":this.fillLast=a,M=4;break;case"base64":this.text=F,this.end=T,M=3;break;default:this.write=P,this.end=$;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(M)}c(o,"Yn"),h(o,"StringDecoder"),o.prototype.write=function(R){if(R.length===0)return"";var M,C;if(this.lastNeed){if(M=this.fillLast(R),M===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C<R.length?M?M+this.text(R,C):this.text(R,C):M||""},o.prototype.end=y,o.prototype.text=g,o.prototype.fillLast=function(R){if(this.lastNeed<=R.length)return R.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);R.copy(this.lastChar,this.lastTotal-this.lastNeed,0,R.length),this.lastNeed-=R.length};function f(R){return R<=127?0:R>>5===6?2:R>>4===14?3:R>>3===30?4:R>>6===2?-1:-2}c(f,"Lf"),h(f,"utf8CheckByte");function m(R,M,C){var U=M.length-1;if(U<C)return 0;var J=f(M[U]);return J>=0?(J>0&&(R.lastNeed=J-1),J):--U<C||J===-2?0:(J=f(M[U]),J>=0?(J>0&&(R.lastNeed=J-2),J):--U<C||J===-2?0:(J=f(M[U]),J>=0?(J>0&&(J===2?J=0:R.lastNeed=J-3),J):0))}c(m,"dA"),h(m,"utf8CheckIncomplete");function l(R,M,C){if((M[0]&192)!==128)return R.lastNeed=0,"\uFFFD";if(R.lastNeed>1&&M.length>1){if((M[1]&192)!==128)return R.lastNeed=1,"\uFFFD";if(R.lastNeed>2&&M.length>2&&(M[2]&192)!==128)return R.lastNeed=2,"\uFFFD"}}c(l,"hA"),h(l,"utf8CheckExtraBytes");function a(R){var M=this.lastTotal-this.lastNeed,C=l(this,R,M);if(C!==void 0)return C;if(this.lastNeed<=R.length)return R.copy(this.lastChar,M,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);R.copy(this.lastChar,M,0,R.length),this.lastNeed-=R.length}c(a,"pA"),h(a,"utf8FillLast");function g(R,M){var C=m(this,R,M);if(!this.lastNeed)return R.toString("utf8",M);this.lastTotal=C;var U=R.length-(C-this.lastNeed);return R.copy(this.lastChar,0,U),R.toString("utf8",M,U)}c(g,"mA"),h(g,"utf8Text");function y(R){var M=R&&R.length?this.write(R):"";return this.lastNeed?M+"\uFFFD":M}c(y,"wA"),h(y,"utf8End");function b(R,M){if((R.length-M)%2===0){var C=R.toString("utf16le",M);if(C){var U=C.charCodeAt(C.length-1);if(U>=55296&&U<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=R[R.length-2],this.lastChar[1]=R[R.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=R[R.length-1],R.toString("utf16le",M,R.length-1)}c(b,"gA"),h(b,"utf16Text");function S(R){var M=R&&R.length?this.write(R):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return M+this.lastChar.toString("utf16le",0,C)}return M}c(S,"yA"),h(S,"utf16End");function F(R,M){var C=(R.length-M)%3;return C===0?R.toString("base64",M):(this.lastNeed=3-C,this.lastTotal=3,C===1?this.lastChar[0]=R[R.length-1]:(this.lastChar[0]=R[R.length-2],this.lastChar[1]=R[R.length-1]),R.toString("base64",M,R.length-C))}c(F,"bA"),h(F,"base64Text");function T(R){var M=R&&R.length?this.write(R):"";return this.lastNeed?M+this.lastChar.toString("base64",0,3-this.lastNeed):M}c(T,"_A"),h(T,"base64End");function P(R){return R.toString(this.encoding)}c(P,"vA"),h(P,"simpleWrite");function $(R){return R&&R.length?this.write(R):""}c($,"FA"),h($,"simpleEnd")}),__=De((i,e)=>{"use strict";var t=Nt("process/"),{PromisePrototypeThen:r,SymbolAsyncIterator:n,SymbolIterator:o}=Wt(),{Buffer:f}=Nt("buffer"),{ERR_INVALID_ARG_TYPE:m,ERR_STREAM_NULL_VALUES:l}=Rr().codes;function a(g,y,b){let S;if(typeof y=="string"||y instanceof f)return new g({objectMode:!0,...b,read(){this.push(y),this.push(null)}});let F;if(y&&y[n])F=!0,S=y[n]();else if(y&&y[o])F=!1,S=y[o]();else throw new m("iterable",["Iterable"],y);let T=new g({objectMode:!0,highWaterMark:1,...b}),P=!1;T._read=function(){P||(P=!0,R())},T._destroy=function(M,C){r($(M),()=>t.nextTick(C,M),U=>t.nextTick(C,U||M))};async function $(M){let C=M!=null,U=typeof S.throw=="function";if(C&&U){let{value:J,done:ne}=await S.throw(M);if(await J,ne)return}if(typeof S.return=="function"){let{value:J}=await S.return();await J}}c($,"l"),h($,"close");async function R(){for(;;){try{let{value:M,done:C}=F?await S.next():S.next();if(C)T.push(null);else{let U=M&&typeof M.then=="function"?await M:M;if(U===null)throw P=!1,new l;if(T.push(U))continue;P=!1}}catch(M){T.destroy(M)}break}}return c(R,"u"),h(R,"next"),T}c(a,"PA"),h(a,"from"),e.exports=a}),Qc=De((i,e)=>{"use strict";var t=Nt("process/"),{ArrayPrototypeIndexOf:r,NumberIsInteger:n,NumberIsNaN:o,NumberParseInt:f,ObjectDefineProperties:m,ObjectKeys:l,ObjectSetPrototypeOf:a,Promise:g,SafeSet:y,SymbolAsyncDispose:b,SymbolAsyncIterator:S,Symbol:F}=Wt();e.exports=xe,xe.ReadableState=Ie;var{EventEmitter:T}=Nt("events"),{Stream:P,prependListener:$}=am(),{Buffer:R}=Nt("buffer"),{addAbortSignal:M}=Yc(),C=Ki(),U=Ar().debuglog("stream",D=>{U=D}),J=xR(),ne=Xa(),{getHighWaterMark:oe,getDefaultHighWaterMark:z}=Xc(),{aggregateTwoErrors:ee,codes:{ERR_INVALID_ARG_TYPE:H,ERR_METHOD_NOT_IMPLEMENTED:j,ERR_OUT_OF_RANGE:V,ERR_STREAM_PUSH_AFTER_EOF:X,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:pe},AbortError:we}=Rr(),{validateObject:he}=Ko(),Ae=F("kPaused"),{StringDecoder:lt}=AR(),le=__();a(xe.prototype,P.prototype),a(xe,P);var $e=h(()=>{},"nop"),{errorOrDestroy:K}=ne,Oe=1,je=2,Te=4,Ge=8,me=16,Je=32,He=64,it=128,Ke=256,ve=512,ye=1024,Fe=2048,G=4096,te=8192,se=16384,ke=32768,_e=65536,Pe=1<<17,Q=1<<18;function ge(D){return{enumerable:!1,get(){return(this.state&D)!==0},set(W){W?this.state|=D:this.state&=~D}}}c(ge,"ge"),h(ge,"makeBitMapDescriptor"),m(Ie.prototype,{objectMode:ge(Oe),ended:ge(je),endEmitted:ge(Te),reading:ge(Ge),constructed:ge(me),sync:ge(Je),needReadable:ge(He),emittedReadable:ge(it),readableListening:ge(Ke),resumeScheduled:ge(ve),errorEmitted:ge(ye),emitClose:ge(Fe),autoDestroy:ge(G),destroyed:ge(te),closed:ge(se),closeEmitted:ge(ke),multiAwaitDrain:ge(_e),readingMore:ge(Pe),dataEmitted:ge(Q)});function Ie(D,W,Me){typeof Me!="boolean"&&(Me=W instanceof Di()),this.state=Fe|G|me|Je,D&&D.objectMode&&(this.state|=Oe),Me&&D&&D.readableObjectMode&&(this.state|=Oe),this.highWaterMark=D?oe(this,D,"readableHighWaterMark",Me):z(!1),this.buffer=new J,this.length=0,this.pipes=[],this.flowing=null,this[Ae]=null,D&&D.emitClose===!1&&(this.state&=~Fe),D&&D.autoDestroy===!1&&(this.state&=~G),this.errored=null,this.defaultEncoding=D&&D.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,D&&D.encoding&&(this.decoder=new lt(D.encoding),this.encoding=D.encoding)}c(Ie,"gs"),h(Ie,"ReadableState");function xe(D){if(!(this instanceof xe))return new xe(D);let W=this instanceof Di();this._readableState=new Ie(D,this,W),D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.construct=="function"&&(this._construct=D.construct),D.signal&&!W&&M(D.signal,this)),P.call(this,D),ne.construct(this,()=>{this._readableState.needReadable&&Y(this,this._readableState)})}c(xe,"j"),h(xe,"Readable"),xe.prototype.destroy=ne.destroy,xe.prototype._undestroy=ne.undestroy,xe.prototype._destroy=function(D,W){W(D)},xe.prototype[T.captureRejectionSymbol]=function(D){this.destroy(D)},xe.prototype[b]=function(){let D;return this.destroyed||(D=this.readableEnded?null:new we,this.destroy(D)),new g((W,Me)=>C(this,Le=>Le&&Le!==D?Me(Le):W(null)))},xe.prototype.push=function(D,W){return Ye(this,D,W,!1)},xe.prototype.unshift=function(D,W){return Ye(this,D,W,!0)};function Ye(D,W,Me,Le){U("readableAddChunk",W);let Ue=D._readableState,ut;if(Ue.state&Oe||(typeof W=="string"?(Me=Me||Ue.defaultEncoding,Ue.encoding!==Me&&(Le&&Ue.encoding?W=R.from(W,Me).toString(Ue.encoding):(W=R.from(W,Me),Me=""))):W instanceof R?Me="":P._isUint8Array(W)?(W=P._uint8ArrayToBuffer(W),Me=""):W!=null&&(ut=new H("chunk",["string","Buffer","Uint8Array"],W))),ut)K(D,ut);else if(W===null)Ue.state&=~Ge,St(D,Ue);else if(Ue.state&Oe||W&&W.length>0)if(Le)if(Ue.state&Te)K(D,new pe);else{if(Ue.destroyed||Ue.errored)return!1;kt(D,Ue,W,!0)}else if(Ue.ended)K(D,new X);else{if(Ue.destroyed||Ue.errored)return!1;Ue.state&=~Ge,Ue.decoder&&!Me?(W=Ue.decoder.write(W),Ue.objectMode||W.length!==0?kt(D,Ue,W,!1):Y(D,Ue)):kt(D,Ue,W,!1)}else Le||(Ue.state&=~Ge,Y(D,Ue));return!Ue.ended&&(Ue.length<Ue.highWaterMark||Ue.length===0)}c(Ye,"C0"),h(Ye,"readableAddChunk");function kt(D,W,Me,Le){W.flowing&&W.length===0&&!W.sync&&D.listenerCount("data")>0?(W.state&_e?W.awaitDrainWriters.clear():W.awaitDrainWriters=null,W.dataEmitted=!0,D.emit("data",Me)):(W.length+=W.objectMode?1:Me.length,Le?W.buffer.unshift(Me):W.buffer.push(Me),W.state&He&&Pt(D)),Y(D,W)}c(kt,"Uf"),h(kt,"addChunk"),xe.prototype.isPaused=function(){let D=this._readableState;return D[Ae]===!0||D.flowing===!1},xe.prototype.setEncoding=function(D){let W=new lt(D);this._readableState.decoder=W,this._readableState.encoding=this._readableState.decoder.encoding;let Me=this._readableState.buffer,Le="";for(let Ue of Me)Le+=W.write(Ue);return Me.clear(),Le!==""&&Me.push(Le),this._readableState.length=Le.length,this};var Gt=1073741824;function gt(D){if(D>Gt)throw new V("size","<= 1GiB",D);return D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++,D}c(gt,"sO"),h(gt,"computeNewHighWaterMark");function _t(D,W){return D<=0||W.length===0&&W.ended?0:W.state&Oe?1:o(D)?W.flowing&&W.length?W.buffer.first().length:W.length:D<=W.length?D:W.ended?W.length:0}c(_t,"E0"),h(_t,"howMuchToRead"),xe.prototype.read=function(D){U("read",D),D===void 0?D=NaN:n(D)||(D=f(D,10));let W=this._readableState,Me=D;if(D>W.highWaterMark&&(W.highWaterMark=gt(D)),D!==0&&(W.state&=~it),D===0&&W.needReadable&&((W.highWaterMark!==0?W.length>=W.highWaterMark:W.length>0)||W.ended))return U("read: emitReadable",W.length,W.ended),W.length===0&&W.ended?N(this):Pt(this),null;if(D=_t(D,W),D===0&&W.ended)return W.length===0&&N(this),null;let Le=(W.state&He)!==0;if(U("need readable",Le),(W.length===0||W.length-D<W.highWaterMark)&&(Le=!0,U("length less than watermark",Le)),W.ended||W.reading||W.destroyed||W.errored||!W.constructed)Le=!1,U("reading, ended or constructing",Le);else if(Le){U("do read"),W.state|=Ge|Je,W.length===0&&(W.state|=He);try{this._read(W.highWaterMark)}catch(ut){K(this,ut)}W.state&=~Je,W.reading||(D=_t(Me,W))}let Ue;return D>0?Ue=de(D,W):Ue=null,Ue===null?(W.needReadable=W.length<=W.highWaterMark,D=0):(W.length-=D,W.multiAwaitDrain?W.awaitDrainWriters.clear():W.awaitDrainWriters=null),W.length===0&&(W.ended||(W.needReadable=!0),Me!==D&&W.ended&&N(this)),Ue!==null&&!W.errorEmitted&&!W.closeEmitted&&(W.dataEmitted=!0,this.emit("data",Ue)),Ue};function St(D,W){if(U("onEofChunk"),!W.ended){if(W.decoder){let Me=W.decoder.end();Me&&Me.length&&(W.buffer.push(Me),W.length+=W.objectMode?1:Me.length)}W.ended=!0,W.sync?Pt(D):(W.needReadable=!1,W.emittedReadable=!0,B(D))}}c(St,"lO"),h(St,"onEofChunk");function Pt(D){let W=D._readableState;U("emitReadable",W.needReadable,W.emittedReadable),W.needReadable=!1,W.emittedReadable||(U("emitReadable",W.flowing),W.emittedReadable=!0,t.nextTick(B,D))}c(Pt,"ys"),h(Pt,"emitReadable");function B(D){let W=D._readableState;U("emitReadable_",W.destroyed,W.length,W.ended),!W.destroyed&&!W.errored&&(W.length||W.ended)&&(D.emit("readable"),W.emittedReadable=!1),W.needReadable=!W.flowing&&!W.ended&&W.length<=W.highWaterMark,dt(D)}c(B,"I0"),h(B,"emitReadable_");function Y(D,W){!W.readingMore&&W.constructed&&(W.readingMore=!0,t.nextTick(Ne,D,W))}c(Y,"ws"),h(Y,"maybeReadMore");function Ne(D,W){for(;!W.reading&&!W.ended&&(W.length<W.highWaterMark||W.flowing&&W.length===0);){let Me=W.length;if(U("maybeReadMore read 0"),D.read(0),Me===W.length)break}W.readingMore=!1}c(Ne,"cO"),h(Ne,"maybeReadMore_"),xe.prototype._read=function(D){throw new j("_read()")},xe.prototype.pipe=function(D,W){let Me=this,Le=this._readableState;Le.pipes.length===1&&(Le.multiAwaitDrain||(Le.multiAwaitDrain=!0,Le.awaitDrainWriters=new y(Le.awaitDrainWriters?[Le.awaitDrainWriters]:[]))),Le.pipes.push(D),U("pipe count=%d opts=%j",Le.pipes.length,W);let Ue=(!W||W.end!==!1)&&D!==t.stdout&&D!==t.stderr?vt:Mr;Le.endEmitted?t.nextTick(Ue):Me.once("end",Ue),D.on("unpipe",ut);function ut(oi,$r){U("onunpipe"),oi===Me&&$r&&$r.hasUnpiped===!1&&($r.hasUnpiped=!0,fr())}c(ut,"s"),h(ut,"onunpipe");function vt(){U("onend"),D.end()}c(vt,"l"),h(vt,"onend");let Lt,Zr=!1;function fr(){U("cleanup"),D.removeListener("close",sr),D.removeListener("finish",Qt),Lt&&D.removeListener("drain",Lt),D.removeListener("error",Mt),D.removeListener("unpipe",ut),Me.removeListener("end",vt),Me.removeListener("end",Mr),Me.removeListener("data",ze),Zr=!0,Lt&&Le.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Lt()}c(fr,"f"),h(fr,"cleanup");function Ct(){Zr||(Le.pipes.length===1&&Le.pipes[0]===D?(U("false write response, pause",0),Le.awaitDrainWriters=D,Le.multiAwaitDrain=!1):Le.pipes.length>1&&Le.pipes.includes(D)&&(U("false write response, pause",Le.awaitDrainWriters.size),Le.awaitDrainWriters.add(D)),Me.pause()),Lt||(Lt=et(Me,D),D.on("drain",Lt))}c(Ct,"d"),h(Ct,"pause"),Me.on("data",ze);function ze(oi){U("ondata");let $r=D.write(oi);U("dest.write",$r),$r===!1&&Ct()}c(ze,"h"),h(ze,"ondata");function Mt(oi){if(U("onerror",oi),Mr(),D.removeListener("error",Mt),D.listenerCount("error")===0){let $r=D._writableState||D._readableState;$r&&!$r.errorEmitted?K(D,oi):D.emit("error",oi)}}c(Mt,"p"),h(Mt,"onerror"),$(D,"error",Mt);function sr(){D.removeListener("finish",Qt),Mr()}c(sr,"m"),h(sr,"onclose"),D.once("close",sr);function Qt(){U("onfinish"),D.removeListener("close",sr),Mr()}c(Qt,"w"),h(Qt,"onfinish"),D.once("finish",Qt);function Mr(){U("unpipe"),Me.unpipe(D)}return c(Mr,"y"),h(Mr,"unpipe"),D.emit("pipe",Me),D.writableNeedDrain===!0?Ct():Le.flowing||(U("pipe resume"),Me.resume()),D};function et(D,W){return h(function(){let Me=D._readableState;Me.awaitDrainWriters===W?(U("pipeOnDrain",1),Me.awaitDrainWriters=null):Me.multiAwaitDrain&&(U("pipeOnDrain",Me.awaitDrainWriters.size),Me.awaitDrainWriters.delete(W)),(!Me.awaitDrainWriters||Me.awaitDrainWriters.size===0)&&D.listenerCount("data")&&D.resume()},"pipeOnDrainFunctionResult")}c(et,"fO"),h(et,"pipeOnDrain"),xe.prototype.unpipe=function(D){let W=this._readableState,Me={hasUnpiped:!1};if(W.pipes.length===0)return this;if(!D){let Ue=W.pipes;W.pipes=[],this.pause();for(let ut=0;ut<Ue.length;ut++)Ue[ut].emit("unpipe",this,{hasUnpiped:!1});return this}let Le=r(W.pipes,D);return Le===-1?this:(W.pipes.splice(Le,1),W.pipes.length===0&&this.pause(),D.emit("unpipe",this,Me),this)},xe.prototype.on=function(D,W){let Me=P.prototype.on.call(this,D,W),Le=this._readableState;return D==="data"?(Le.readableListening=this.listenerCount("readable")>0,Le.flowing!==!1&&this.resume()):D==="readable"&&!Le.endEmitted&&!Le.readableListening&&(Le.readableListening=Le.needReadable=!0,Le.flowing=!1,Le.emittedReadable=!1,U("on readable",Le.length,Le.reading),Le.length?Pt(this):Le.reading||t.nextTick(be,this)),Me},xe.prototype.addListener=xe.prototype.on,xe.prototype.removeListener=function(D,W){let Me=P.prototype.removeListener.call(this,D,W);return D==="readable"&&t.nextTick(re,this),Me},xe.prototype.off=xe.prototype.removeListener,xe.prototype.removeAllListeners=function(D){let W=P.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&t.nextTick(re,this),W};function re(D){let W=D._readableState;W.readableListening=D.listenerCount("readable")>0,W.resumeScheduled&&W[Ae]===!1?W.flowing=!0:D.listenerCount("data")>0?D.resume():W.readableListening||(W.flowing=null)}c(re,"B0"),h(re,"updateReadableListening");function be(D){U("readable nexttick read 0"),D.read(0)}c(be,"uO"),h(be,"nReadingNextTick"),xe.prototype.resume=function(){let D=this._readableState;return D.flowing||(U("resume"),D.flowing=!D.readableListening,A(this,D)),D[Ae]=!1,this};function A(D,W){W.resumeScheduled||(W.resumeScheduled=!0,t.nextTick(Ce,D,W))}c(A,"dO"),h(A,"resume");function Ce(D,W){U("resume",W.reading),W.reading||D.read(0),W.resumeScheduled=!1,D.emit("resume"),dt(D),W.flowing&&!W.reading&&D.read(0)}c(Ce,"hO"),h(Ce,"resume_"),xe.prototype.pause=function(){return U("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(U("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Ae]=!0,this};function dt(D){let W=D._readableState;for(U("flow",W.flowing);W.flowing&&D.read()!==null;);}c(dt,"N0"),h(dt,"flow"),xe.prototype.wrap=function(D){let W=!1;D.on("data",Le=>{!this.push(Le)&&D.pause&&(W=!0,D.pause())}),D.on("end",()=>{this.push(null)}),D.on("error",Le=>{K(this,Le)}),D.on("close",()=>{this.destroy()}),D.on("destroy",()=>{this.destroy()}),this._read=()=>{W&&D.resume&&(W=!1,D.resume())};let Me=l(D);for(let Le=1;Le<Me.length;Le++){let Ue=Me[Le];this[Ue]===void 0&&typeof D[Ue]=="function"&&(this[Ue]=D[Ue].bind(D))}return this},xe.prototype[S]=function(){return v(this)},xe.prototype.iterator=function(D){return D!==void 0&&he(D,"options"),v(this,D)};function v(D,W){typeof D.read!="function"&&(D=xe.wrap(D,{objectMode:!0}));let Me=ue(D,W);return Me.stream=D,Me}c(v,"$0"),h(v,"streamToAsyncIterator");async function*ue(D,W){let Me=$e;function Le(vt){this===D?(Me(),Me=$e):Me=vt}c(Le,"i"),h(Le,"next"),D.on("readable",Le);let Ue,ut=C(D,{writable:!1},vt=>{Ue=vt?ee(Ue,vt):null,Me(),Me=$e});try{for(;;){let vt=D.destroyed?null:D.read();if(vt!==null)yield vt;else{if(Ue)throw Ue;if(Ue===null)return;await new g(Le)}}}catch(vt){throw Ue=ee(Ue,vt),Ue}finally{(Ue||W?.destroyOnReturn!==!1)&&(Ue===void 0||D._readableState.autoDestroy)?ne.destroyer(D,null):(D.off("readable",Le),ut())}}c(ue,"pO"),h(ue,"createAsyncIterator"),m(xe.prototype,{readable:{__proto__:null,get(){let D=this._readableState;return!!D&&D.readable!==!1&&!D.destroyed&&!D.errorEmitted&&!D.endEmitted},set(D){this._readableState&&(this._readableState.readable=!!D)}},readableDidRead:{__proto__:null,enumerable:!1,get:h(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:h(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:h(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:h(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:h(function(){return this._readableState.flowing},"get"),set:h(function(D){this._readableState&&(this._readableState.flowing=D)},"set")},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(D){this._readableState&&(this._readableState.destroyed=D)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),m(Ie.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Ae]!==!1},set(D){this[Ae]=!!D}}}),xe._fromList=de;function de(D,W){if(W.length===0)return null;let Me;return W.objectMode?Me=W.buffer.shift():!D||D>=W.length?(W.decoder?Me=W.buffer.join(""):W.buffer.length===1?Me=W.buffer.first():Me=W.buffer.concat(W.length),W.buffer.clear()):Me=W.buffer.consume(D,W.decoder),Me}c(de,"L0"),h(de,"fromList");function N(D){let W=D._readableState;U("endReadable",W.endEmitted),W.endEmitted||(W.ended=!0,t.nextTick(Z,W,D))}c(N,"zf"),h(N,"endReadable");function Z(D,W){if(U("endReadableNT",D.endEmitted,D.length),!D.errored&&!D.closeEmitted&&!D.endEmitted&&D.length===0){if(D.endEmitted=!0,W.emit("end"),W.writable&&W.allowHalfOpen===!1)t.nextTick(fe,W);else if(D.autoDestroy){let Me=W._writableState;(!Me||Me.autoDestroy&&(Me.finished||Me.writable===!1))&&W.destroy()}}}c(Z,"mO"),h(Z,"endReadableNT");function fe(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}c(fe,"wO"),h(fe,"endWritableNT"),xe.from=function(D,W){return le(xe,D,W)};var st;function Xe(){return st===void 0&&(st={}),st}c(Xe,"M0"),h(Xe,"lazyWebStreams"),xe.fromWeb=function(D,W){return Xe().newStreamReadableFromReadableStream(D,W)},xe.toWeb=function(D,W){return Xe().newReadableStreamFromStreamReadable(D,W)},xe.wrap=function(D,W){var Me,Le;return new xe({objectMode:(Me=(Le=D.readableObjectMode)!==null&&Le!==void 0?Le:D.objectMode)!==null&&Me!==void 0?Me:!0,...W,destroy(Ue,ut){ne.destroyer(D,Ue),ut(Ue)}}).wrap(D)}}),om=De((i,e)=>{"use strict";var t=Nt("process/"),{ArrayPrototypeSlice:r,Error:n,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:f,ObjectDefineProperties:m,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:a,Symbol:g,SymbolHasInstance:y}=Wt();e.exports=he,he.WritableState=pe;var{EventEmitter:b}=Nt("events"),S=am().Stream,{Buffer:F}=Nt("buffer"),T=Xa(),{addAbortSignal:P}=Yc(),{getHighWaterMark:$,getDefaultHighWaterMark:R}=Xc(),{ERR_INVALID_ARG_TYPE:M,ERR_METHOD_NOT_IMPLEMENTED:C,ERR_MULTIPLE_CALLBACK:U,ERR_STREAM_CANNOT_PIPE:J,ERR_STREAM_DESTROYED:ne,ERR_STREAM_ALREADY_FINISHED:oe,ERR_STREAM_NULL_VALUES:z,ERR_STREAM_WRITE_AFTER_END:ee,ERR_UNKNOWN_ENCODING:H}=Rr().codes,{errorOrDestroy:j}=T;l(he.prototype,S.prototype),l(he,S);function V(){}c(V,"Xf"),h(V,"nop");var X=g("kOnFinished");function pe(G,te,se){typeof se!="boolean"&&(se=te instanceof Di()),this.objectMode=!!(G&&G.objectMode),se&&(this.objectMode=this.objectMode||!!(G&&G.writableObjectMode)),this.highWaterMark=G?$(this,G,"writableHighWaterMark",se):R(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let ke=!!(G&&G.decodeStrings===!1);this.decodeStrings=!ke,this.defaultEncoding=G&&G.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=K.bind(void 0,te),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,we(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!G||G.emitClose!==!1,this.autoDestroy=!G||G.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[X]=[]}c(pe,"ta"),h(pe,"WritableState");function we(G){G.buffered=[],G.bufferedIndex=0,G.allBuffers=!0,G.allNoop=!0}c(we,"vs"),h(we,"resetBuffer"),pe.prototype.getBuffer=h(function(){return r(this.buffered,this.bufferedIndex)},"getBuffer"),f(pe.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function he(G){let te=this instanceof Di();if(!te&&!o(he,this))return new he(G);this._writableState=new pe(G,this,te),G&&(typeof G.write=="function"&&(this._write=G.write),typeof G.writev=="function"&&(this._writev=G.writev),typeof G.destroy=="function"&&(this._destroy=G.destroy),typeof G.final=="function"&&(this._final=G.final),typeof G.construct=="function"&&(this._construct=G.construct),G.signal&&P(G.signal,this)),S.call(this,G),T.construct(this,()=>{let se=this._writableState;se.writing||Ge(this,se),it(this,se)})}c(he,"oe"),h(he,"Writable"),f(he,y,{__proto__:null,value:h(function(G){return o(this,G)?!0:this!==he?!1:G&&G._writableState instanceof pe},"value")}),he.prototype.pipe=function(){j(this,new J)};function Ae(G,te,se,ke){let _e=G._writableState;if(typeof se=="function")ke=se,se=_e.defaultEncoding;else{if(!se)se=_e.defaultEncoding;else if(se!=="buffer"&&!F.isEncoding(se))throw new H(se);typeof ke!="function"&&(ke=V)}if(te===null)throw new z;if(!_e.objectMode)if(typeof te=="string")_e.decodeStrings!==!1&&(te=F.from(te,se),se="buffer");else if(te instanceof F)se="buffer";else if(S._isUint8Array(te))te=S._uint8ArrayToBuffer(te),se="buffer";else throw new M("chunk",["string","Buffer","Uint8Array"],te);let Pe;return _e.ending?Pe=new ee:_e.destroyed&&(Pe=new ne("write")),Pe?(t.nextTick(ke,Pe),j(G,Pe,!0),Pe):(_e.pendingcb++,lt(G,_e,te,se,ke))}c(Ae,"K0"),h(Ae,"_write"),he.prototype.write=function(G,te,se){return Ae(this,G,te,se)===!0},he.prototype.cork=function(){this._writableState.corked++},he.prototype.uncork=function(){let G=this._writableState;G.corked&&(G.corked--,G.writing||Ge(this,G))},he.prototype.setDefaultEncoding=h(function(G){if(typeof G=="string"&&(G=a(G)),!F.isEncoding(G))throw new H(G);return this._writableState.defaultEncoding=G,this},"setDefaultEncoding");function lt(G,te,se,ke,_e){let Pe=te.objectMode?1:se.length;te.length+=Pe;let Q=te.length<te.highWaterMark;return Q||(te.needDrain=!0),te.writing||te.corked||te.errored||!te.constructed?(te.buffered.push({chunk:se,encoding:ke,callback:_e}),te.allBuffers&&ke!=="buffer"&&(te.allBuffers=!1),te.allNoop&&_e!==V&&(te.allNoop=!1)):(te.writelen=Pe,te.writecb=_e,te.writing=!0,te.sync=!0,G._write(se,ke,te.onwrite),te.sync=!1),Q&&!te.errored&&!te.destroyed}c(lt,"RO"),h(lt,"writeOrBuffer");function le(G,te,se,ke,_e,Pe,Q){te.writelen=ke,te.writecb=Q,te.writing=!0,te.sync=!0,te.destroyed?te.onwrite(new ne("write")):se?G._writev(_e,te.onwrite):G._write(_e,Pe,te.onwrite),te.sync=!1}c(le,"H0"),h(le,"doWrite");function $e(G,te,se,ke){--te.pendingcb,ke(se),Te(te),j(G,se)}c($e,"q0"),h($e,"onwriteError");function K(G,te){let se=G._writableState,ke=se.sync,_e=se.writecb;if(typeof _e!="function"){j(G,new U);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,te?(te.stack,se.errored||(se.errored=te),G._readableState&&!G._readableState.errored&&(G._readableState.errored=te),ke?t.nextTick($e,G,se,te,_e):$e(G,se,te,_e)):(se.buffered.length>se.bufferedIndex&&Ge(G,se),ke?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===_e?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:_e,stream:G,state:se},t.nextTick(Oe,se.afterWriteTickInfo)):je(G,se,1,_e))}c(K,"CO"),h(K,"onwrite");function Oe({stream:G,state:te,count:se,cb:ke}){return te.afterWriteTickInfo=null,je(G,te,se,ke)}c(Oe,"IO"),h(Oe,"afterWriteTick");function je(G,te,se,ke){for(!te.ending&&!G.destroyed&&te.length===0&&te.needDrain&&(te.needDrain=!1,G.emit("drain"));se-- >0;)te.pendingcb--,ke();te.destroyed&&Te(te),it(G,te)}c(je,"Y0"),h(je,"afterWrite");function Te(G){if(G.writing)return;for(let _e=G.bufferedIndex;_e<G.buffered.length;++_e){var te;let{chunk:Pe,callback:Q}=G.buffered[_e],ge=G.objectMode?1:Pe.length;G.length-=ge,Q((te=G.errored)!==null&&te!==void 0?te:new ne("write"))}let se=G[X].splice(0);for(let _e=0;_e<se.length;_e++){var ke;se[_e]((ke=G.errored)!==null&&ke!==void 0?ke:new ne("end"))}we(G)}c(Te,"Jf"),h(Te,"errorBuffer");function Ge(G,te){if(te.corked||te.bufferProcessing||te.destroyed||!te.constructed)return;let{buffered:se,bufferedIndex:ke,objectMode:_e}=te,Pe=se.length-ke;if(!Pe)return;let Q=ke;if(te.bufferProcessing=!0,Pe>1&&G._writev){te.pendingcb-=Pe-1;let ge=te.allNoop?V:xe=>{for(let Ye=Q;Ye<se.length;++Ye)se[Ye].callback(xe)},Ie=te.allNoop&&Q===0?se:r(se,Q);Ie.allBuffers=te.allBuffers,le(G,te,!0,te.length,Ie,"",ge),we(te)}else{do{let{chunk:ge,encoding:Ie,callback:xe}=se[Q];se[Q++]=null;let Ye=_e?1:ge.length;le(G,te,!1,Ye,ge,Ie,xe)}while(Q<se.length&&!te.writing);Q===se.length?we(te):Q>256?(se.splice(0,Q),te.bufferedIndex=0):te.bufferedIndex=Q}te.bufferProcessing=!1}c(Ge,"Qf"),h(Ge,"clearBuffer"),he.prototype._write=function(G,te,se){if(this._writev)this._writev([{chunk:G,encoding:te}],se);else throw new C("_write()")},he.prototype._writev=null,he.prototype.end=function(G,te,se){let ke=this._writableState;typeof G=="function"?(se=G,G=null,te=null):typeof te=="function"&&(se=te,te=null);let _e;if(G!=null){let Pe=Ae(this,G,te);Pe instanceof n&&(_e=Pe)}return ke.corked&&(ke.corked=1,this.uncork()),_e||(!ke.errored&&!ke.ending?(ke.ending=!0,it(this,ke,!0),ke.ended=!0):ke.finished?_e=new oe("end"):ke.destroyed&&(_e=new ne("end"))),typeof se=="function"&&(_e||ke.finished?t.nextTick(se,_e):ke[X].push(se)),this};function me(G){return G.ending&&!G.destroyed&&G.constructed&&G.length===0&&!G.errored&&G.buffered.length===0&&!G.finished&&!G.writing&&!G.errorEmitted&&!G.closeEmitted}c(me,"_s"),h(me,"needFinish");function Je(G,te){let se=!1;function ke(_e){if(se){j(G,_e??U());return}if(se=!0,te.pendingcb--,_e){let Pe=te[X].splice(0);for(let Q=0;Q<Pe.length;Q++)Pe[Q](_e);j(G,_e,te.sync)}else me(te)&&(te.prefinished=!0,G.emit("prefinish"),te.pendingcb++,t.nextTick(Ke,G,te))}c(ke,"i"),h(ke,"onFinish"),te.sync=!0,te.pendingcb++;try{G._final(ke)}catch(_e){ke(_e)}te.sync=!1}c(Je,"BO"),h(Je,"callFinal");function He(G,te){!te.prefinished&&!te.finalCalled&&(typeof G._final=="function"&&!te.destroyed?(te.finalCalled=!0,Je(G,te)):(te.prefinished=!0,G.emit("prefinish")))}c(He,"NO"),h(He,"prefinish");function it(G,te,se){me(te)&&(He(G,te),te.pendingcb===0&&(se?(te.pendingcb++,t.nextTick((ke,_e)=>{me(_e)?Ke(ke,_e):_e.pendingcb--},G,te)):me(te)&&(te.pendingcb++,Ke(G,te))))}c(it,"eu"),h(it,"finishMaybe");function Ke(G,te){te.pendingcb--,te.finished=!0;let se=te[X].splice(0);for(let ke=0;ke<se.length;ke++)se[ke]();if(G.emit("finish"),te.autoDestroy){let ke=G._readableState;(!ke||ke.autoDestroy&&(ke.endEmitted||ke.readable===!1))&&G.destroy()}}c(Ke,"Yf"),h(Ke,"finish"),m(he.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(G){this._writableState&&(this._writableState.destroyed=G)}},writable:{__proto__:null,get(){let G=this._writableState;return!!G&&G.writable!==!1&&!G.destroyed&&!G.errored&&!G.ending&&!G.ended},set(G){this._writableState&&(this._writableState.writable=!!G)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let G=this._writableState;return G?!G.destroyed&&!G.ending&&G.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:h(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var ve=T.destroy;he.prototype.destroy=function(G,te){let se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[X].length)&&t.nextTick(Te,se),ve.call(this,G,te),this},he.prototype._undestroy=T.undestroy,he.prototype._destroy=function(G,te){te(G)},he.prototype[b.captureRejectionSymbol]=function(G){this.destroy(G)};var ye;function Fe(){return ye===void 0&&(ye={}),ye}c(Fe,"X0"),h(Fe,"lazyWebStreams"),he.fromWeb=function(G,te){return Fe().newStreamWritableFromWritableStream(G,te)},he.toWeb=function(G){return Fe().newWritableStreamFromStreamWritable(G)}}),PR=De((i,e)=>{var pe;var t=Nt("process/"),r=Nt("buffer"),{isReadable:n,isWritable:o,isIterable:f,isNodeStream:m,isReadableNodeStream:l,isWritableNodeStream:a,isDuplexNodeStream:g,isReadableStream:y,isWritableStream:b}=Ni(),S=Ki(),{AbortError:F,codes:{ERR_INVALID_ARG_TYPE:T,ERR_INVALID_RETURN_VALUE:P}}=Rr(),{destroyer:$}=Xa(),R=Di(),M=Qc(),C=om(),{createDeferredPromise:U}=Ar(),J=__(),ne=globalThis.Blob||r.Blob,oe=h(typeof ne<"u"?function(we){return we instanceof ne}:function(we){return!1},"isBlob"),z=globalThis.AbortController||zo().AbortController,{FunctionPrototypeCall:ee}=Wt(),H=(pe=class extends R{constructor(he){super(he),he?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),he?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}},c(pe,"ru"),pe);h(H,"Duplexify");var j=H;e.exports=h(c(function we(he,Ae){if(g(he))return he;if(l(he))return X({readable:he});if(a(he))return X({writable:he});if(m(he))return X({writable:!1,readable:!1});if(y(he))return X({readable:M.fromWeb(he)});if(b(he))return X({writable:C.fromWeb(he)});if(typeof he=="function"){let{value:le,write:$e,final:K,destroy:Oe}=V(he);if(f(le))return J(j,le,{objectMode:!0,write:$e,final:K,destroy:Oe});let je=le?.then;if(typeof je=="function"){let Te,Ge=ee(je,le,me=>{if(me!=null)throw new P("nully","body",me)},me=>{$(Te,me)});return Te=new j({objectMode:!0,readable:!1,write:$e,final(me){K(async()=>{try{await Ge,t.nextTick(me,null)}catch(Je){t.nextTick(me,Je)}})},destroy:Oe})}throw new P("Iterable, AsyncIterable or AsyncFunction",Ae,le)}if(oe(he))return we(he.arrayBuffer());if(f(he))return J(j,he,{objectMode:!0,writable:!1});if(y(he?.readable)&&b(he?.writable))return j.fromWeb(he);if(typeof he?.writable=="object"||typeof he?.readable=="object"){let le=he!=null&&he.readable?l(he?.readable)?he?.readable:we(he.readable):void 0,$e=he!=null&&he.writable?a(he?.writable)?he?.writable:we(he.writable):void 0;return X({readable:le,writable:$e})}let lt=he?.then;if(typeof lt=="function"){let le;return ee(lt,he,$e=>{$e!=null&&le.push($e),le.push(null)},$e=>{$(le,$e)}),le=new j({objectMode:!0,writable:!1,read(){}})}throw new T(Ae,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],he)},"e"),"duplexify");function V(we){let{promise:he,resolve:Ae}=U(),lt=new z,le=lt.signal;return{value:we(async function*(){for(;;){let $e=he;he=null;let{chunk:K,done:Oe,cb:je}=await $e;if(t.nextTick(je),Oe)return;if(le.aborted)throw new F(void 0,{cause:le.reason});({promise:he,resolve:Ae}=U()),yield K}}(),{signal:le}),write($e,K,Oe){let je=Ae;Ae=null,je({chunk:$e,done:!1,cb:Oe})},final($e){let K=Ae;Ae=null,K({done:!0,cb:$e})},destroy($e,K){lt.abort(),K($e)}}}c(V,"ZO"),h(V,"fromAsyncGen");function X(we){let he=we.readable&&typeof we.readable.read!="function"?M.wrap(we.readable):we.readable,Ae=we.writable,lt=!!n(he),le=!!o(Ae),$e,K,Oe,je,Te;function Ge(me){let Je=je;je=null,Je?Je(me):me&&Te.destroy(me)}return c(Ge,"f"),h(Ge,"onfinished"),Te=new j({readableObjectMode:!!(he!=null&&he.readableObjectMode),writableObjectMode:!!(Ae!=null&&Ae.writableObjectMode),readable:lt,writable:le}),le&&(S(Ae,me=>{le=!1,me&&$(he,me),Ge(me)}),Te._write=function(me,Je,He){Ae.write(me,Je)?He():$e=He},Te._final=function(me){Ae.end(),K=me},Ae.on("drain",function(){if($e){let me=$e;$e=null,me()}}),Ae.on("finish",function(){if(K){let me=K;K=null,me()}})),lt&&(S(he,me=>{lt=!1,me&&$(he,me),Ge(me)}),he.on("readable",function(){if(Oe){let me=Oe;Oe=null,me()}}),he.on("end",function(){Te.push(null)}),Te._read=function(){for(;;){let me=he.read();if(me===null){Oe=Te._read;return}if(!Te.push(me))return}}),Te._destroy=function(me,Je){!me&&je!==null&&(me=new F),Oe=null,$e=null,K=null,je===null?Je(me):(je=Je,$(Ae,me),$(he,me))},Te}c(X,"ji"),h(X,"_duplexify")}),Di=De((i,e)=>{"use strict";var{ObjectDefineProperties:t,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:n,ObjectSetPrototypeOf:o}=Wt();e.exports=l;var f=Qc(),m=om();o(l.prototype,f.prototype),o(l,f);{let b=n(m.prototype);for(let S=0;S<b.length;S++){let F=b[S];l.prototype[F]||(l.prototype[F]=m.prototype[F])}}function l(b){if(!(this instanceof l))return new l(b);f.call(this,b),m.call(this,b),b?(this.allowHalfOpen=b.allowHalfOpen!==!1,b.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),b.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}c(l,"ut"),h(l,"Duplex"),t(l.prototype,{writable:{__proto__:null,...r(m.prototype,"writable")},writableHighWaterMark:{__proto__:null,...r(m.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...r(m.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...r(m.prototype,"writableBuffer")},writableLength:{__proto__:null,...r(m.prototype,"writableLength")},writableFinished:{__proto__:null,...r(m.prototype,"writableFinished")},writableCorked:{__proto__:null,...r(m.prototype,"writableCorked")},writableEnded:{__proto__:null,...r(m.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...r(m.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(b){this._readableState&&this._writableState&&(this._readableState.destroyed=b,this._writableState.destroyed=b)}}});var a;function g(){return a===void 0&&(a={}),a}c(g,"m_"),h(g,"lazyWebStreams"),l.fromWeb=function(b,S){return g().newStreamDuplexFromReadableWritablePair(b,S)},l.toWeb=function(b){return g().newReadableWritablePairFromDuplex(b)};var y;l.from=function(b){return y||(y=PR()),y(b,"body")}}),v_=De((i,e)=>{"use strict";var{ObjectSetPrototypeOf:t,Symbol:r}=Wt();e.exports=l;var{ERR_METHOD_NOT_IMPLEMENTED:n}=Rr().codes,o=Di(),{getHighWaterMark:f}=Xc();t(l.prototype,o.prototype),t(l,o);var m=r("kCallback");function l(y){if(!(this instanceof l))return new l(y);let b=y?f(this,y,"readableHighWaterMark",!0):null;b===0&&(y={...y,highWaterMark:null,readableHighWaterMark:b,writableHighWaterMark:y.writableHighWaterMark||0}),o.call(this,y),this._readableState.sync=!1,this[m]=null,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",g)}c(l,"jt"),h(l,"Transform");function a(y){typeof this._flush=="function"&&!this.destroyed?this._flush((b,S)=>{if(b){y?y(b):this.destroy(b);return}S!=null&&this.push(S),this.push(null),y&&y()}):(this.push(null),y&&y())}c(a,"ou"),h(a,"final");function g(){this._final!==a&&a.call(this)}c(g,"eD"),h(g,"prefinish"),l.prototype._final=a,l.prototype._transform=function(y,b,S){throw new n("_transform()")},l.prototype._write=function(y,b,S){let F=this._readableState,T=this._writableState,P=F.length;this._transform(y,b,($,R)=>{if($){S($);return}R!=null&&this.push(R),T.ended||P===F.length||F.length<F.highWaterMark?S():this[m]=S})},l.prototype._read=function(){if(this[m]){let y=this[m];this[m]=null,y()}}}),S_=De((i,e)=>{"use strict";var{ObjectSetPrototypeOf:t}=Wt();e.exports=n;var r=v_();t(n.prototype,r.prototype),t(n,r);function n(o){if(!(this instanceof n))return new n(o);r.call(this,o)}c(n,"qi"),h(n,"PassThrough"),n.prototype._transform=function(o,f,m){m(null,o)}}),lm=De((i,e)=>{var t=Nt("process/"),{ArrayIsArray:r,Promise:n,SymbolAsyncIterator:o,SymbolDispose:f}=Wt(),m=Ki(),{once:l}=Ar(),a=Xa(),g=Di(),{aggregateTwoErrors:y,codes:{ERR_INVALID_ARG_TYPE:b,ERR_INVALID_RETURN_VALUE:S,ERR_MISSING_ARGS:F,ERR_STREAM_DESTROYED:T,ERR_STREAM_PREMATURE_CLOSE:P},AbortError:$}=Rr(),{validateFunction:R,validateAbortSignal:M}=Ko(),{isIterable:C,isReadable:U,isReadableNodeStream:J,isNodeStream:ne,isTransformStream:oe,isWebStream:z,isReadableStream:ee,isReadableFinished:H}=Ni(),j=globalThis.AbortController||zo().AbortController,V,X,pe;function we(Te,Ge,me){let Je=!1;Te.on("close",()=>{Je=!0});let He=m(Te,{readable:Ge,writable:me},it=>{Je=!it});return{destroy:h(it=>{Je||(Je=!0,a.destroyer(Te,it||new T("pipe")))},"destroy"),cleanup:He}}c(we,"S_"),h(we,"destroyer");function he(Te){return R(Te[Te.length-1],"streams[stream.length - 1]"),Te.pop()}c(he,"gD"),h(he,"popCallback");function Ae(Te){if(C(Te))return Te;if(J(Te))return lt(Te);throw new b("val",["Readable","Iterable","AsyncIterable"],Te)}c(Ae,"gu"),h(Ae,"makeAsyncIterable");async function*lt(Te){X||(X=Qc()),yield*X.prototype[o].call(Te)}c(lt,"yD"),h(lt,"fromReadable");async function le(Te,Ge,me,{end:Je}){let He,it=null,Ke=h(Fe=>{if(Fe&&(He=Fe),it){let G=it;it=null,G()}},"resume"),ve=h(()=>new n((Fe,G)=>{He?G(He):it=h(()=>{He?G(He):Fe()},"onresolve")}),"wait");Ge.on("drain",Ke);let ye=m(Ge,{readable:!1},Ke);try{Ge.writableNeedDrain&&await ve();for await(let Fe of Te)Ge.write(Fe)||await ve();Je&&(Ge.end(),await ve()),me()}catch(Fe){me(He!==Fe?y(He,Fe):Fe)}finally{ye(),Ge.off("drain",Ke)}}c(le,"Es"),h(le,"pumpToNode");async function $e(Te,Ge,me,{end:Je}){oe(Ge)&&(Ge=Ge.writable);let He=Ge.getWriter();try{for await(let it of Te)await He.ready,He.write(it).catch(()=>{});await He.ready,Je&&await He.close(),me()}catch(it){try{await He.abort(it),me(it)}catch(Ke){me(Ke)}}}c($e,"yu"),h($e,"pumpToWeb");function K(...Te){return Oe(Te,l(he(Te)))}c(K,"bD"),h(K,"pipeline");function Oe(Te,Ge,me){if(Te.length===1&&r(Te[0])&&(Te=Te[0]),Te.length<2)throw new F("streams");let Je=new j,He=Je.signal,it=me?.signal,Ke=[];M(it,"options.signal");function ve(){_e(new $)}c(ve,"l"),h(ve,"abort"),pe=pe||Ar().addAbortListener;let ye;it&&(ye=pe(it,ve));let Fe,G,te=[],se=0;function ke(xe){_e(xe,--se===0)}c(ke,"p"),h(ke,"finish");function _e(xe,Ye){var kt;if(xe&&(!Fe||Fe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(Fe=xe),!(!Fe&&!Ye)){for(;te.length;)te.shift()(Fe);(kt=ye)===null||kt===void 0||kt[f](),Je.abort(),Ye&&(Fe||Ke.forEach(Gt=>Gt()),t.nextTick(Ge,Fe,G))}}c(_e,"m"),h(_e,"finishImpl");let Pe;for(let xe=0;xe<Te.length;xe++){let Ye=Te[xe],kt=xe<Te.length-1,Gt=xe>0,gt=kt||me?.end!==!1,_t=xe===Te.length-1;if(ne(Ye)){let St=c(function(Pt){Pt&&Pt.name!=="AbortError"&&Pt.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ke(Pt)},"v");var Q=St;if(h(St,"onError"),gt){let{destroy:Pt,cleanup:B}=we(Ye,kt,Gt);te.push(Pt),U(Ye)&&_t&&Ke.push(B)}Ye.on("error",St),U(Ye)&&_t&&Ke.push(()=>{Ye.removeListener("error",St)})}if(xe===0)if(typeof Ye=="function"){if(Pe=Ye({signal:He}),!C(Pe))throw new S("Iterable, AsyncIterable or Stream","source",Pe)}else C(Ye)||J(Ye)||oe(Ye)?Pe=Ye:Pe=g.from(Ye);else if(typeof Ye=="function"){if(oe(Pe)){var ge;Pe=Ae((ge=Pe)===null||ge===void 0?void 0:ge.readable)}else Pe=Ae(Pe);if(Pe=Ye(Pe,{signal:He}),kt){if(!C(Pe,!0))throw new S("AsyncIterable",`transform[${xe-1}]`,Pe)}else{var Ie;V||(V=S_());let St=new V({objectMode:!0}),Pt=(Ie=Pe)===null||Ie===void 0?void 0:Ie.then;if(typeof Pt=="function")se++,Pt.call(Pe,Ne=>{G=Ne,Ne!=null&&St.write(Ne),gt&&St.end(),t.nextTick(ke)},Ne=>{St.destroy(Ne),t.nextTick(ke,Ne)});else if(C(Pe,!0))se++,le(Pe,St,ke,{end:gt});else if(ee(Pe)||oe(Pe)){let Ne=Pe.readable||Pe;se++,le(Ne,St,ke,{end:gt})}else throw new S("AsyncIterable or Promise","destination",Pe);Pe=St;let{destroy:B,cleanup:Y}=we(Pe,!1,!0);te.push(B),_t&&Ke.push(Y)}}else if(ne(Ye)){if(J(Pe)){se+=2;let St=je(Pe,Ye,ke,{end:gt});U(Ye)&&_t&&Ke.push(St)}else if(oe(Pe)||ee(Pe)){let St=Pe.readable||Pe;se++,le(St,Ye,ke,{end:gt})}else if(C(Pe))se++,le(Pe,Ye,ke,{end:gt});else throw new b("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Pe);Pe=Ye}else if(z(Ye)){if(J(Pe))se++,$e(Ae(Pe),Ye,ke,{end:gt});else if(ee(Pe)||C(Pe))se++,$e(Pe,Ye,ke,{end:gt});else if(oe(Pe))se++,$e(Pe.readable,Ye,ke,{end:gt});else throw new b("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Pe);Pe=Ye}else Pe=g.from(Ye)}return(He!=null&&He.aborted||it!=null&&it.aborted)&&t.nextTick(ve),Pe}c(Oe,"E_"),h(Oe,"pipelineImpl");function je(Te,Ge,me,{end:Je}){let He=!1;if(Ge.on("close",()=>{He||me(new P)}),Te.pipe(Ge,{end:!1}),Je){let Ke=c(function(){He=!0,Ge.end()},"s");var it=Ke;h(Ke,"endFn"),H(Te)?t.nextTick(Ke):Te.once("end",Ke)}else me();return m(Te,{readable:!0,writable:!1},Ke=>{let ve=Te._readableState;Ke&&Ke.code==="ERR_STREAM_PREMATURE_CLOSE"&&ve&&ve.ended&&!ve.errored&&!ve.errorEmitted?Te.once("end",me).once("error",me):me(Ke)}),m(Ge,{readable:!1,writable:!0},me)}c(je,"_D"),h(je,"pipe"),e.exports={pipelineImpl:Oe,pipeline:K}}),E_=De((i,e)=>{"use strict";var{pipeline:t}=lm(),r=Di(),{destroyer:n}=Xa(),{isNodeStream:o,isReadable:f,isWritable:m,isWebStream:l,isTransformStream:a,isWritableStream:g,isReadableStream:y}=Ni(),{AbortError:b,codes:{ERR_INVALID_ARG_VALUE:S,ERR_MISSING_ARGS:F}}=Rr(),T=Ki();e.exports=h(function(...P){if(P.length===0)throw new F("streams");if(P.length===1)return r.from(P[0]);let $=[...P];if(typeof P[0]=="function"&&(P[0]=r.from(P[0])),typeof P[P.length-1]=="function"){let j=P.length-1;P[j]=r.from(P[j])}for(let j=0;j<P.length;++j)if(!(!o(P[j])&&!l(P[j]))){if(j<P.length-1&&!(f(P[j])||y(P[j])||a(P[j])))throw new S(`streams[${j}]`,$[j],"must be readable");if(j>0&&!(m(P[j])||g(P[j])||a(P[j])))throw new S(`streams[${j}]`,$[j],"must be writable")}let R,M,C,U,J;function ne(j){let V=U;U=null,V?V(j):j?J.destroy(j):!H&&!ee&&J.destroy()}c(ne,"u"),h(ne,"onfinished");let oe=P[0],z=t(P,ne),ee=!!(m(oe)||g(oe)||a(oe)),H=!!(f(z)||y(z)||a(z));if(J=new r({writableObjectMode:!!(oe!=null&&oe.writableObjectMode),readableObjectMode:!!(z!=null&&z.readableObjectMode),writable:ee,readable:H}),ee){if(o(oe))J._write=function(V,X,pe){oe.write(V,X)?pe():R=pe},J._final=function(V){oe.end(),M=V},oe.on("drain",function(){if(R){let V=R;R=null,V()}});else if(l(oe)){let V=(a(oe)?oe.writable:oe).getWriter();J._write=async function(X,pe,we){try{await V.ready,V.write(X).catch(()=>{}),we()}catch(he){we(he)}},J._final=async function(X){try{await V.ready,V.close().catch(()=>{}),M=X}catch(pe){X(pe)}}}let j=a(z)?z.readable:z;T(j,()=>{if(M){let V=M;M=null,V()}})}if(H){if(o(z))z.on("readable",function(){if(C){let j=C;C=null,j()}}),z.on("end",function(){J.push(null)}),J._read=function(){for(;;){let j=z.read();if(j===null){C=J._read;return}if(!J.push(j))return}};else if(l(z)){let j=(a(z)?z.readable:z).getReader();J._read=async function(){for(;;)try{let{value:V,done:X}=await j.read();if(!J.push(V))return;if(X){J.push(null);return}}catch{return}}}}return J._destroy=function(j,V){!j&&U!==null&&(j=new b),C=null,R=null,M=null,U===null?V(j):(U=V,o(z)&&n(z,j))},J},"compose")}),DR=De((i,e)=>{"use strict";var Ke;var t=globalThis.AbortController||zo().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:n,ERR_MISSING_ARGS:o,ERR_OUT_OF_RANGE:f},AbortError:m}=Rr(),{validateAbortSignal:l,validateInteger:a,validateObject:g}=Ko(),y=Wt().Symbol("kWeak"),b=Wt().Symbol("kResistStopPropagation"),{finished:S}=Ki(),F=E_(),{addAbortSignalNoValidate:T}=Yc(),{isWritable:P,isNodeStream:$}=Ni(),{deprecate:R}=Ar(),{ArrayPrototypePush:M,Boolean:C,MathFloor:U,Number:J,NumberIsNaN:ne,Promise:oe,PromiseReject:z,PromiseResolve:ee,PromisePrototypeThen:H,Symbol:j}=Wt(),V=j("kEmpty"),X=j("kEof");function pe(ve,ye){if(ye!=null&&g(ye,"options"),ye?.signal!=null&&l(ye.signal,"options.signal"),$(ve)&&!P(ve))throw new r("stream",ve,"must be writable");let Fe=F(this,ve);return ye!=null&&ye.signal&&T(ye.signal,Fe),Fe}c(pe,"UD"),h(pe,"compose");function we(ve,ye){if(typeof ve!="function")throw new n("fn",["Function","AsyncFunction"],ve);ye!=null&&g(ye,"options"),ye?.signal!=null&&l(ye.signal,"options.signal");let Fe=1;ye?.concurrency!=null&&(Fe=U(ye.concurrency));let G=Fe-1;return ye?.highWaterMark!=null&&(G=U(ye.highWaterMark)),a(Fe,"options.concurrency",1),a(G,"options.highWaterMark",0),G+=Fe,h(async function*(){let te=Ar().AbortSignalAny([ye?.signal].filter(C)),se=this,ke=[],_e={signal:te},Pe,Q,ge=!1,Ie=0;function xe(){ge=!0,Ye()}c(xe,"p"),h(xe,"onCatch");function Ye(){Ie-=1,kt()}c(Ye,"m"),h(Ye,"afterItemProcessed");function kt(){Q&&!ge&&Ie<Fe&&ke.length<G&&(Q(),Q=null)}c(kt,"w"),h(kt,"maybeResume");async function Gt(){try{for await(let gt of se){if(ge)return;if(te.aborted)throw new m;try{if(gt=ve(gt,_e),gt===V)continue;gt=ee(gt)}catch(_t){gt=z(_t)}Ie+=1,H(gt,Ye,xe),ke.push(gt),Pe&&(Pe(),Pe=null),!ge&&(ke.length>=G||Ie>=Fe)&&await new oe(_t=>{Q=_t})}ke.push(X)}catch(gt){let _t=z(gt);H(_t,Ye,xe),ke.push(_t)}finally{ge=!0,Pe&&(Pe(),Pe=null)}}c(Gt,"y"),h(Gt,"pump"),Gt();try{for(;;){for(;ke.length>0;){let gt=await ke[0];if(gt===X)return;if(te.aborted)throw new m;gt!==V&&(yield gt),ke.shift(),kt()}await new oe(gt=>{Pe=gt})}}finally{ge=!0,Q&&(Q(),Q=null)}},"map").call(this)}c(we,"Ds"),h(we,"map");function he(ve=void 0){return ve!=null&&g(ve,"options"),ve?.signal!=null&&l(ve.signal,"options.signal"),h(async function*(){let ye=0;for await(let G of this){var Fe;if(ve!=null&&(Fe=ve.signal)!==null&&Fe!==void 0&&Fe.aborted)throw new m({cause:ve.signal.reason});yield[ye++,G]}},"asIndexedPairs").call(this)}c(he,"zD"),h(he,"asIndexedPairs");async function Ae(ve,ye=void 0){for await(let Fe of K.call(this,ve,ye))return!0;return!1}c(Ae,"M_"),h(Ae,"some");async function lt(ve,ye=void 0){if(typeof ve!="function")throw new n("fn",["Function","AsyncFunction"],ve);return!await Ae.call(this,async(...Fe)=>!await ve(...Fe),ye)}c(lt,"WD"),h(lt,"every");async function le(ve,ye){for await(let Fe of K.call(this,ve,ye))return Fe}c(le,"VD"),h(le,"find");async function $e(ve,ye){if(typeof ve!="function")throw new n("fn",["Function","AsyncFunction"],ve);async function Fe(G,te){return await ve(G,te),V}c(Fe,"r"),h(Fe,"forEachFn");for await(let G of we.call(this,Fe,ye));}c($e,"GD"),h($e,"forEach");function K(ve,ye){if(typeof ve!="function")throw new n("fn",["Function","AsyncFunction"],ve);async function Fe(G,te){return await ve(G,te)?G:V}return c(Fe,"r"),h(Fe,"filterFn"),we.call(this,Fe,ye)}c(K,"Su"),h(K,"filter");var Oe=(Ke=class extends o{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}},c(Ke,"ku"),Ke);h(Oe,"ReduceAwareErrMissingArgs");var je=Oe;async function Te(ve,ye,Fe){var G;if(typeof ve!="function")throw new n("reducer",["Function","AsyncFunction"],ve);Fe!=null&&g(Fe,"options"),Fe?.signal!=null&&l(Fe.signal,"options.signal");let te=arguments.length>1;if(Fe!=null&&(G=Fe.signal)!==null&&G!==void 0&&G.aborted){let Q=new m(void 0,{cause:Fe.signal.reason});throw this.once("error",()=>{}),await S(this.destroy(Q)),Q}let se=new t,ke=se.signal;if(Fe!=null&&Fe.signal){let Q={once:!0,[y]:this,[b]:!0};Fe.signal.addEventListener("abort",()=>se.abort(),Q)}let _e=!1;try{for await(let Q of this){var Pe;if(_e=!0,Fe!=null&&(Pe=Fe.signal)!==null&&Pe!==void 0&&Pe.aborted)throw new m;te?ye=await ve(ye,Q,{signal:ke}):(ye=Q,te=!0)}if(!_e&&!te)throw new je}finally{se.abort()}return ye}c(Te,"ZD"),h(Te,"reduce");async function Ge(ve){ve!=null&&g(ve,"options"),ve?.signal!=null&&l(ve.signal,"options.signal");let ye=[];for await(let G of this){var Fe;if(ve!=null&&(Fe=ve.signal)!==null&&Fe!==void 0&&Fe.aborted)throw new m(void 0,{cause:ve.signal.reason});M(ye,G)}return ye}c(Ge,"KD"),h(Ge,"toArray");function me(ve,ye){let Fe=we.call(this,ve,ye);return h(async function*(){for await(let G of Fe)yield*G},"flatMap").call(this)}c(me,"YD"),h(me,"flatMap");function Je(ve){if(ve=J(ve),ne(ve))return 0;if(ve<0)throw new f("number",">= 0",ve);return ve}c(Je,"j_"),h(Je,"toIntegerOrInfinity");function He(ve,ye=void 0){return ye!=null&&g(ye,"options"),ye?.signal!=null&&l(ye.signal,"options.signal"),ve=Je(ve),h(async function*(){var Fe;if(ye!=null&&(Fe=ye.signal)!==null&&Fe!==void 0&&Fe.aborted)throw new m;for await(let te of this){var G;if(ye!=null&&(G=ye.signal)!==null&&G!==void 0&&G.aborted)throw new m;ve--<=0&&(yield te)}},"drop").call(this)}c(He,"XD"),h(He,"drop");function it(ve,ye=void 0){return ye!=null&&g(ye,"options"),ye?.signal!=null&&l(ye.signal,"options.signal"),ve=Je(ve),h(async function*(){var Fe;if(ye!=null&&(Fe=ye.signal)!==null&&Fe!==void 0&&Fe.aborted)throw new m;for await(let te of this){var G;if(ye!=null&&(G=ye.signal)!==null&&G!==void 0&&G.aborted)throw new m;if(ve-- >0&&(yield te),ve<=0)return}},"take").call(this)}c(it,"JD"),h(it,"take"),e.exports.streamReturningOperators={asIndexedPairs:R(he,"readable.asIndexedPairs will be removed in a future version."),drop:He,filter:K,flatMap:me,map:we,take:it,compose:pe},e.exports.promiseReturningOperators={every:lt,forEach:$e,reduce:Te,toArray:Ge,some:Ae,find:le}}),F_=De((i,e)=>{"use strict";var{ArrayPrototypePop:t,Promise:r}=Wt(),{isIterable:n,isNodeStream:o,isWebStream:f}=Ni(),{pipelineImpl:m}=lm(),{finished:l}=Ki();k_();function a(...g){return new r((y,b)=>{let S,F,T=g[g.length-1];if(T&&typeof T=="object"&&!o(T)&&!n(T)&&!f(T)){let P=t(g);S=P.signal,F=P.end}m(g,(P,$)=>{P?b(P):y($)},{signal:S,end:F})})}c(a,"oR"),h(a,"pipeline"),e.exports={finished:l,pipeline:a}}),k_=De((i,e)=>{"use strict";var{Buffer:t}=Nt("buffer"),{ObjectDefineProperty:r,ObjectKeys:n,ReflectApply:o}=Wt(),{promisify:{custom:f}}=Ar(),{streamReturningOperators:m,promiseReturningOperators:l}=DR(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:a}}=Rr(),g=E_(),{setDefaultHighWaterMark:y,getDefaultHighWaterMark:b}=Xc(),{pipeline:S}=lm(),{destroyer:F}=Xa(),T=Ki(),P=F_(),$=Ni(),R=e.exports=am().Stream;R.isDestroyed=$.isDestroyed,R.isDisturbed=$.isDisturbed,R.isErrored=$.isErrored,R.isReadable=$.isReadable,R.isWritable=$.isWritable,R.Readable=Qc();for(let C of n(m)){let U=c(function(...ne){if(new.target)throw a();return R.Readable.from(o(J,this,ne))},"r");h(U,"fn");let J=m[C];r(U,"name",{__proto__:null,value:J.name}),r(U,"length",{__proto__:null,value:J.length}),r(R.Readable.prototype,C,{__proto__:null,value:U,enumerable:!1,configurable:!0,writable:!0})}for(let C of n(l)){let U=c(function(...ne){if(new.target)throw a();return o(J,this,ne)},"r");h(U,"fn");let J=l[C];r(U,"name",{__proto__:null,value:J.name}),r(U,"length",{__proto__:null,value:J.length}),r(R.Readable.prototype,C,{__proto__:null,value:U,enumerable:!1,configurable:!0,writable:!0})}R.Writable=om(),R.Duplex=Di(),R.Transform=v_(),R.PassThrough=S_(),R.pipeline=S;var{addAbortSignal:M}=Yc();R.addAbortSignal=M,R.finished=T,R.destroy=F,R.compose=g,R.setDefaultHighWaterMark=y,R.getDefaultHighWaterMark=b,r(R,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return P}}),r(S,f,{__proto__:null,enumerable:!0,get(){return P.pipeline}}),r(T,f,{__proto__:null,enumerable:!0,get(){return P.finished}}),R.Stream=R,R._isUint8Array=h(function(C){return C instanceof Uint8Array},"isUint8Array"),R._uint8ArrayToBuffer=h(function(C){return t.from(C.buffer,C.byteOffset,C.byteLength)},"_uint8ArrayToBuffer")}),NR=De((i,e)=>{"use strict";var t=Nt("stream");if(t&&process.env.READABLE_STREAM==="disable"){let r=t.promises;e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return r}}),e.exports.Stream=t.Stream}else{let r=k_(),n=F_(),o=r.Readable.destroy;e.exports=r.Readable,e.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,e.exports._isUint8Array=r._isUint8Array,e.exports.isDisturbed=r.isDisturbed,e.exports.isErrored=r.isErrored,e.exports.isReadable=r.isReadable,e.exports.Readable=r.Readable,e.exports.Writable=r.Writable,e.exports.Duplex=r.Duplex,e.exports.Transform=r.Transform,e.exports.PassThrough=r.PassThrough,e.exports.addAbortSignal=r.addAbortSignal,e.exports.finished=r.finished,e.exports.destroy=r.destroy,e.exports.destroy=o,e.exports.pipeline=r.pipeline,e.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get(){return n}}),e.exports.Stream=r.Stream}e.exports.default=e.exports}),Ua,R_=(Ua=class{constructor(e,t){mt(this,"entries",[]),mt(this,"currentIndex",0),mt(this,"closed",!1),mt(this,"compositFs"),mt(this,"dirPath"),mt(this,"initialized",!1),this.compositFs=e,this.dirPath=t}async initialize(){if(this.initialized)return;let e=new Set;for(let t of[...this.compositFs.subFilesystems].reverse()){let r=await t.readdir(this.dirPath);for(let n of r)e.add(n)}for(let t of Array.from(e)){let r=this.dirPath+"/"+t;await this.compositFs.hiddenFilesFileSystem?.responsible(r)||this.entries.push({name:t,path:r})}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let t=await this.compositFs.stat(e.path);yield{name:e.name,isFile:h(()=>t.isFile(),"isFile"),isDirectory:h(()=>t.isDirectory(),"isDirectory"),isBlockDevice:h(()=>t.isBlockDevice(),"isBlockDevice"),isCharacterDevice:h(()=>t.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:h(()=>t.isSymbolicLink(),"isSymbolicLink"),isFIFO:h(()=>t.isFIFO(),"isFIFO"),isSocket:h(()=>t.isSocket(),"isSocket")}}catch(t){console.debug(`Failed to stat ${e.path}:`,t)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let t=await this.compositFs.stat(e.path);return{name:e.name,isFile:h(()=>t.isFile(),"isFile"),isDirectory:h(()=>t.isDirectory(),"isDirectory"),isBlockDevice:h(()=>t.isBlockDevice(),"isBlockDevice"),isCharacterDevice:h(()=>t.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:h(()=>t.isSymbolicLink(),"isSymbolicLink"),isFIFO:h(()=>t.isFIFO(),"isFIFO"),isSocket:h(()=>t.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},c(Ua,"Ws"),Ua);h(R_,"CompositeFsDir");var T_=R_,Wa,O_=(Wa=class{constructor(e){mt(this,"delegate"),mt(this,"compositeFs"),mt(this,"_subFsFileDescriptor"),mt(this,"handleType","file"),mt(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let t=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:t}),await this.delegate.appendFile(this,e,t)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:t}),this.delegate.fchown(this,e,t)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,t,r,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:t,length:r,position:n}),await this.delegate.read(this,e,t,r,n)}async readv(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:t}),this.delegate.readv(this,e,t)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:t}),this.delegate.futimes(this,e,t)}async write(e,t,r,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:t,length:r,position:n}),this.delegate.write(this,e,t,r,n)}async writev(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:t}),this.delegate.writev(this,e,t)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},c(Wa,"Vs"),Wa);h(O_,"CompositFsFileHandle");var Zc=O_,qa,A_=(qa=class{constructor({name:e,parentFs:t,gitRoot:r}){mt(this,"compositFs"),mt(this,"gitRoot"),mt(this,"name"),this.name=e,this.compositFs=t,this.gitRoot=r}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,t,r){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,t){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,t){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,t){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,t){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,t){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,t){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,t){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...t){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,t){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...t){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,t,r){throw new Error(`symlink not implemented for: ${this.toStr(t)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,t,r,n,o){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,t,r){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,t){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,t,r){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,t){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,t,r,n,o){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,t,r){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,t,r){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,t){throw new Error(`readFile not implemented for: ${this.toStr(e)}`)}async writeFile(e,t,r){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},c(qa,"Gs"),qa);h(A_,"BaseCompositeSubFs");var Jo=A_,za,P_=(za=class extends Jo{constructor({name:e,parentFs:t,gitRoot:r,passThroughFs:n}){super({name:e,parentFs:t,gitRoot:r}),mt(this,"openFh",new Map),mt(this,"memFs",(0,ef.createFsFromVolume)(new ef.Volume)),mt(this,"targetFs"),this.compositFs=t,this.gitRoot=r,this.targetFs=n}async responsible(e){return!0}fileType(){return 4}async open(e,t,r){let n=x_.dirname(e),o=await this.targetFs.promises.open(e,t,r);return this.openFh.set(o.fd,o),new Zc({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[]})}async access(e,t){return await this.targetFs.promises.access(e,t)}async stat(e,...t){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,...t){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,t){let r=await this.targetFs.promises.opendir(e,t);return new T_(this.compositFs,e.toString())}async link(e,t){return await this.targetFs.promises.link(e,t)}async mkdir(e,t){await this.targetFs.promises.mkdir(e,t)}async readdir(e,...t){return this.targetFs.promises.readdir(e,...t)}async readlink(e,...t){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,t){return await this.targetFs.promises.rename(e,t)}async rmdir(e,t){return await this.targetFs.promises.rmdir(e,t)}async symlink(e,t,r){return await this.targetFs.promises.symlink(e,t,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(this.openFh.delete(e.subFsFileDescriptor),await t.close())}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.sync()}async read(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.read(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(t,r)}async write(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.write(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(t,r)}async writev(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){return this.targetFs.promises.readFile(e,t)}async writeFile(e,t,r){return this.targetFs.promises.writeFile(e,t,r)}},c(za,"Zs"),za);h(P_,"PassThroughToAsyncFsSubFs");var CR=P_,Ha,D_=(Ha=class{constructor({name:e,storageFs:t,gitRoot:r,defaultBranch:n="main"}){mt(this,"promises"),mt(this,"gitRoot"),mt(this,"ephemeralFilesFileSystem"),mt(this,"hiddenFilesFileSystem"),mt(this,"passThroughFileSystem"),mt(this,"subFilesystems",[]),mt(this,"parentFs"),mt(this,"name"),mt(this,"defaultBranch"),mt(this,"gitCache"),mt(this,"pathToFileDescriptors",new Map),mt(this,"openFileHandles",new Map),mt(this,"logOperation"),this.name=e,this.gitRoot=r,this.defaultBranch=n,this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)},this.passThroughFileSystem=new CR({name:e+"-passthrough",passThroughFs:t,gitRoot:r,parentFs:this})}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,t,r){if(!this.logOperation)return;let n=[];for(let[o,f]of this.pathToFileDescriptors.entries())f.includes(e.fd)&&n.push(o);if(n.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:n[0],operation:t,operationArgs:r})}getFilehandle(e){return this.openFileHandles.get(e)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let t of this.subFilesystems)if(await t.responsible(e.toString()))return t;return this.passThroughFileSystem}async access(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e,operation:"access",operationArgs:{mode:t}}),r.access(e,t)}async opendir(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:t}});let r=e.toString();if(!r.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+r+") outside of the legit folder: "+this.gitRoot);return new T_(this,r)}async mkdir(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"mkdir",operationArgs:{options:t}}),r.mkdir(e,t)}async readdir(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:t}});let r=new Set;for(let n of[...this.subFilesystems].reverse()){let o=await n.readdir(e,t);for(let f of o)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+f)||r.add(f)}try{let n=await this.passThroughFileSystem.readdir(e,t);for(let o of n)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+o)||r.add(o)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}try{let n=await this.ephemeralFilesFileSystem.readdir(e,t);for(let o of n)r.add(o)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}for(let n of r){let o=(e=="/"?"":e)+"/"+n;await this.hiddenFilesFileSystem.responsible(o)&&r.delete(n)}return Array.from(r)}async open(e,t,r){let n=await this.getResponsibleFs(e);await this.logOperation?.({fsName:n.name,path:e,operation:"open",operationArgs:{flags:t,mode:r}});let o=await n.open(e,t,r),f=this.getNextFileDescriptor();return o.realize(f),this.openFileHandles.set(f,o),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(f),o}async close(e){try{await e.delegate.close(e)}catch(t){throw t}finally{for(let[t,r]of this.pathToFileDescriptors.entries()){let n=r.indexOf(e.fd);if(n!==-1){r.splice(n,1),r.length===0&&this.pathToFileDescriptors.delete(t);break}}this.openFileHandles.delete(e.fd)}}async stat(e,t){let r=e.toString(),n=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:n.name,path:r,operation:"stat",operationArgs:{opts:t}}),n.stat(e)}async lstat(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"lstat",operationArgs:{opts:t}}),r.lstat(e,t)}async link(e,t){throw new Error("not implemented")}async readlink(e,t){throw new Error("not implemented")}async unlink(e){let t=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:t.name,path:e.toString(),operation:"unlink",operationArgs:{}}),t.unlink(e)}async rename(e,t){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(Vp.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(Vp.basename(t.toString())))throw new Error("Renaming to hidden Files is not allowed "+t)}let r=await this.getResponsibleFs(e),n=await this.getResponsibleFs(t);if(r===n)return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:t}}),r.rename(e,t);let o=await r.open(e.toString(),"r");try{let f=await r.fstat(o),m=Buffer.alloc(f.size);await r.read(o,m,0,f.size,0),await r.close(o),await n.writeFile(t.toString(),m,"utf8"),await r.unlink(e)}catch(f){try{await r.close(o)}catch{}throw f}}async rmdir(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:t}}),r.rmdir(e,t)}async symlink(e,t,r){throw new Error("not implemented")}async readFile(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:t}});let r=!0,n;if(typeof e=="number"){r=!1;let o=this.getFilehandle(e);if(!o)throw new Error("Invalid file descriptor");n=o}else if(typeof e=="string")n=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let o=(await n.stat()).size;if(typeof o=="bigint"){if(o>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");o=Number(o)}let f=Buffer.alloc(o),{bytesRead:m}=await n.read(f,0,o,0);if(t&&typeof t.encoding=="string")return f.slice(0,m).toString(t.encoding);if(typeof t=="string"){if(t==="utf8"||t==="utf-8")return f.slice(0,m).toString(t);throw new Error("Unsupported encoding: "+t)}return f.slice(0,m)}finally{n&&r&&await n.close()}}async writeFile(e,t,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:t,options:r}});let n=typeof e!="number",o,f,m,l="w";if(typeof r=="string"?f=r:r&&typeof r=="object"&&(f=r.encoding,m=r.mode,l=r.flag||"w"),typeof e=="number"){let a=this.getFilehandle(e);if(!a)throw new Error("Invalid file descriptor");o=a}else if(typeof e=="string")o=await this.open(e,l,m);else throw new Error("only filehandle and path are supported atm");try{let a;if(typeof t=="string")a=Buffer.from(t,f||"utf8");else if(t instanceof Buffer)a=t;else if(t instanceof Uint8Array)a=Buffer.from(t);else throw new Error("Invalid data type for writeFile");let g=0;for(;g<a.length;){let{bytesWritten:y}=await o.write(a,g,a.length-g,g);g+=y}}finally{o&&n&&await o.close()}}},c(Ha,"Ys"),Ha);h(D_,"CompositeFs");var IR=D_,Ga,C_=(Ga=class extends Jo{constructor({name:e,parentFs:t,gitRoot:r,hiddenFiles:n}){super({name:e,parentFs:t,gitRoot:r}),mt(this,"ig"),this.ig=(0,N_.default)(),this.ig.add(n)}async responsible(e){let t=e.replace(/\\/g,"/"),r=t.startsWith("./")?t.slice(2):t;return r=r.startsWith("/")?r.slice(1):r,r===""||r==="."?!1:this.ig.ignores(r)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${this.toStr(e)}`)}async open(e,t,r){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,t){throw this.error(t)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,t,r,n,o){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},c(Ga,"Xs"),Ga);h(C_,"HiddenFileSubFs");var BR=C_,Va,B_=(Va=class extends Jo{constructor({name:e,parentFs:t,gitRoot:r,ephemeralPatterns:n}){super({name:e,parentFs:t,gitRoot:r}),mt(this,"openFh",new Map),mt(this,"memFs",(0,tf.createFsFromVolume)(new tf.Volume)),mt(this,"ig"),mt(this,"patterns"),this.compositFs=t,this.gitRoot=r,this.ig=(0,I_.default)(),this.ig.add(n),this.patterns=n}normalizePath(e){let t=typeof e=="string"?e:e.toString();return t.startsWith("/")?t:"/"+t}async responsible(e){let t=e.replace(/\\/g,"/"),r=t.startsWith("./")?t.slice(2):t;return r=r.startsWith("/")?r.slice(1):r,r===""||r==="."?!1:this.ig.ignores(r)}fileType(){return 5}async open(e,t,r){let n=this.normalizePath(e),o=Wc.dirname(n);o&&o!=="/"&&o!=="."&&await this.memFs.promises.mkdir(o,{recursive:!0});let f=await this.memFs.promises.open(n,t,r);return this.openFh.set(f.fd,f),new Zc({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:f.fd,parentFsFileDescriptors:[f.fd]})}async access(e,t){let r=this.normalizePath(e);return await this.memFs.promises.access(r,t)}async stat(e,t){let r=this.normalizePath(e);return this.memFs.promises.stat(r,{bigint:!1})}async lstat(e,t){let r=this.normalizePath(e);return this.memFs.promises.lstat(r,{bigint:!1})}async opendir(e,t){let r=this.normalizePath(e);return await this.memFs.promises.opendir(r,t)}async link(e,t){let r=this.normalizePath(e),n=this.normalizePath(t);return await this.memFs.promises.link(r,n)}async mkdir(e,t){let r=this.normalizePath(e);if(!(typeof t=="object"&&t&&"recursive"in t&&t.recursive)){let n=Wc.dirname(r);if(n&&n!=="/"&&n!==".")try{await this.memFs.promises.stat(n)}catch{await this.memFs.promises.mkdir(n,{recursive:!0})}}await this.memFs.promises.mkdir(r,t)}async readdir(e,...t){let r=this.normalizePath(e),n=await this.memFs.promises.readdir(r,...t);return console.log("EPHEMERAL: READDIR: ",n),n}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let t=this.normalizePath(e);return await this.memFs.promises.unlink(t)}async rename(e,t){let r=this.normalizePath(e),n=this.normalizePath(t);return await this.memFs.promises.rename(r,n)}async rmdir(e,t){let r=this.normalizePath(e);return await this.memFs.promises.rmdir(r,t)}async symlink(e,t,r){let n=this.normalizePath(e),o=this.normalizePath(t);return await this.memFs.promises.symlink(n,o,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(await t.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.datasync()}async read(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.read(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(t,r)}async write(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.write(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(t,r)}async writev(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){if(typeof e=="string"||Buffer.isBuffer(e)){let r=this.normalizePath(e);return this.memFs.promises.readFile(r,t)}return super.readFile(e,t)}async writeFile(e,t,r){let n=this.normalizePath(e),o=Wc.dirname(n);return o&&o!=="/"&&o!=="."&&await this.memFs.promises.mkdir(o,{recursive:!0}),this.memFs.promises.writeFile(n,t,r)}},c(Va,"Js"),Va);h(B_,"EphemeralSubFs");var jR=B_,Ka,MR=(Ka=class extends Jo{constructor({name:e,parentFs:t,gitRoot:r}){if(super({name:e,parentFs:t,gitRoot:r}),mt(this,"openFh",new Map),mt(this,"memFs",(0,rf.createFsFromVolume)(new rf.Volume)),mt(this,"targetFs"),this.compositFs=t,this.gitRoot=r,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,t,r){let n=j_.dirname(e),o=await this.targetFs.promises.open(e,t,r);return this.openFh.set(o.fd,o),new Zc({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[o.fd]})}async access(e,t){return await this.targetFs.promises.access(e,t)}async stat(e,t){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,t){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,t){return await this.targetFs.promises.opendir(e,t)}async link(e,t){return await this.targetFs.promises.link(e,t)}async mkdir(e,t){let r=typeof e=="string"?e:e.toString();return await this.targetFs.promises.mkdir(r,t)}async readdir(e,...t){return this.targetFs.promises.readdir(e,...t)}async readlink(e,...t){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,t){return await this.targetFs.promises.rename(e,t)}async rmdir(e,t){return await this.targetFs.promises.rmdir(e,t)}async symlink(e,t,r){return await this.targetFs.promises.symlink(e,t,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(await t.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.sync()}async read(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.read(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(t,r)}async write(e,t,r,n,o){let f=this.openFh.get(e.subFsFileDescriptor);if(f)return await f.write(t,r,n,o);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(t,r)}async writev(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){return typeof e=="string"||Buffer.isBuffer(e)?this.targetFs.readFile(e.toString(),t):super.readFile(e,t)}async writeFile(e,t,r){let n=typeof r=="object"&&r.flag?r.flag:"w",o=await this.targetFs.open(e,n);try{let f;if(typeof t=="string"){let m=typeof r=="object"&&r.encoding?r.encoding:"utf8";f=Buffer.from(t,m)}else Buffer.isBuffer(t)?f=t:f=Buffer.from(t);await o.write(f,0,f.length,0)}finally{await this.targetFs.close(o)}}},c(Ka,"Qs"),Ka);h(MR,"PassThroughSubFs");var K0=Ht(Jt(),1),Ja,M_=(Ja=class{constructor(e){this.routes=e,mt(this,"compiledRoutes");let t={},r=h((n,o)=>{if(typeof n.type=="string"){t[o]={handler:n,siblings:[]};let f=n}else{let f=[];for(let[m,l]of Object.entries(n))if(m==="."){if(t[o])throw new Error(`Conflict: multiple handlers for path '${o}', '.' and optional '[[parameter_name]]' defined?`);t[o]={handler:l,siblings:f}}else if(m.startsWith("[[")&&m.endsWith("]]")){if(t[o])throw new Error(`Conflict: multiple handlers for path '${o}', '.' and optional '[[parameter_name]]' defined?`);t[o]={handler:l,siblings:f},m.startsWith("[[...")?t[o?`${o}/${m}`:m]={handler:l,siblings:[]}:r(l,o?`${o}/${m}`:m)}else m.startsWith("[")&&m.endsWith("]")?m.startsWith("[...")?t[o?`${o}/${m}`:m]={handler:l,siblings:[]}:r(l,o?`${o}/${m}`:m):(f.push({segment:m,type:l["."]?"folder":"file"}),r(l,o?`${o}/${m}`:m))}},"walk");r(e,""),this.compiledRoutes=Object.entries(t).map(([n,o])=>{let f=[],m=n.split("/").map(l=>{if(l.startsWith("[[")&&l.endsWith("]]")){let a=l.slice(2,-2).replace(/^\.\.\./,"");return f.push(a),"(.*)"}if(l.startsWith("[")&&l.endsWith("]")){let a=l.slice(1,-1);return f.push(a),"([^/]+)"}return l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${m}$`),paramNames:f,staticSiblings:o.siblings,handler:o.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:t,paramNames:r,handler:n,staticSiblings:o}of this.compiledRoutes){let f=e.match(t);if(!f)continue;let m={};for(let l=0;l<r.length;l++)m[r[l]]=decodeURIComponent(f[l+1]||"");return{handler:n,params:m,staticSiblings:o}}}},c(Ja,"tf"),Ja);h(M_,"LegitPathRouter");var $R=M_,Ai=Ht(Jt(),1),LR=new Set([" ","~","^",":","?","*","[","\\"]),UR=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],$_="\u2002";function Jp(i){let e=i.codePointAt(0);return!(e>=0&&e<=31||e===127||LR.has(i))}c(Jp,"xy");h(Jp,"isValidChar");function L_(i){let e="";for(let t of i)t===" "?e+=$_:Jp(t)?e+=t:e+="%"+t.codePointAt(0);for(let t of UR)if(t.test(e))return Array.from(e).map(r=>Jp(r)?r:"%"+r.codePointAt(0)).join("");return e}c(L_,"Ty");h(L_,"encodeName");function U_(i){return i.replace(/%(\d+)/g,(e,t)=>String.fromCodePoint(parseInt(t,10))).replace(new RegExp($_,"g")," ")}c(U_,"Ay");h(U_,"decodeName");function Ya(i){return i.replace(/\./g,"%2E").replace(/\//g,".")}c(Ya,"ar");h(Ya,"encodeBranchNameForVfs");function kr(i){return i.replace(/\./g,"/").replace(/%2E/g,".")}c(kr,"pe");h(kr,"decodeBranchNameFromVfs");async function Bt(i,e,t,r){try{return await Ai.default.resolveRef({fs:i,dir:e,ref:`refs/heads/${kr(t)}`})}catch{return}}c(Bt,"V");h(Bt,"tryResolveRef");async function Pi({dir:i,fs:e,treeOid:t,deletePathParts:r,addPathParts:n,addObj:o,addKeepIfEmpty:f,deleteKeepIfNotEmpty:m,keepFilename:l=".keep",gitCache:a}){let[g,...y]=n??[],[b,...S]=r??[],F=[];if(t){let{tree:T}=await Ai.default.readTree({fs:e,dir:i,oid:t,cache:a||{}});F=[...T]}if(g===b){let T=g;if(T===void 0)throw new Error("illegal arguement - called with out a path part");if(y.length===0)throw new Error("can not move into it self");if(S.length===0)throw new Error("can not move from it self");let P=F.findIndex(C=>C.path===T),$=(P!==-1?F[P]:void 0)?.oid,R=await Pi({dir:i,fs:e,treeOid:$,addPathParts:y,deletePathParts:S,addObj:o,addKeepIfEmpty:f,deleteKeepIfNotEmpty:m});if(R===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let M=!1;if(R!==$){M=!0;let C={mode:"040000",path:T,oid:R,type:"tree"};P!==-1?F[P]=C:F.push(C)}if(t==null&&!M)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(M)return await Ai.default.writeTree({fs:e,dir:i,tree:F});if(t===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return t}else{let T=!1,P;if(b){let $=F.findIndex(M=>M.path===b),R=$!==-1?F[$]:void 0;if(R===void 0)throw new Error("Element doesnt exist in tree");if(S.length>0){if(R&&R.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let M=await Pi({dir:i,fs:e,treeOid:R.oid,addPathParts:void 0,deletePathParts:S,addObj:o,addKeepIfEmpty:f,deleteKeepIfNotEmpty:m});if(M===R.oid)throw new Error("in case of a delete we expect a different subtree oid");T=!0,M===void 0?F.splice($,1):F[$]={mode:"040000",path:b,oid:M,type:"tree"}}else if(T=!0,F.splice($,1),F.length===0&&f){let M=new Uint8Array(0),C=await Ai.default.writeBlob({fs:e,dir:i,blob:M});F.push({mode:"100644",oid:C,path:l,type:"blob"})}P=R}if(g){let $=F.findIndex(M=>M.path===g),R=$!==-1?F[$]:void 0;if(y.length>0){if(R&&R.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let M=await Pi({dir:i,fs:e,treeOid:R?.oid,addPathParts:y,deletePathParts:void 0,addObj:o,addKeepIfEmpty:f,deleteKeepIfNotEmpty:m});if(M===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(M!==R?.oid){T=!0;let C={mode:"040000",path:g,oid:M,type:"tree"};if($!==-1)F[$]=C;else if(F.push(C),m&&F.length>1){let U=F.findIndex(J=>J.path===l);U!==-1&&F.splice(U,1)}}}else{if(T=!0,o){let M={mode:o.type==="tree"?"040000":"100644",path:g,oid:o.oid,type:o.type};if($!==-1)F[$]=M;else{if(m&&F.length>0){let C=F.findIndex(U=>U.path===l);C!==-1&&F.splice(C,1)}F.push(M)}}if(f&&F.length===0){let M=new Uint8Array(0),C=await Ai.default.writeBlob({fs:e,dir:i,blob:M});F.push({mode:"100644",oid:C,path:l,type:"blob"})}}}if(F.length===0)return;if(T)return await Ai.default.writeTree({fs:e,dir:i,tree:F});if(t===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return t}}c(Pi,"$t");h(Pi,"buildUpdatedTree");async function cm(i,e,t,r,n=0,o={}){let{tree:f}=await Ai.default.readTree({fs:i,dir:e,oid:t,cache:o});if(r.length===n)return{type:"tree",entries:f.map(a=>Kr({parent:r.join("/"),name:a.path,isDir:a.type==="tree"})),oid:t};let m=r[n],l=f.find(a=>a.path===m);if(l){if(r.length===n+1){if(l.type==="blob")return{type:"blob",oid:l.oid};if(l.type==="tree"){let a=await Ai.default.readTree({fs:i,dir:e,oid:l.oid,cache:o});return{type:"tree",entries:a.tree.map(g=>Kr({parent:r.join("/"),name:g.path,isDir:g.type==="tree"})),oid:a.oid}}}else if(l.type==="tree")return await cm(i,e,l.oid,r,n+1,o)}}c(cm,"Oy");h(cm,"findGitObjectAtPath");async function La({filePath:i,gitRoot:e,nodeFs:t,commitSha:r,pathParams:n,gitCache:o}){let f=o||{};if(!n.filePath){let l=await Ai.default.readTree({fs:t,dir:e,oid:r,cache:f});return{type:"tree",entries:l.tree.map(a=>Kr({parent:i,name:a.path,isDir:a.type==="tree"})),oid:l.oid}}let m=n.filePath?n.filePath.split("/"):[];return await cm(t,e,r,m,0,f)}c(La,"Ar");h(La,"resolveGitObjAtPath");function Kr(i){return{name:i.name,isFile:h(()=>!i.isDir,"isFile"),isDirectory:h(()=>i.isDir,"isDirectory"),isBlockDevice:h(()=>!0,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isFIFO:h(()=>!1,"isFIFO"),isSocket:h(()=>!1,"isSocket"),parentPath:i.parent,path:i.parent}}c(Kr,"De");h(Kr,"toDirEntry");var ss,Yp=(ss=class extends Jo{constructor({name:e,parentFs:t,gitStorageFs:r,gitRoot:n,routerConfig:o}){super({name:e,parentFs:t,gitRoot:n}),mt(this,"pathRouter"),mt(this,"memFs"),mt(this,"openFh",{}),mt(this,"storageFs"),this.pathRouter=new $R(o),this.gitRoot=n,this.storageFs=r,this.memFs=(0,nf.createFsFromVolume)(new nf.Volume)}async getAuthor(){let e=await K0.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),t=await K0.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),r=Math.floor(Date.now()/1e3),n=new Date().getTimezoneOffset();return{name:e,email:t,date:r,timezoneOffset:n}}async responsible(e){return!0}getRouteHandler(e){let t=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?t=e.slice(this.gitRoot.length):t=e.slice(this.gitRoot.length+1));let r=t.indexOf(`/${ss.LEGIT_DIR}`);if(r===-1)return this.pathRouter.match(t);let n=t.slice(r+1);return this.pathRouter.match(t)}async open(e,t,r){let n=this.getRouteHandler(e);if(!n)throw new Error("Not a virtual legit file");if(n?.handler.writeFile===void 0&&(t.includes("w")||t.includes("a")))throw new Error(`Write operations not allowed for ${n?.handler.type}`);if(t.includes("x")&&n?.handler.type!=="gitBranchFileVirtualFile"&&n?.handler.type!=="claudeVirtualSessionFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${n?.handler.type}`);let o=await this.getAuthor(),f=await n.handler.getFile({cacheFs:this.memFs,filePath:e,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:o}),m=!1;for(let b of Object.values(this.openFh))b.path===e&&(m=!0);if((f||m)&&t.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!f&&!m&&!(t.includes("w")||t.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let l=Kp.dirname(e);if(await this.memFs.promises.mkdir(l,{recursive:!0}),f===void 0&&!t.includes("x")||f&&f.type==="file")try{let b=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let a=await this.memFs.promises.open(e,t,r),g=a.fd,y=new Zc({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:g,parentFsFileDescriptors:[]});return this.openFh[g]={path:e,mode:t,fh:a,openSha:f?.oid,readSha:void 0,unflushed:[]},(t.includes("x")||t.includes("w"))&&this.openFh[g].unflushed.push({length:0,start:0}),y}async mkdir(e,t){let r=e.toString(),n=this.getRouteHandler(r),o=t?{options:t}:{};try{let f=await this.getAuthor();await n?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,...o,author:f});let m=typeof t=="object"?{...t,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,m);let l=r.split("/"),a="";for(let g=1;g<=l.length;g++){a=l.slice(0,g).join("/");try{if((await this.memFs.promises.stat(a)).isDirectory()){let y=await this.memFs.promises.open(a,"r");this.openFh[y.fd]={path:a,mode:"r",fh:y,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(f){throw f}}async access(e,t){await this.stat(e)}async futimes(e,t,r){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(t,r)}async fstat(e,t){let r=this.openFh[e.subFsFileDescriptor];if(!r)throw new Error("Invalid file handle");return this.stat(r.path,t)}async ftruncate(e,t){let r=this.openFh[e.subFsFileDescriptor];if(!r)throw new Error("Invalid file handle");return r.unflushed.push({length:0,start:0}),await r.fh.truncate(t)}async stat(e,t){let r=e.toString(),n=Object.values(this.openFh).find(m=>m.path===r&&m.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(t);let o=this.getRouteHandler(r);if(!o)throw new Error(`ENOENT: no such file or directory, stat '${r}'`);let f=await this.getAuthor();return await o.handler.getStats({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:o.params,author:f})}async lstat(e,t){return this.stat(e,t)}async readdir(e,t){let r=e.toString(),n=this.getRouteHandler(r);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${r}'`);let o=await this.getAuthor(),f=await n?.handler.getFile({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:o});if(f){if(f.type!=="directory")throw new Error("not a folder");let m=n?.staticSiblings??[],l=Array.from(new Set([...f.content,...m.map(a=>Kr({name:a.segment,parent:r,isDir:a.type==="folder"}))])).sort((a,g)=>a.name.localeCompare(g.name,void 0,{numeric:!0,sensitivity:"base"}));return t?.withFileTypes?l:l.map(a=>a.name)}return[]}async read(e,t,r,n,o){let f=e.subFsFileDescriptor,m=this.openFh[f];if(!m)throw new Error("Invalid file handle");if(m.unflushed.length===0){let l=this.getRouteHandler(m.path),a=await this.getAuthor(),g=await l.handler.getFile({cacheFs:this.memFs,filePath:m.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:l?.params,author:a});if(!g?.content)throw new Error("couldnt access content");if(g.type!=="file")throw new Error("not a file");let y=typeof g.content=="string"?Buffer.from(g.content):g.content,b=typeof o=="number"?o:0,S=Math.min(b+n,y.length),F=Math.max(0,S-b);return y.copy(t,r,b,b+F),{bytesRead:F,buffer:t}}return await m.fh.read(t,r,n,o)}async write(e,t,r,n,o){let f=this.openFh[e.subFsFileDescriptor];if(!f)throw new Error("Invalid file handle");let m=f.mode;if(!m.includes("w")&&!m.includes("a")&&!m.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(f.unflushed.length===0){let y=this.getRouteHandler(f.path),b=await this.getAuthor(),S=await y.handler.getFile({cacheFs:this.memFs,filePath:f.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:y.params,author:b});S&&S.oid&&(await this.memFs.promises.writeFile(f.path,S.content),f.readSha=S.oid)}let l=await f.fh.write(t,r,n,o),a=r??0,g=o??0;return f.unflushed.push({start:g,length:n||t.byteLength-a+g}),l}async close(e){let t=e.subFsFileDescriptor,r=this.openFh[t];if(!r)throw new Error("Invalid file handle");try{await this.dataSync(e),await r.fh.close()}finally{delete this.openFh[t]}}async dataSync(e){let t=e.subFsFileDescriptor,r=this.openFh[t];if(!r)throw new Error("Invalid file handle");if(r.unflushed.length>0){let n=this.getRouteHandler(r.path);if(n&&n.handler.writeFile){let o=await this.memFs.promises.readFile(r.path),f=await this.getAuthor();await n.handler.writeFile({cacheFs:this.memFs,filePath:r.path,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:o,pathParams:n.params,author:f})}r.unflushed=[]}}async readFile(e,t){let r=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof t=="string"?n=t:t&&typeof t=="object"&&t.encoding&&(n=t.encoding);let o=await this.open(r,"r");try{let f=(await this.fstat(o)).size,m=Buffer.alloc(f);return await this.read(o,m,0,f,0),await this.close(o),n?m.toString(n):m}catch(f){try{await this.close(o)}catch{}throw f}}async writeFile(e,t,r){let n="w",o="utf8",f;typeof r=="string"?o=r:r&&typeof r=="object"&&(r.flag&&(n=String(r.flag)),r.encoding&&(o=r.encoding),r.mode&&(f=typeof r.mode=="string"?parseInt(r.mode,8):r.mode));let m=await this.open(e,n,f);try{let l;typeof t=="string"?l=Buffer.from(t,o):Buffer.isBuffer(t)?l=t:t instanceof Uint8Array?l=Buffer.from(t):ArrayBuffer.isView(t)?l=Buffer.from(t.buffer,t.byteOffset,t.byteLength):l=Buffer.from(t),await this.write(m,l,0,l.length,0)}finally{await this.close(m)}}async rename(e,t){let r=e.toString(),n=t.toString(),o=this.getRouteHandler(r),f=this.getRouteHandler(n);if(o?.handler.type==="gitBranchFileVirtualFile"&&f?.handler.type==="gitBranchFileVirtualFile"){let m=!0;try{await this.memFs.promises.access(n)}catch{m=!1}let l=!0;try{await this.stat(n)}catch{l=!1}let a=!0;try{await this.stat(r)}catch{a=!1}let g=!0;try{await this.memFs.promises.access(r)}catch{g=!1}if(g){let F=Kp.dirname(n);try{await this.memFs.promises.access(F)}catch{await this.memFs.promises.mkdir(F,{recursive:!0})}await this.memFs.promises.rename(e,t)}let y=this.getRouteHandler(r);if(!y)throw new Error("VF not found");let b=await this.getAuthor(),S=await y.handler.rename({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:y?.params??{},newPathParams:f?.params??{},author:b})}else throw new Error(`Unsupported rename operation from ${o?.handler.type} to ${f?.handler.type}`)}async fchmod(e,t){}async unlink(e){let t=e.toString(),r=this.getRouteHandler(t);if(r?.handler.unlink!==void 0)try{let n=await this.getAuthor();await r.handler.unlink({cacheFs:this.memFs,filePath:t,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:r.params,author:n})}catch(n){let o=!1;for(let[f,m]of Object.entries(this.openFh))m.path===t&&m.unflushed.length>0&&(o=!0);if(!o)throw n}finally{let n=!1;for(let[o,f]of Object.entries(this.openFh))f.path===t&&(n=!0,await f.fh.close(),delete this.openFh[Number(o)]);n&&await this.memFs.promises.unlink(t)}else throw new Error(`Cannot unlink ${r?.handler.type} files`)}async rmdir(e,...t){let r=e.toString(),n=this.getRouteHandler(r);if(n?.handler.rmdir!==void 0){let o=await this.getAuthor();await n.handler.rmdir({cacheFs:this.memFs,filePath:r,userSpaceFs:this.compositFs,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,author:o});let f=!1;for(let[m,l]of Object.entries(this.openFh))l.path===r&&(f=!0,await l.fh.close(),delete this.openFh[Number(m)]);f&&await this.memFs.promises.rmdir(r,{recursive:!0})}else throw new Error(`Cannot rmdir
106
+ ${n?.handler.type} directories`)}fileType(){return 10}},c(ss,"qn"),ss);h(Yp,"GitSubFs"),mt(Yp,"LEGIT_DIR",".legit");var WR=Yp,Ma=Ht(Jt(),1),qR=Ht(Jt(),1),W_="-operation";async function Jr(i,e,t){return(await qR.default.listBranches({fs:i,dir:e})).filter(r=>r.endsWith("__"+t+W_))[0]}c(Jr,"Re");h(Jr,"resolveOperationBranchName");var Xp=Ht(Jt(),1);async function $t(i,e){try{let t=await Xp.default.getConfig({fs:e,dir:i,path:"user.legit-current-branch"});if(t)return Ya(t)}catch{}try{let t=await Xp.default.getConfig({fs:e,dir:i,path:"init.defaultBranch"});return Ya(t)||"main"}catch{return"main"}}c($t,"K");h($t,"getCurrentBranch");async function q_(i,e,t){await Xp.default.setConfig({fs:e,dir:i,path:"user.legit-current-branch",value:kr(t)})}c(q_,"Ry");h(q_,"setCurrentBranch");var Qp={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i;r.branchName===void 0&&(r.branchName=await $t(e,t));let n=await Jr(t,e,r.branchName),o,f=!1;if(n)try{o=await Ma.default.resolveRef({fs:t,dir:e,ref:n}),f=!0}catch{try{o=await Ma.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${n}`}),f=!0}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}}else try{o=await Ma.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${r.branchName}`})}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}let m=await Ma.default.readCommit({fs:t,dir:e,oid:o}),{commit:l}=m,a=l.committer.timestamp*1e3;try{return{mode:420,size:(f?await Qp.getFile(i):void 0)?.content?.length??0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i;r.branchName===void 0&&(r.branchName=await $t(e,t));let n=await Jr(t,e,r.branchName),o=[];if(n){let l=await Ma.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${n}`}),a=!1,g=l;for(;g&&!a;){let y=await Ma.default.readCommit({fs:t,dir:e,oid:g});o.push({oid:y.oid,parentOids:y.commit.parent,message:y.commit.message,originBranchOid:"unset"}),g=y.commit.parent&&y.commit.parent.length>0?y.commit.parent[0]:null,y.commit.parent.length===2&&y.commit.parent[0]===y.commit.parent[1]&&(a=!0)}}let f;for(let l=o.length-1;l>=0;l--){let a=o[l];if(f===void 0){if(a.parentOids.length!==2&&a.parentOids[0]!==a.parentOids[1])throw new Error(`Operation commit ${a.oid} does not have two parents as expected`);f=a.parentOids[1]}a.parentOids.length===2&&(f=a.parentOids[1]),a.originBranchOid=f}let m=Buffer.from(JSON.stringify(o,null,2),"utf-8");return{type:"file",content:m,mode:420,size:m.length}},"getFile"),rename:h(async function(i){throw new Error("not implemented")},"rename"),mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},xr=Ht(Jt(),1),zR=Ht(TR(),1);function z_(i){let e=[i];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}c(z_,"hR");h(z_,"fromValue");function H_(i){return i[Symbol.asyncIterator]?i[Symbol.asyncIterator]():i[Symbol.iterator]?i[Symbol.iterator]():i.next?i:z_(i)}c(H_,"pR");h(H_,"getIterator");async function fm(i,e){let t=H_(i);for(;;){let{value:r,done:n}=await t.next();if(r&&await e(r),n)break}t.return&&t.return()}c(fm,"ev");h(fm,"forAwait");function G_(i){let{PassThrough:e}=NR(),t=new e;return setTimeout(async()=>{await fm(i,r=>t.write(r)),t.end()},1),t}c(G_,"mR");h(G_,"asyncIteratorToStream");async function V_(i){let e=0,t=[];await fm(i,o=>{t.push(o),e+=o.byteLength});let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.byteLength;return r}c(V_,"wR");h(V_,"collect");function K_(i){let e=Object.getOwnPropertyDescriptor(i,Symbol.asyncIterator);if(e&&e.enumerable)return i;let t=!1,r=[],n={};return i.on("data",o=>{r.push(o),n.resolve&&(n.resolve({value:r.shift(),done:!1}),n={})}),i.on("error",o=>{n.reject&&(n.reject(o),n={})}),i.on("end",()=>{t=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next(){return new Promise((o,f)=>{if(r.length===0&&t)return o({done:!0});if(r.length>0)return o({value:r.shift(),done:!1});r.length===0&&!t&&(n={resolve:o,reject:f})})},return(){i.removeAllListeners(),i.destroy&&i.destroy()},[Symbol.asyncIterator](){return this}}}c(K_,"gR");h(K_,"fromNodeStream");async function J_({onProgress:i,url:e,method:t="GET",headers:r={},agent:n,body:o}){return o&&Array.isArray(o)?o=Buffer.from(await V_(o)):o&&(o=G_(o)),new Promise((f,m)=>{(0,zR.default)({url:e,method:t,headers:r,agent:n,body:o},(l,a)=>{if(l)return m(l);try{let g=K_(a);f({url:a.url,method:a.method,statusCode:a.statusCode,statusMessage:a.statusMessage,body:g,headers:a.headers})}catch(g){m(g)}})})}c(J_,"yR");h(J_,"request");var HR={request:J_},zp=HR,Gi="legit",GR=h(({fs:i,gitRepoPath:e,serverUrl:t="https://hub.legitcontrol.com",auth:r,anonymousBranch:n,authHeaderPrefix:o="Bearer "})=>{let f=!1;async function m(P){let $=await r.getMaxAccessTokenForBranch(P);if(!$)throw new Error(`No access token for branch ${P}`);await xr.default.fetch({fs:i,http:zp,dir:e,singleBranch:!0,ref:`${P}`,remote:Gi,url:t,headers:{Authorization:`${o}${$}`}});let R=await xr.default.resolveRef({fs:i,dir:e,ref:`${Gi}/${P}`});await xr.default.writeRef({fs:i,dir:e,ref:`refs/heads/${P}`,value:R})}c(m,"l"),h(m,"loadBranch");let l=[];async function a(){let P=await r.getMaxAccessTokenForBranch("todo");await xr.default.fetch({fs:i,http:zp,dir:e,remote:Gi,url:t,headers:{Authorization:`${o}${P}`}});let $=await xr.default.listBranches({fs:i,dir:e});for(let R of $){if(R===n)continue;let M=`${Gi}/${R}`,C,U;try{C=await xr.default.resolveRef({fs:i,dir:e,ref:R})}catch(J){console.log(`Could not resolve local ref ${R}:`,J)}try{U=await xr.default.resolveRef({fs:i,dir:e,ref:M})}catch{U=void 0}if(C&&U){if(C!==U){let J=await xr.default.findMergeBase({fs:i,dir:e,oids:[C,U]});if(J[0]!==C&&J[0]!==U){let ne=await xr.default.merge({fs:i,dir:e,ours:C,theirs:U,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:h(async({branches:oe,contents:z,path:ee})=>{let[H,j,V]=z;return console.log(`Merging ${oe[0]} with ${oe[1]}...`),console.log("merged:"),console.log(z),{cleanMerge:!0,mergedText:V===void 0?j:V}},"mergeDriver")});await xr.default.writeRef({fs:i,dir:e,ref:`refs/heads/${R}`,value:ne.oid,force:!0})}J[0]===C?(console.log(`branch ${R} differs - remote ahaed, not behind`),await xr.default.writeRef({fs:i,dir:e,ref:`refs/heads/${R}`,value:U,force:!0})):J[0]===U?(console.log(`branch ${R} differs - local ahead, not behind`),l.push(R)):(console.log(`branch ${R} differs - both changed`),l.push(R))}}else C&&!U&&l.push(R)}}c(a,"c"),h(a,"pull");async function g(P){if((await r.getUser()).type!=="local")for(let $ of P){let R=await r.getMaxAccessTokenForBranch($);await xr.default.push({fs:i,http:zp,dir:e,remote:Gi,url:t,ref:$,headers:{Authorization:`Bearer ${R}`}})}}c(g,"f"),h(g,"push");let y=Promise.resolve();async function b(P){y=y.then(()=>g(P)),await y}c(b,"h"),h(b,"sequentialPush");async function S(){await xr.default.getConfig({fs:i,dir:e,path:`remote.${Gi}.fetch`})||await xr.default.setConfig({fs:i,dir:e,path:`remote.${Gi}.fetch`,value:`+refs/heads/*:refs/remotes/${Gi}/*`});try{await a();let P=[...new Set(l)].filter($=>$.indexOf(n)===-1);await b(P),l=[]}catch(P){console.error("Error monitoring changes:",P)}finally{f&&setTimeout(S,1e3)}}c(S,"p"),h(S,"pullPushTick");function F(){f=!0,S()}c(F,"m"),h(F,"startSync");function T(){f=!1}return c(T,"w"),h(T,"stopSync"),{start:h(()=>{f||(F(),f=!0)},"start"),stop:h(()=>{T()},"stop"),isRunning:h(()=>f,"isRunning"),loadBranch:m,sequentialPush:b}},"createLegitSyncService"),Fr=Ht(Jt(),1),VR=h((i,e)=>{let t={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:h(async()=>t,"getUser"),signInAnonymously:h(async()=>{t.type="anonymous",t.id=crypto.randomUUID(),t.email=`anonymous-sha1-${t.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:h(async r=>{let n=await i.getUserTokens(t.id);n.accessTokens.push(r),await i.setUserTokens(t.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:h(async r=>{let n=await i.getUserTokens(t.id);if(!(n.accessTokens===void 0||n.accessTokens.length===0))return n.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager"),J0=Ht(Jt(),1);function Y_(i){let e=JSON.stringify(i),t=new TextEncoder().encode(e),r="";return typeof btoa=="function"?r=btoa(String.fromCharCode(...t)):r=Buffer.from(t).toString("base64"),r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}c(Y_,"iv");h(Y_,"encodeConfigJson");function X_(i){let e=i.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((i.length+3)%4),t;typeof atob=="function"?t=atob(e):t=Buffer.from(e,"base64").toString("binary");let r=Uint8Array.from(t,o=>o.charCodeAt(0)),n=new TextDecoder().decode(r);return JSON.parse(n)}c(X_,"nv");h(X_,"decodeConfigJson");var Y0="user.legit-tokens";function Q_({storageFs:i,gitRoot:e}){return{getUserTokens:h(async t=>{let r=await J0.default.getConfig({fs:i,dir:e,path:Y0});return r?X_(r):{accessTokens:[]}},"getUserTokens"),setUserTokens:h(async(t,r)=>await J0.default.setConfig({fs:i,dir:e,path:Y0,value:Y_(r)}),"setUserTokens")}}c(Q_,"ov");h(Q_,"createGitConfigTokenStore");var At=Ht(Jt(),1),as,Z_=(as=class extends Error{constructor(e,t){super(e),mt(this,"code","ENOENT"),mt(this,"path"),this.name="ENOENTError",this.path=t,Object.setPrototypeOf(this,as.prototype)}},c(as,"Cs"),as);h(Z_,"ENOENTError");var Zp=Z_;function Wo(i){return i&&i.gitCache!==void 0?i.gitCache:i&&i.parentFs?Wo(i.parentFs):{}}c(Wo,"Is");h(Wo,"getGitCacheFromFs");var em={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:h(async({gitRoot:i,nodeFs:e,filePath:t,cacheFs:r,pathParams:n,userSpaceFs:o})=>{n.branchName===void 0&&(n.branchName=await $t(i,e));let f=await Bt(e,i,n.branchName);if(!f)throw new Zp(`ENOENT: no such file or directory, stat '${t}'`,t);let m=await La({filePath:t,gitRoot:i,nodeFs:e,commitSha:f,pathParams:n,gitCache:Wo(o)});if(!m)throw new Zp(`ENOENT: no such file or directory, stat '${t}'`,t);let l=await At.default.readCommit({fs:e,dir:i,oid:f}),{commit:a}=l,g=await At.default.log({fs:e,dir:i,ref:f,filepath:n.filePath,depth:1}),y=a.committer.timestamp*1e3,b=g.length>0?g[0].commit.committer.timestamp*1e3:y;if(m.type==="tree")return{mode:420,size:0,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!0,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:b,mtimeMs:b,ctimeMs:b,birthtimeMs:y,atime:new Date(b),mtime:new Date(b),ctime:new Date(b),birthtime:new Date(b)};{let{blob:S}=await At.default.readBlob({fs:e,dir:i,oid:m.oid});return{mode:420,size:S.length,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(S.length/4096),atimeMs:b,mtimeMs:b,ctimeMs:b,birthtimeMs:b,atime:new Date(b),mtime:new Date(b),ctime:new Date(b),birthtime:new Date(b)}}},"getStats"),getFile:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n,userSpaceFs:o})=>{n.branchName===void 0&&(n.branchName=await $t(e,t));try{let f=await Bt(t,e,n.branchName);if(!f){let l=await At.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await At.default.branch({fs:t,dir:e,ref:n.branchName,object:l}),f=await Bt(t,e,n.branchName),!f)throw new Error("Could not create branch for getFile")}let m=await La({filePath:i,gitRoot:e,nodeFs:t,commitSha:f,pathParams:n,gitCache:Wo(o)});if(!m)return;if(m.type==="blob"){let{blob:l}=await At.default.readBlob({fs:t,dir:e,oid:m.oid});return{type:"file",content:Buffer.from(l),mode:420,size:l.length,oid:m.oid}}else{let l=[];try{let a=await r.promises.stat(i);if(a&&a.isDirectory()){let g=await r.promises.readdir(i,{withFileTypes:!0});l.push(...g)}}catch{}return{type:"directory",content:Array.from(new Set([...l,...m.entries])).map(a=>({...a,name:a.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}}catch{return}},"getFile"),unlink:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n,author:o})=>{if(n.branchName===void 0&&(n.branchName=await $t(e,t)),!n.filePath)throw new Error("filePath should be in pathParams");let f=await Bt(t,e,n.branchName);if(!f)throw new Error("Invalid branch file path - branch must exist");let m=await At.default.readTree({fs:t,dir:e,oid:f}),l=await Pi({dir:e,fs:t,treeOid:m.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(l!==m.oid){let a=await At.default.commit({fs:t,dir:e,message:`Delete ${n.filePath}`,tree:l,noUpdateBranch:!0,parent:[f],author:o});await At.default.writeRef({fs:t,dir:e,ref:`refs/heads/${kr(n.branchName)}`,value:a,force:!0})}},"unlink"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,pathParams:o,author:f})=>{if(o.branchName===void 0&&(o.branchName=await $t(e,t)),o.filePath===void 0)throw new Error("filePath should be in pathParams");let m;typeof r=="string"?m=new TextEncoder().encode(r):m=new Uint8Array(r);let l=await At.default.writeBlob({fs:t,dir:e,blob:m}),a=await Bt(t,e,o.branchName);if(!a){let b=await At.default.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await At.default.branch({fs:t,dir:e,ref:kr(o.branchName),object:b}),a=await Bt(t,e,o.branchName),!a)throw new Error("Could not create branch for writeFile")}let g=await At.default.readTree({fs:t,dir:e,oid:a}),y=await Pi({dir:e,fs:t,treeOid:g.oid,deletePathParts:void 0,addPathParts:o.filePath.split("/"),addObj:{type:"blob",oid:l},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(y!==g.oid){let b=await At.default.commit({fs:t,dir:e,message:`\u{1F4BE} Change '${o.filePath}'`,tree:y,noUpdateBranch:!0,parent:[a],author:f});await At.default.writeRef({fs:t,dir:e,ref:`refs/heads/${kr(o.branchName)}`,value:b,force:!0});let S=await Bt(t,e,o.branchName);if(b!==S)throw new Error("Failed to update branch after file deletion")}},"writeFile"),rename:h(async function({filePath:i,newPath:e,gitRoot:t,nodeFs:r,pathParams:n,newPathParams:o,author:f,userSpaceFs:m}){if(n.branchName===void 0&&(n.branchName=await $t(t,r)),n.filePath===void 0)throw new Error("filePath should be in pathParams");if(o.branchName===void 0&&(o.branchName=await $t(t,r)),o.filePath===void 0)throw new Error("filePath should be in newPathParams");let l=await Bt(r,t,n.branchName);if(!l)throw new Error("Invalid branch file path - source branch must exist");let a=await Bt(r,t,o.branchName);if(!a){let S=await At.default.resolveRef({fs:r,dir:t,ref:"HEAD"});if(await At.default.branch({fs:r,dir:t,ref:kr(o.branchName),object:S}),a=await Bt(r,t,o.branchName),a===void 0)throw new Error("Could not create branch for rename operation")}if(o.branchName!==n.branchName)throw new Error("cross branch move not implemented yet");let g=await La({gitRoot:t,nodeFs:r,commitSha:l,filePath:i,pathParams:n,gitCache:Wo(m)});if(g===void 0)throw new Error("no obj at path exists");let y=await Pi({dir:t,fs:r,deletePathParts:n.filePath.split("/"),addPathParts:o.filePath.split("/"),addObj:g.type==="blob"?{type:"blob",oid:g.oid}:{type:"tree",oid:g.oid,entries:g.entries.map(S=>S.name.toString())},treeOid:a,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),b=await At.default.readTree({fs:r,dir:t,oid:l});if(y!==b.oid){let S=await At.default.commit({fs:r,dir:t,message:`\u{1F500} Rename '${n.filePath}' to '${o.filePath}'`,tree:y,noUpdateBranch:!0,parent:[a],author:f});await At.default.writeRef({fs:r,dir:t,ref:`refs/heads/${kr(o.branchName)}`,value:S,force:!0})}},"rename"),mkdir:h(async function(i){i.pathParams.branchName===void 0&&(i.pathParams.branchName=await $t(i.gitRoot,i.nodeFs));let e=await Bt(i.nodeFs,i.gitRoot,i.pathParams.branchName);if(i.pathParams.filePath===void 0&&(i.pathParams.filePath="/",e!==void 0))throw new Error("Folder exists");try{throw await em.getStats(i),new Error("Folder exists")}catch{}if(i.filePath.endsWith("/")&&(i.filePath=i.filePath.replace(/\/+$/,"")),i.pathParams&&typeof i.pathParams.filePath=="string"&&(i.pathParams.filePath=i.pathParams.filePath.replace(/\/+$/,"")),!e){let f=await At.default.resolveRef({fs:i.nodeFs,dir:i.gitRoot,ref:"HEAD"});if(await At.default.branch({fs:i.nodeFs,dir:i.gitRoot,ref:kr(i.pathParams.branchName),object:f}),e=await Bt(i.nodeFs,i.gitRoot,i.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let t=await At.default.readTree({fs:i.nodeFs,dir:i.gitRoot,oid:e}),r=new Uint8Array(0),n=await At.default.writeBlob({fs:i.nodeFs,dir:i.gitRoot,blob:r}),o=await Pi({dir:i.gitRoot,fs:i.nodeFs,treeOid:t.oid,deletePathParts:void 0,addPathParts:[...i.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:n},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(o!==t.oid){let f=await At.default.commit({fs:i.nodeFs,dir:i.gitRoot,message:`\u{1F4BE} Change '${i.pathParams.filePath}'`,tree:o,noUpdateBranch:!0,parent:[e],author:i.author});await At.default.writeRef({fs:i.nodeFs,dir:i.gitRoot,ref:`refs/heads/${kr(i.pathParams.branchName)}`,value:f,force:!0})}},"mkdir"),rmdir:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n,author:o})=>{if(n.branchName===void 0&&(n.branchName=await $t(e,t)),!n.filePath)throw new Error("filePath should be in pathParams");let f=await Bt(t,e,n.branchName);if(!f)throw new Error("Invalid branch file path - branch must exist");let m=await At.default.readTree({fs:t,dir:e,oid:f}),l=await Pi({dir:e,fs:t,treeOid:m.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(l!==m.oid){let a=await At.default.commit({fs:t,dir:e,message:`Delete ${n.filePath}`,tree:l,noUpdateBranch:!0,parent:[f],author:o});await At.default.writeRef({fs:t,dir:e,ref:`refs/heads/${kr(n.branchName)}`,value:a,force:!0})}},"rmdir")},X0=Ht(Jt(),1),KR={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:h(async({gitRoot:i,nodeFs:e})=>{let t=i+"/.git";try{return await e.promises.stat(t)}catch{throw new Error(`ENOENT: no such file or directory, stat '${t}'`)}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e,filePath:t})=>{try{let r=await X0.default.listBranches({fs:e,dir:i}),n=await Promise.all(r.map(async o=>{let f=await X0.default.resolveRef({fs:e,dir:i,ref:o});return Kr({parent:t,name:Ya(o),isDir:!0})}));return{type:"directory",content:n,mode:493,size:n}}catch(r){throw r}},"getFile"),rename:h(async i=>{throw new Error("not implemented")},"rename"),mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},Uo=Ht(Jt(),1);function qc(i){return i&&i.gitCache!==void 0?i.gitCache:i&&i.parentFs?qc(i.parentFs):{}}c(qc,"Du");h(qc,"getGitCacheFromFs");var Q0={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e,pathParams:t,userSpaceFs:r})=>{t.branchName===void 0&&(t.branchName=await $t(i,e));let n=await Bt(e,i,t.branchName);if(!n)throw new Error(`Branch ${t.branchName} does not exist in the repository`);let o=await Uo.default.readCommit({fs:e,dir:i,oid:n,cache:qc(r)}),{commit:f}=o,m=f.committer.timestamp*1e3;return{mode:420,size:40,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:m,mtimeMs:m,ctimeMs:m,birthtimeMs:m,atime:new Date(m),mtime:new Date(m),ctime:new Date(m),birthtime:new Date(m)}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e,pathParams:t,userSpaceFs:r})=>{t.branchName===void 0&&(t.branchName=await $t(i,e));try{let n;try{n=await Uo.default.resolveRef({fs:e,dir:i,ref:t.branchName})}catch{n=await Uo.default.resolveRef({fs:e,dir:i,ref:`refs/heads/${t.branchName}`})}return{type:"file",content:n+`
107
+ `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,pathParams:o,userSpaceFs:f})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:o,content:r}),o.branchName===void 0&&(o.branchName=await $t(e,t));let m=r.toString().trim();try{await Uo.default.readCommit({fs:t,dir:e,oid:m,cache:qc(f)})}catch{throw new Error(`Commit ${m} does not exist in the repository`)}await Uo.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+o.branchName,value:m,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},Z0={type:"legitVirtualFile",rootType:"folder",getStats:h(async({gitRoot:i,nodeFs:e})=>{let t=i+"/.git";try{return await e.promises.stat(t)}catch{throw new Error(`ENOENT: no such file or directory, stat '${t}'`)}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e})=>({type:"directory",content:[],mode:493,size:0}),"getFile"),rename(i){throw new Error("not implemented")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},Hp=Ht(Jt(),1);function qo(i){return i&&i.gitCache!==void 0?i.gitCache:i&&i.parentFs?qo(i.parentFs):{}}c(qo,"$s");h(qo,"getGitCacheFromFs");var JR={type:"gitCommitFileVirtualFile",rootType:"file",getStats:h(async({filePath:i,gitRoot:e,nodeFs:t,pathParams:r,userSpaceFs:n})=>{if(!r.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!r.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let o=r.sha_1_1_2+r.sha1_3__40,f=await La({filePath:i,gitRoot:e,nodeFs:t,commitSha:o,pathParams:r,gitCache:qo(n)});if(!f)throw new Zp(`ENOENT: no such file or directory, stat '${i}'`,i);let m=await Hp.default.readCommit({fs:t,dir:e,oid:o}),{commit:l}=m,a=l.committer.timestamp*1e3;if(f.type==="tree")return{mode:420,size:0,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!0,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)};{let{blob:g}=await Hp.default.readBlob({fs:t,dir:e,oid:f.oid});return{mode:420,size:g.length,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(g.length/4096),atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)}}},"getStats"),getFile:h(async({filePath:i,gitRoot:e,nodeFs:t,pathParams:r,userSpaceFs:n})=>{if(!r.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!r.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let o=r.sha_1_1_2+r.sha1_3__40;try{let f=await La({filePath:i,gitRoot:e,nodeFs:t,commitSha:o,pathParams:r,gitCache:qo(n)});if(!f)return;if(f.type==="blob"){let{blob:m}=await Hp.default.readBlob({fs:t,dir:e,oid:f.oid,cache:qo(n)});return{type:"file",content:Buffer.from(m),mode:420,size:m.length,oid:f.oid}}else return{type:"directory",content:Array.from(new Set([...f.entries.filter(m=>m.name!==".keep")])).map(m=>({...m,name:m.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}catch{return}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},Gp=Ht(Jt(),1),e_={type:"gitCommitVirtualFolder",rootType:"folder",getStats:h(async i=>{let e=i.gitRoot+"/.git";try{return await i.nodeFs.promises.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:h(async({filePath:i,gitRoot:e,nodeFs:t,pathParams:r})=>{let n=await Gp.default.listBranches({fs:t,dir:e}),o=new Set,f=new Set;for(let a of n){let g=`refs/heads/${a}`;try{let y=await Gp.default.resolveRef({fs:t,dir:e,ref:g});o.add(y)}catch{}}for(let a of o){let g=await Gp.default.log({fs:t,dir:e,ref:a});for(let y of g)f.add(y.oid)}if(!r.sha_1_1_2){let a=new Set;for(let y of f)if(a.add(y.slice(0,2)),a.size>=256)break;let g=Array.from(a).sort().map(y=>Kr({parent:i,name:y,isDir:!0}));return{type:"directory",content:g,mode:493,size:g}}let m=new Set;for(let a of f)a.startsWith(r.sha_1_1_2)&&m.add(a.slice(2,40));let l=Array.from(m).sort().map(a=>Kr({parent:i,name:a,isDir:!0}));return{type:"directory",content:l,mode:493,size:l.length}},"getFile"),rename(i){throw new Error("not implementsd")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},di=Ht(Jt(),1),t_={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i;r.branchName===void 0&&(r.branchName=await $t(e,t));let n=await Bt(t,e,r.branchName);if(!n)throw new Error(`Base Branch ${r.branchName} for operations does not exis`);let o=await Jr(t,e,r.branchName),f=!1;if(o)try{n=await di.default.resolveRef({fs:t,dir:e,ref:o}),f=!0}catch{try{n=await di.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${o}`}),f=!0}catch{}}let m=await di.default.readCommit({fs:t,dir:e,oid:n}),{commit:l}=m,a=l.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i;r.branchName===void 0&&(r.branchName=await $t(e,t));let n=await Jr(t,e,r.branchName),o,f=!1;if(n){if(o=await Bt(t,e,n),f=!0,!o)throw new Error(`Base Branch ${n} for operations does not exis`)}else if(o=await Bt(t,e,r.branchName),!o)throw new Error(`Base Branch ${r.branchName} for operations does not exis`);return{type:"file",content:Buffer.from(o),mode:420,size:o.length}},"getFile"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,pathParams:o,author:f})=>{o.branchName===void 0&&(o.branchName=await $t(e,t));let m;typeof r=="string"?m=new TextEncoder().encode(r):m=new Uint8Array(r);let l=await di.default.writeBlob({fs:t,dir:e,blob:m}),a=await Bt(t,e,o.branchName);if(!a)throw new Error("Invalid branch file path - branch doesn't exist");let g=await Jr(t,e,o.branchName),y=!1;g||(g="legit/__"+o.branchName+W_,await di.default.branch({fs:t,dir:e,ref:g,object:a}),y=!0);let b=await di.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${g}`}),S=await di.default.readTree({fs:t,dir:e,oid:a}),F;r instanceof ArrayBuffer?F=Buffer.from(r).toString("utf-8"):typeof r=="string"?F=r:r instanceof Uint8Array?F=Buffer.from(r).toString("utf-8"):F=String(r);let T=!1;if(!y){let $=await di.default.findMergeBase({fs:t,dir:e,oids:T?[b]:[b,a]});$.length===1&&$[0]===a&&(T=!0)}let P=await di.default.commit({fs:t,dir:e,message:F,tree:S.oid,noUpdateBranch:!0,author:f,parent:T?y?[a,a]:[b]:[b,a]});await di.default.writeRef({fs:t,dir:e,ref:`refs/heads/${g}`,value:P,force:!0})},"writeFile"),rename:h(async function({filePath:i,newPath:e,gitRoot:t,nodeFs:r,pathParams:n,newPathParams:o}){throw new Error("not implemented")},"rename"),mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},Lc=Ht(Jt(),1),YR={type:"getThreadName",rootType:"file",getStats:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i,n=await Bt(t,e,r.branchName);if(!n)throw new Error(`Base Branch ${r.branchName} for operations does not exis`);let o=await Jr(t,e,r.branchName),f=!1;if(o)try{n=await Lc.default.resolveRef({fs:t,dir:e,ref:o}),f=!0}catch{try{n=await Lc.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${o}`}),f=!0}catch{}}let m=await Lc.default.readCommit({fs:t,dir:e,oid:n}),{commit:l}=m,a=l.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a),isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i,n=await Jr(t,e,r.branchName),o;if(n){let f="legit/",m=`__${r.branchName}-operation`;return n.startsWith(f)&&n.endsWith(m)?o=n.slice(f.length,n.length-m.length):o=n,{type:"file",content:Buffer.from(U_(o)),mode:420,size:o.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,pathParams:o})=>{if(o.branchName===void 0)throw new Error("branchName should be in pathParams");let f=await Jr(t,e,o.branchName);if(f){let m=`legit/${L_(r.toString())}__${o.branchName}-operation`;await Lc.default.renameBranch({fs:t,dir:e,oldref:f,ref:m}),f=m}},"writeFile"),rename:h(async function({filePath:i,newPath:e,gitRoot:t,nodeFs:r,pathParams:n,newPathParams:o}){throw new Error("not implemented")},"rename"),mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},r_=Ht(Jt(),1),i_={type:"gitBranchHistory",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await $t(i,e));let r=await Bt(e,i,t.branchName);if(!r)throw new Error(`Branch ${t.branchName} does not exist`);let n=await r_.default.readCommit({fs:e,dir:i,oid:r}),{commit:o}=n,f=o.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)}},"getStats"),getFile:h(async i=>{let{gitRoot:e,nodeFs:t,pathParams:r}=i,n=r.branchName;n===void 0&&(n=await $t(e,t));let o=[];if(n){let m=await Bt(t,e,n),l=!1,a=m;for(;a&&!l;){let g=await r_.default.readCommit({fs:t,dir:e,oid:a});o.push({oid:g.oid,...g.commit}),a=g.commit.parent[0]}}let f=Buffer.from(JSON.stringify(o,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:h(async i=>{throw new Error("not implemented")},"rename"),mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},xi=Ht(Jt(),1),n_={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await $t(i,e));let r=await Jr(e,i,t.branchName);if(!r){let l=new Date(0);return{mode:420,size:0,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:l.getTime(),mtimeMs:l.getTime(),ctimeMs:l.getTime(),birthtimeMs:l.getTime(),atime:l,mtime:l,ctime:l,birthtime:l}}let n;try{n=await xi.default.resolveRef({fs:e,dir:i,ref:r})}catch{n=await xi.default.resolveRef({fs:e,dir:i,ref:`refs/heads/${r}`})}let o=await xi.default.readCommit({fs:e,dir:i,oid:n}),{commit:f}=o,m=f.committer.timestamp*1e3;return{mode:420,size:40,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:m,mtimeMs:m,ctimeMs:m,birthtimeMs:m,atime:new Date(m),mtime:new Date(m),ctime:new Date(m),birthtime:new Date(m)}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await $t(i,e));let r=await Jr(e,i,t.branchName);if(!r)return{type:"file",content:"",mode:420,size:0};try{let n;try{n=await xi.default.resolveRef({fs:e,dir:i,ref:r})}catch{n=await xi.default.resolveRef({fs:e,dir:i,ref:`refs/heads/${r}`})}return{type:"file",content:n+`
108
+ `,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,pathParams:o})=>{o.branchName===void 0&&(o.branchName=await $t(e,t));let f=await Jr(t,e,o.branchName),m=await xi.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${f}`});if(!f)throw new Error(`Operation branch name could not be resolved for branch ${o.branchName}`);let l=r.toString().trim(),a,g,y=!1;if(!m)throw new Error(`Operation branch ref could not be resolved for branch ${f}`);let b=m;for(;b&&!y;){let S=await xi.default.readCommit({fs:t,dir:e,oid:b});if(S.oid===l&&(a=S.oid),b=S.commit.parent&&S.commit.parent.length>0?S.commit.parent[0]:null,S.commit.parent.length===2){if(S.commit.parent[0]===S.commit.parent[1])y=!0;else if(a!==void 0){g=S.commit.parent[1];break}}}if(a===void 0)throw new Error(`Cant rollback to ${l} couldn't find newOperationBranchHead ${a}`);if(g===void 0)throw new Error(`Cant rollback to ${l} couldn't find newBranchHead ${g}`);await xi.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+f,value:a,force:!0}),await xi.default.writeRef({fs:t,dir:e,ref:"refs/heads/"+o.branchName,value:g,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},XR=Ht(Jt(),1),tm=Ht(Jt(),1);async function zc(i,e){try{let t=await tm.default.getConfig({fs:e,dir:i,path:"user.legit-target-branch"});if(t)return Ya(t)}catch{}try{let t=await tm.default.getConfig({fs:e,dir:i,path:"init.defaultBranch"});return Ya(t)||"main"}catch{return"main"}}c(zc,"sa");h(zc,"getTargetBranch");async function ev(i,e,t){await tm.default.setConfig({fs:e,dir:i,path:"user.legit-target-branch",value:kr(t)})}c(ev,"fv");h(ev,"setTargetBranch");var QR={type:"gitCurrentBranchVirtualFile",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e})=>{let t=(await $t(i,e)).length;return{mode:420,size:t,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(t/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e})=>{let t=await $t(i,e);return{type:"file",content:t+`
109
+ `,mode:420,size:t.length+1}},"getFile"),writeFile:h(async({gitRoot:i,nodeFs:e,content:t})=>{let r=t.toString().trim();if(!await Bt(e,i,r)){let n=await zc(i,e),o=await Bt(e,i,n);if(!o)throw new Error(`Ref branch ${n} does not exist in the repository`);await XR.default.branch({fs:e,dir:i,ref:kr(r),object:o})}await q_(i,e,r)},"writeFile"),rename(i){throw new Error("not implemented")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},pi="session_data",Uc=JSON.stringify({env:{CLAUDE_CONFIG_DIR:`.claude/${pi}`}},null,2),ZR={type:"claudeVirtualSessionFileVirtualFile",rootType:"folder",getStats:h(async({gitRoot:i,nodeFs:e,filePath:t,cacheFs:r,pathParams:n})=>{let o=t.replace(/\\/g,"/");if(o.endsWith(".claude")||o.endsWith(`.claude/${pi}`)||o.endsWith(`.claude/${pi}/debug`)||o.endsWith(`.claude/${pi}/projects`)||new RegExp(`\\.claude\\/${pi}\\/projects\\/[^/]+$`).test(o)){let m=new Date(0);return{mode:16877,size:0,isFile:h(()=>!1,"isFile"),isDirectory:h(()=>!0,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:m,mtime:m,ctime:m,birthtime:m}}let f=new Date(0);return o.endsWith(".claude/settings.json")?{mode:420,size:Uc.length,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(Uc.length/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:f,mtime:f,ctime:f,birthtime:f}:await r.promises.stat(t)},"getStats"),getFile:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n})=>{let o=i.replace(/\\/g,"/");if((o.endsWith(".claude")||o.endsWith(".claude/session_data")||o.endsWith(".claude/session_data/projects")||o.endsWith(".claude/session_data/debug")||/\.claude\/session_data\/projects\/[^/]+$/.test(o))&&await r.promises.mkdir(i,{recursive:!0}),o.endsWith(".claude/settings.json"))return{type:"file",content:Uc,mode:420,size:Uc.length,oid:"unknown"};try{if((await r.promises.stat(i)).isFile()){let f=await r.promises.readFile(i);return{type:"file",content:f,mode:420,size:f.length,oid:"unknown"}}else{let f=await r.promises.readdir(i,{withFileTypes:!0});if(o.endsWith(".claude")){let m=f.find(a=>a.name.toString()==="settings.json");m||f.push(Kr({name:"settings.json",parent:i,isDir:!1}));let l=f.find(a=>a.name.toString()===pi);m||f.push(Kr({name:pi,parent:i,isDir:!0}))}if(o.endsWith(`.claude/${pi}`)&&(f.find(m=>m.name.toString()==="projects")||f.push(Kr({name:"projects",parent:i,isDir:!0}))),o.endsWith(`.claude/${pi}/projects`)&&!f.find(m=>m.name.toString()==="projects")){let m=o.replace(`.claude/${pi}/projects`,"");f.push(Kr({name:m.replaceAll("/","-"),parent:i,isDir:!0}))}return{type:"directory",content:f.map(m=>({...m,name:m.name.toString(),path:`${i}`,parentPath:`${i}`})),mode:493}}}catch{return}},"getFile"),unlink:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n,author:o})=>{await r.promises.unlink(i)},"unlink"),writeFile:h(async({filePath:i,gitRoot:e,nodeFs:t,content:r,cacheFs:n,userSpaceFs:o,pathParams:f,author:m})=>{let l=i.replace(/\\/g,"/"),a=/\/projects\/([^/]+)\/([^/]+\.jsonl)$/,g=l.match(a);if(g){let y=g[1],b=g[2];console.log({folder:y,file:b}),await n.promises.stat(i).then(()=>!0).catch(()=>!1)||await n.promises.writeFile(i,"");let S=(await n.promises.readFile(i,"utf-8")).split(`
110
+ `);if(S.length>1){let F=S[S.length-2]||"",T=JSON.parse(F),P="";if(T.type==="user"){let $=T.message?.content;if(Array.isArray($)&&$[0]?.type==="tool_result"){let R=$[0],M=typeof R.content=="string"?R.content:JSON.stringify(R.content);P=`\u{1F47E} Tool Result (${T.toolUseResult?.type||"unknown"}): ${M}
111
111
 
112
112
  ---
113
113
 
114
- `}else y=`\u{1F464} ${typeof b=="string"?b:b?.[0]?.content||"User action"}
114
+ `}else P=`\u{1F464} ${typeof $=="string"?$:$?.[0]?.content||"User action"}
115
115
 
116
116
  ---
117
117
 
118
- `}else if(w.type==="assistant"){let b=w.message?.content?.[0],_="";b?.type==="text"?_=b.text:b?.type==="tool_use"?_=`Used tool: ${b.name} with input: ${JSON.stringify(b.input)}`:_="Assistant response",y=`\u{1F47E} ${_}
118
+ `}else if(T.type==="assistant"){let $=T.message?.content?.[0],R="";$?.type==="text"?R=$.text:$?.type==="tool_use"?R=`Used tool: ${$.name} with input: ${JSON.stringify($.input)}`:R="Assistant response",P=`\u{1F47E} ${R}
119
119
 
120
120
  ---
121
121
 
122
- `}else w.type==="file-history-snapshot"?y=`System: File history snapshot for message ${w.messageId}
122
+ `}else T.type==="file-history-snapshot"?P=`System: File history snapshot for message ${T.messageId}
123
123
 
124
124
  ---
125
125
 
126
- `:y=`System: ${w.type||"unknown action"}
126
+ `:P=`System: ${T.type||"unknown action"}
127
127
 
128
128
  ---
129
129
 
130
- `;await s.promises.writeFile(e+"/.legit/operation",y+m)}}else console.log("No match"),await n.promises.writeFile(t,i)},"writeFile"),rename:g(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:o,cacheFs:f}){await f.promises.rename(t,e)},"rename"),mkdir:g(async function(t){await t.cacheFs.promises.mkdir(t.filePath,{recursive:!0})},"mkdir"),rmdir:g(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{},"rmdir")};function gh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?gh(t.parentFs):{}}l(gh,"$e");g(gh,"getGitCacheFromFs");var h3={type:"gitApplyCurrentChangesToVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{let n=new Date(0);return{mode:420,size:40,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:n,mtimeMs:n,ctimeMs:n,birthtimeMs:n,atime:n,mtime:n,ctime:n,birthtime:n}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e,pathParams:r,userSpaceFs:i})=>{try{return{type:"file",content:`
131
- `,mode:420,size:2}}catch{return}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r,userSpaceFs:i,author:n})=>{let s=await me(t,e),o=r.toString().trim(),f=await ue(e,t,s,gh(i));if(!f)throw new Error(`Source branch ${s} does not exist`);let c=await ue(e,t,o,gh(i));if(!c)throw new Error(`Target branch ${o} does not exist`);let a=await pn.default.readTree({fs:e,dir:t,oid:f});if(await pn.default.readTree({fs:e,dir:t,oid:c})===a)return;let u=await pn.default.commit({fs:e,dir:t,message:"Changes from "+s+" applied to "+o,tree:a.oid,noUpdateBranch:!0,author:n,parent:[f,c]}),h=await pn.default.commit({fs:e,dir:t,message:"Changes from "+s+" applied to "+o,tree:a.oid,noUpdateBranch:!0,author:n,parent:[f,u]});await pn.default.writeRef({fs:e,dir:t,ref:"refs/heads/"+lt(o),value:u,force:!0}),await pn.default.writeRef({fs:e,dir:t,ref:"refs/heads/"+lt(s),value:h,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")},d3={type:"gitTargetBranchVirtualFile",rootType:"file",getStats:g(async({gitRoot:t,nodeFs:e})=>{let r=(await yh(t,e)).length;return{mode:420,size:r,isFile:g(()=>!0,"isFile"),isDirectory:g(()=>!1,"isDirectory"),isSymbolicLink:g(()=>!1,"isSymbolicLink"),isBlockDevice:g(()=>!1,"isBlockDevice"),isCharacterDevice:g(()=>!1,"isCharacterDevice"),isSocket:g(()=>!1,"isSocket"),isFIFO:g(()=>!1,"isFIFO"),isFileSync:g(()=>!0,"isFileSync"),isDirectorySync:g(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(r/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:g(async({gitRoot:t,nodeFs:e})=>{let r=await yh(t,e);return{type:"file",content:r+`
132
- `,mode:420,size:r.length+1}},"getFile"),writeFile:g(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await ue(e,t,i))throw new Error(`Branch ${i} does not exist in the repository`);await WA(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:g(async function(t){throw new Error("not implemented")},"mkdir")};function bh(t){return t&&t.gitCache!==void 0?t.gitCache:t&&t.parentFs?bh(t.parentFs):{}}l(bh,"xe");g(bh,"getGitCache");async function p3(t){let e=new Th.Volume,r=(0,Th.createFsFromVolume)(e);return kh({...t,storageFs:t?.storageFs?t.storageFs:r,gitRoot:t?.gitRoot||"/"})}l(p3,"hn");g(p3,"openLegitFsWithMemoryFs");async function kh({storageFs:t,gitRoot:e,anonymousBranch:r="anonymous",showKeepFiles:i=!1,initialAuthor:n={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"},serverUrl:s="https://hub.legitcontrol.com",publicKey:o,claudeHandler:f}){await t.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await et.default.init({fs:t,dir:"/",defaultBranch:r}),await t.promises.writeFile(e+"/.keep",""),await et.default.add({fs:t,dir:"/",filepath:".keep",cache:bh(t)}),await et.default.commit({fs:t,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"},cache:bh(t)}),await et.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:r})),await et.default.getConfig({fs:t,dir:e,path:"user.legit_user_id"})||await et.default.setConfig({fs:t,dir:e,path:"user.legit_user_id",value:n.name}),await et.default.getConfig({fs:t,dir:e,path:"user.name"})||await et.default.setConfig({fs:t,dir:e,path:"user.name",value:n.name}),await et.default.getConfig({fs:t,dir:e,path:"user.email"})||await et.default.setConfig({fs:t,dir:e,path:"user.email",value:n.email});let c=new Y4({name:"git",storageFs:t,gitRoot:e,defaultBranch:r});c.gitCache={};let a={".legit":{".":dA,operation:mA,head:hA,operationHead:yA,operationHistory:Ag,history:wA,currentBranch:f3,"target-branch":d3,"apply-changes":h3,branches:{".":a3,"[branchName]":{".legit":{".":dA,operation:mA,head:hA,operationHead:yA,operationHistory:Ag,history:wA,threadName:l3},"[[...filePath]]":Dg}},commits:{".":pA,"[sha_1_1_2]":{".":pA,"[sha1_3__40]":{"[[...filePath]]":c3}}}},".claude":{"[[...filePath]]":u3},"[[...filePath]]":Dg};!f&&a[".claude"]&&delete a[".claude"];let u=new n3({name:"git-subfs",parentFs:c,gitRoot:e,gitStorageFs:t,routerConfig:a}),h=i?[".git"]:[".git",".keep"],d=new Z4({name:"git-hidden-subfs",parentFs:c,gitRoot:e,hiddenFiles:h}),p=new Q4({name:"git-ephemeral-subfs",parentFs:c,gitRoot:e,ephemeralPatterns:["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.tmp.**","**/**.sb-**"]});c.addSubFs(u),c.setHiddenFilesSubFs(d),c.setEphemeralFilesSubFs(p);let m=jA({storageFs:t,gitRoot:e}),w=o3(m,o),y=s3({fs:t,gitRepoPath:e,serverUrl:s,auth:w,anonymousBranch:r}),b=Object.assign(c,{auth:w,sync:y,setLogger(_){c.setLoggger(_)},push:g(async _=>{},"push"),shareCurrentBranch:g(async()=>{if((await w.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let _=await b.getCurrentBranch();return _===r&&(_=(await w.getUser()).id,await et.default.renameBranch({fs:t,dir:e,oldref:r,ref:_})),await y.sequentialPush([_]),b.setCurrentBranch(_),_},"shareCurrentBranch"),setCurrentBranch:g(async _=>{(await et.default.listBranches({fs:t,dir:e})).includes(_)||await y?.loadBranch(_);let F=(await et.default.listBranches({fs:t,dir:e})).includes(_);if(console.log("branchExistsAfter",F),!F)throw new Error(`Branch ${_} does not exist`);await et.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:_})},"setCurrentBranch"),getCurrentBranch:g(async()=>{let _=await et.default.getConfig({fs:t,dir:e,path:"init.defaultBranch"});if(!_)throw new Error("No current branch set");return _},"getCurrentBranch")});return b}l(kh,"Lt");g(kh,"openLegitFs");var oY=g(t=>async e=>{if(!e.path.includes(".legit/branches/")||(e.path.match(/\.legit/g)||[]).length>1)return;let[r,i]=e.path.split(".legit/branches/"),[n,...s]=i.split("/"),o=s.join("/"),f=r+".legit/branches/"+n+"/.legit/operation",c=JSON.stringify(e.operationArgs,(a,u)=>Buffer.isBuffer(u)?{__buffer__:u.toString("base64")}:u);console.log(f,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
130
+ `;await o.promises.writeFile(e+"/.legit/operation",P+F)}}else console.log("No match"),await n.promises.writeFile(i,r)},"writeFile"),rename:h(async function({filePath:i,newPath:e,gitRoot:t,nodeFs:r,pathParams:n,newPathParams:o,author:f,cacheFs:m}){await m.promises.rename(i,e)},"rename"),mkdir:h(async function(i){await i.cacheFs.promises.mkdir(i.filePath,{recursive:!0})},"mkdir"),rmdir:h(async({filePath:i,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:n,author:o})=>{},"rmdir")},$a=Ht(Jt(),1);function Hc(i){return i&&i.gitCache!==void 0?i.gitCache:i&&i.parentFs?Hc(i.parentFs):{}}c(Hc,"Mu");h(Hc,"getGitCacheFromFs");var eT={type:"gitApplyCurrentChangesToVirtualFile",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e,pathParams:t,userSpaceFs:r})=>{let n=new Date(0);return{mode:420,size:40,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:n,mtimeMs:n,ctimeMs:n,birthtimeMs:n,atime:n,mtime:n,ctime:n,birthtime:n}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e,pathParams:t,userSpaceFs:r})=>{try{return{type:"file",content:`
131
+ `,mode:420,size:2}}catch{return}},"getFile"),writeFile:h(async({gitRoot:i,nodeFs:e,content:t,userSpaceFs:r,author:n})=>{let o=await $t(i,e),f=t.toString().trim(),m=await Bt(e,i,o,Hc(r));if(!m)throw new Error(`Source branch ${o} does not exist`);let l=await Bt(e,i,f,Hc(r));if(!l)throw new Error(`Target branch ${f} does not exist`);let a=await $a.default.readTree({fs:e,dir:i,oid:m});if(await $a.default.readTree({fs:e,dir:i,oid:l})===a)return;let g=await $a.default.commit({fs:e,dir:i,message:"Changes from "+o+" applied to "+f,tree:a.oid,noUpdateBranch:!0,author:n,parent:[m,l]}),y=await $a.default.commit({fs:e,dir:i,message:"Changes from "+o+" applied to "+f,tree:a.oid,noUpdateBranch:!0,author:n,parent:[m,g]});await $a.default.writeRef({fs:e,dir:i,ref:"refs/heads/"+kr(f),value:g,force:!0}),await $a.default.writeRef({fs:e,dir:i,ref:"refs/heads/"+kr(o),value:y,force:!0})},"writeFile"),rename(i){throw new Error("not implementsd")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")},tT={type:"gitTargetBranchVirtualFile",rootType:"file",getStats:h(async({gitRoot:i,nodeFs:e})=>{let t=(await zc(i,e)).length;return{mode:420,size:t,isFile:h(()=>!0,"isFile"),isDirectory:h(()=>!1,"isDirectory"),isSymbolicLink:h(()=>!1,"isSymbolicLink"),isBlockDevice:h(()=>!1,"isBlockDevice"),isCharacterDevice:h(()=>!1,"isCharacterDevice"),isSocket:h(()=>!1,"isSocket"),isFIFO:h(()=>!1,"isFIFO"),isFileSync:h(()=>!0,"isFileSync"),isDirectorySync:h(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(t/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:h(async({gitRoot:i,nodeFs:e})=>{let t=await zc(i,e);return{type:"file",content:t+`
132
+ `,mode:420,size:t.length+1}},"getFile"),writeFile:h(async({gitRoot:i,nodeFs:e,content:t})=>{let r=t.toString().trim();if(!await Bt(e,i,r))throw new Error(`Branch ${r} does not exist in the repository`);await ev(i,e,r)},"writeFile"),rename(i){throw new Error("not implemented")},mkdir:h(async function(i){throw new Error("not implemented")},"mkdir")};function Gc(i){return i&&i.gitCache!==void 0?i.gitCache:i&&i.parentFs?Gc(i.parentFs):{}}c(Gc,"ju");h(Gc,"getGitCache");async function rT(i){let e=new sf.Volume,t=(0,sf.createFsFromVolume)(e);return af({...i,storageFs:i?.storageFs?i.storageFs:t,gitRoot:i?.gitRoot||"/"})}c(rT,"oL");h(rT,"openLegitFsWithMemoryFs");async function af({storageFs:i,gitRoot:e,anonymousBranch:t="anonymous",showKeepFiles:r=!1,initialAuthor:n={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"},serverUrl:o="https://hub.legitcontrol.com",publicKey:f,claudeHandler:m}){await i.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await Fr.default.init({fs:i,dir:"/",defaultBranch:t}),await i.promises.writeFile(e+"/.gitignore",""),await i.promises.writeFile(e+"/.keep",""),await Fr.default.add({fs:i,dir:"/",filepath:".keep",cache:Gc(i)}),await Fr.default.commit({fs:i,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"},cache:Gc(i)}),await Fr.default.setConfig({fs:i,dir:e,path:"init.defaultBranch",value:t})),await Fr.default.getConfig({fs:i,dir:e,path:"user.legit_user_id"})||await Fr.default.setConfig({fs:i,dir:e,path:"user.legit_user_id",value:n.name}),await Fr.default.getConfig({fs:i,dir:e,path:"user.name"})||await Fr.default.setConfig({fs:i,dir:e,path:"user.name",value:n.name}),await Fr.default.getConfig({fs:i,dir:e,path:"user.email"})||await Fr.default.setConfig({fs:i,dir:e,path:"user.email",value:n.email});let l=new IR({name:"git",storageFs:i,gitRoot:e,defaultBranch:t});l.gitCache={};let a={".legit":{".":Z0,operation:t_,head:Q0,operationHead:n_,operationHistory:Qp,history:i_,currentBranch:QR,"target-branch":tT,"apply-changes":eT,branches:{".":KR,"[branchName]":{".legit":{".":Z0,operation:t_,head:Q0,operationHead:n_,operationHistory:Qp,history:i_,threadName:YR},"[[...filePath]]":em}},commits:{".":e_,"[sha_1_1_2]":{".":e_,"[sha1_3__40]":{"[[...filePath]]":JR}}}},".claude":{"[[...filePath]]":ZR},"[[...filePath]]":em};!m&&a[".claude"]&&delete a[".claude"];let g=new WR({name:"git-subfs",parentFs:l,gitRoot:e,gitStorageFs:i,routerConfig:a}),y=r?[".git"]:[".git",".keep"],b=new BR({name:"git-hidden-subfs",parentFs:l,gitRoot:e,hiddenFiles:y}),S=new jR({name:"git-ephemeral-subfs",parentFs:l,gitRoot:e,ephemeralPatterns:["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.tmp.**","**/**.sb-**"]});l.addSubFs(g),l.setHiddenFilesSubFs(b),l.setEphemeralFilesSubFs(S);let F=Q_({storageFs:i,gitRoot:e}),T=VR(F,f),P=GR({fs:i,gitRepoPath:e,serverUrl:o,auth:T,anonymousBranch:t}),$=Object.assign(l,{auth:T,sync:P,setLogger(R){l.setLoggger(R)},push:h(async R=>{},"push"),shareCurrentBranch:h(async()=>{if((await T.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let R=await $.getCurrentBranch();return R===t&&(R=(await T.getUser()).id,await Fr.default.renameBranch({fs:i,dir:e,oldref:t,ref:R})),await P.sequentialPush([R]),$.setCurrentBranch(R),R},"shareCurrentBranch"),setCurrentBranch:h(async R=>{(await Fr.default.listBranches({fs:i,dir:e})).includes(R)||await P?.loadBranch(R);let M=(await Fr.default.listBranches({fs:i,dir:e})).includes(R);if(console.log("branchExistsAfter",M),!M)throw new Error(`Branch ${R} does not exist`);await Fr.default.setConfig({fs:i,dir:e,path:"init.defaultBranch",value:R})},"setCurrentBranch"),getCurrentBranch:h(async()=>{let R=await Fr.default.getConfig({fs:i,dir:e,path:"init.defaultBranch"});if(!R)throw new Error("No current branch set");return R},"getCurrentBranch")});return $}c(af,"FR");h(af,"openLegitFs");var wC=h(i=>async e=>{if(!e.path.includes(".legit/branches/")||(e.path.match(/\.legit/g)||[]).length>1)return;let[t,r]=e.path.split(".legit/branches/"),[n,...o]=r.split("/"),f=o.join("/"),m=t+".legit/branches/"+n+"/.legit/operation",l=JSON.stringify(e.operationArgs,(a,g)=>Buffer.isBuffer(g)?{__buffer__:g.toString("base64")}:g);console.log(m,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
133
133
 
134
- ${c}
134
+ ${l}
135
135
 
136
- `)},"createFsOperationFileLogger");var XP=ce(zP(),1);import{createContext as w5,useContext as y5,useEffect as g5,useMemo as b5,useState as O0,useCallback as gd}from"react";import{jsx as v5}from"react/jsx-runtime";var $c="main",Oi="/.legit/branches",VP="/.legit/commits",HP=l(t=>(t.startsWith("/")&&(t=t.slice(1)),`${Oi}/${$c}/${t}`),"resolveThreadPath"),_5=l(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),GP=w5(void 0);function S5({children:t}){let[e,r]=O0(null),[i,n]=O0(!0),[s,o]=O0(null);g5(()=>{let d=!1,p=l(async()=>{try{let m=await xi();d||(r(m),o(null),n(!1))}catch(m){if(!d){let w=_5(m);r(null),o(w),n(!1)}}},"load");return n(!0),o(null),p(),()=>{d=!0}},[]);let f=gd(async(d,p)=>{if(e){let m=HP(d);await e.promises.writeFile(m,p)}},[e]),c=gd(async d=>{if(e){let p=await zo($c);if(!p)return;let m=p.find(_=>_.oid===d),w=p.find(_=>_.oid===m?.parentOids[0]);if(!m||!w)return;let y=m?.parentOids[1],b=w?.originBranchOid;return!y||!b?void 0:{newOid:y,oldOid:b}}},[e]),a=gd(async(d,p)=>{if(e)return await KP(d,p)},[e]),u=gd(async d=>(e&&(console.log("rollback",d),await JP($c,d)),await bd($c)),[e]),h=b5(()=>({legitFs:e,loading:i,error:s,saveData:f,getMessageDiff:c,getPastState:a,rollback:u,threadId:$c,resolvePath:HP}),[e,i,s,f]);return v5(GP.Provider,{value:h,children:t})}l(S5,"LegitFsProvider");function x0(){let t=y5(GP);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}l(x0,"useLegitFs");var _d=null;async function xi(){return _d||(_d=kh({storageFs:XP.default,gitRoot:"/"}),window&&(window.legitFs=await _d)),_d}l(xi,"getLegitFs");async function YP(){let t=await xi();try{return(await t.promises.readdir(Oi)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(Oi,{recursive:!0}),[];throw e}}l(YP,"listBranches");async function bd(t){try{return await(await xi()).promises.readFile(`${Oi}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}l(bd,"readHead");async function JP(t,e){try{await(await xi()).promises.writeFile(`${Oi}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}l(JP,"writeOperationHead");async function ZP(t,e){try{await(await xi()).promises.writeFile(`${Oi}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}l(ZP,"writeOperation");async function zo(t){try{let r=await(await xi()).promises.readFile(`${Oi}/${t}/.legit/operationHistory`,"utf8");return r.length>0?JSON.parse(r):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",t,e),e}}l(zo,"readOperationHistory");async function KP(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await xi(),i=`${VP}/${t.slice(0,2)}/${t.slice(2)}/${e}`;return await r.promises.readFile(i,"utf8")}catch(r){throw console.error("Error reading past state from path:",t,r),r}}l(KP,"readPastState");var Sd=l(async t=>{let e=[];for(let r of t){let i,n;try{i=JSON.parse(r.message),n={id:r.oid,height:e.length,parent_id:r.parentOids[0]===r.parentOids[1]?null:r.parentOids[0],metadata:{custom:{depending_branch_commit_id:r.originBranchOid??null}},...i},e.unshift(n)}catch{console.log("Skipping operation with invalid JSON message:",r);continue}}return e},"createUIMessages");var A0=class A0{async list(e,r){let i=await zo(e);return{messages:(await Sd(i)).map((o,f)=>({...o,height:f,created_at:new Date(o.created_at),updated_at:new Date(o.updated_at)}))}}async create(e,r){let i=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,n={created_at:new Date,updated_at:new Date,format:r.format,content:r.content};return await ZP(e,JSON.stringify(n)),{message_id:i}}};l(A0,"LegitThreadMessages");var vd=A0;var P0=class P0{constructor(){U(this,"messages",new vd)}async list(e){return{threads:(await YP()).map(i=>({id:i,title:i,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,r){}async delete(e){}};l(P0,"LegitThreads");var Ed=P0;var D0=class D0 extends Dd{constructor(r){super(r);U(this,"runtime");U(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Ed;let i=this.runs.stream;this.runs.stream=async n=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let f=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},c=new Headers;c.set("Content-Type","application/json");try{let a=await fetch(f.api??"/api/chat",{method:"POST",headers:c,credentials:f.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:f.runConfig??{}})});if(!a.ok)throw new Error(`Request failed with status ${a.status}`);return Ni.fromResponse(a,new Bd)}catch(a){return console.error("LegitLocal stream failed, falling back to default handler.",a),i.call(this.runs,n)}}}};l(D0,"LegitLocal");var N0=D0;import{ExportedMessageRepository as E5}from"@assistant-ui/react";var F5=l(t=>{if(t&&typeof t=="object"){let e=t,r=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:r}}return{custom:{}}},"normalizeMetadata"),T5="aui/v0";function k5(t){if(t.format!==T5)return null;let e=t.content;if(!e||typeof e!="object")return null;let r=e.role;if(r!=="assistant"&&r!=="user"&&r!=="system")return null;let i=e.content??[],n=typeof i=="string"||Array.isArray(i)?i:[],s=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(t.created_at),o=F5(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:o}}l(k5,"toThreadMessageLike");async function C0({threadId:t,threadApi:e}){console.log("sync initiated");let r=await zo(t),n=(await Sd(r)).map(k5).filter(s=>s!==null);e?.reset?.(n),e.import(E5.fromArray(n))}l(C0,"syncThreadFromLegitFs");var QP=l(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var Bc=l(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>Bc(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Bc(r)])):JSON.stringify(t),"toJsonValue"),R5=l((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:Bc(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:Bc(t)},"buildToolResultOutput"),O5=l(t=>{switch(t.type){case"text":return{type:"text",text:typeof t.text=="string"?t.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",input:Bc(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),x5=l(t=>t.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",output:R5(t.result??t.output,!!t.isError)},"mapToolContentPart"),rQ=l(t=>t.map(e=>{let r=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:r.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").join("")};case"user":return{role:"user",content:r.map(n=>{switch(n.type){case"text":return{type:"text",text:typeof n.text=="string"?n.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:r.map(n=>O5(n)).filter(Boolean)};case"tool":{let i=r.map(n=>x5(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function iQ(t){let[e,r]=ra();(async()=>{try{let n=null,s=new Map;for await(let o of t.fullStream)switch(o.type){case"text-start":n=r.addTextPart();break;case"text-delta":n||(n=r.addTextPart()),n.append(o.text);break;case"text-end":n?.close(),n=null;break;case"tool-input-start":{let f=o.id;if(!s.has(f)){let c=r.addToolCallPart({toolCallId:f,toolName:o.toolName});s.set(f,c)}break}case"tool-input-delta":{let f=o.id,c=s.get(f);c&&c.argsText.append(o.delta);break}case"tool-input-end":{let f=o.id,c=s.get(f);c&&c.argsText.close();break}case"tool-call":{let f=o.toolCallId;if(!s.get(f)){let a=r.addToolCallPart({toolCallId:f,toolName:o.toolName,args:o.input});s.set(f,a)}break}case"tool-result":{let f=o.toolCallId,c=s.get(f);c&&c.setResponse({result:QP(o.output),isError:!1});break}case"tool-error":{let f=o.toolCallId,c=s.get(f);c&&c.setResponse({result:QP(o.error),isError:!0});break}case"start-step":{let f=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;r.enqueue({type:"step-start",path:[],messageId:f});break}case"finish-step":{let f=o.usage;r.enqueue({type:"step-finish",path:[],finishReason:o.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0},isContinued:!1});break}case"finish":{let f=o.totalUsage;r.enqueue({type:"message-finish",path:[],finishReason:o.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0}});break}case"error":{r.enqueue({type:"error",path:[],error:o.error instanceof Error?o.error.message:typeof o.error=="string"?o.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}n?.close(),s.forEach(o=>o.close()),r.close()}catch(n){r.enqueue({type:"error",path:[],error:n instanceof Error?n.message:typeof n=="string"?n:"Unknown error"}),r.close()}})();let i=new $d;return Ni.toResponse(e,i)}l(iQ,"streamTextToDataStreamResponse");import{useEffect as A5}from"react";import{useAssistantApi as P5}from"@assistant-ui/react";var N5=100;function uQ(){let{legitFs:t,threadId:e}=x0(),i=P5().thread();return A5(()=>{if(!t||!e)return;let n=!1,s,o=null,f=l(()=>{n||(s=setTimeout(c,N5))},"scheduleNext"),c=l(async()=>{try{let a=await bd(e);if(n||a===o)return;let{isRunning:u,isLoading:h}=i.getState();if(u||h)return;setTimeout(async()=>{await C0({threadId:e,threadApi:i}),o=a},100)}catch(a){a.code!=="ENOENT"&&console.error("Failed to poll Legit head",a)}finally{f()}},"tick");return f(),()=>{n=!0,s!==void 0&&clearTimeout(s)}},[t,i,e]),null}l(uQ,"LegitFsHeadPoller");export{uQ as LegitFsHeadPoller,S5 as LegitFsProvider,N0 as LegitLocal,rQ as convertMessagesToModelMessages,iQ as streamTextToDataStreamResponse,C0 as syncThreadFromLegitFs,x0 as useLegitFs};
136
+ `)},"createFsOperationFileLogger");var oS=Li(tS(),1);import{createContext as nA,useContext as sA,useEffect as aA,useMemo as oA,useState as rg,useCallback as Qf}from"react";import{jsx as fA}from"react/jsx-runtime";var nl="main",en="/.legit/branches",iS="/.legit/commits",rS=c(i=>(i.startsWith("/")&&(i=i.slice(1)),`${en}/${nl}/${i}`),"resolveThreadPath"),lA=c(i=>i instanceof Error?i:new Error(String(i??"Unknown error")),"normalizeError"),nS=nA(void 0);function cA({children:i}){let[e,t]=rg(null),[r,n]=rg(!0),[o,f]=rg(null);aA(()=>{let b=!1,S=c(async()=>{try{let F=await tn();b||(t(F),f(null),n(!1))}catch(F){if(!b){let T=lA(F);t(null),f(T),n(!1)}}},"load");return n(!0),f(null),S(),()=>{b=!0}},[]);let m=Qf(async(b,S)=>{if(e){let F=rS(b);await e.promises.writeFile(F,S)}},[e]),l=Qf(async b=>{if(e){let S=await fo(nl);if(!S)return;let F=S.find(R=>R.oid===b),T=S.find(R=>R.oid===F?.parentOids[0]);if(!F||!T)return;let P=F?.parentOids[1],$=T?.originBranchOid;return!P||!$?void 0:{newOid:P,oldOid:$}}},[e]),a=Qf(async(b,S)=>{if(e)return await aS(b,S)},[e]),g=Qf(async b=>(e&&(console.log("rollback",b),await sS(nl,b)),await Zf(nl)),[e]),y=oA(()=>({legitFs:e,loading:r,error:o,saveData:m,getMessageDiff:l,getPastState:a,rollback:g,threadId:nl,resolvePath:rS}),[e,r,o,m]);return fA(nS.Provider,{value:y,children:i})}c(cA,"LegitFsProvider");function ig(){let i=sA(nS);if(i===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return i}c(ig,"useLegitFs");var eh=null;async function tn(){return eh||(eh=af({storageFs:oS.default,gitRoot:"/"}),window&&(window.legitFs=await eh)),eh}c(tn,"getLegitFs");async function lS(){let i=await tn();try{return(await i.promises.readdir(en)).filter(t=>!t.startsWith("."))}catch(e){if(e.code==="ENOENT")return await i.promises.mkdir(en,{recursive:!0}),[];throw e}}c(lS,"listBranches");async function Zf(i){try{return await(await tn()).promises.readFile(`${en}/${i}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",i,e),e}}c(Zf,"readHead");async function sS(i,e){try{await(await tn()).promises.writeFile(`${en}/${i}/.legit/operationHead`,e,"utf8")}catch(t){throw console.error("Error writing head to path:",i,t),t}}c(sS,"writeOperationHead");async function cS(i,e){try{await(await tn()).promises.writeFile(`${en}/${i}/.legit/operation`,e,"utf8")}catch(t){throw console.error("Error writing operation to path:",i,t),t}}c(cS,"writeOperation");async function fo(i){try{let t=await(await tn()).promises.readFile(`${en}/${i}/.legit/operationHistory`,"utf8");return t.length>0?JSON.parse(t):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",i,e),e}}c(fo,"readOperationHistory");async function aS(i,e){try{e.startsWith("/")&&(e=e.slice(1));let t=await tn(),r=`${iS}/${i.slice(0,2)}/${i.slice(2)}/${e}`;return await t.promises.readFile(r,"utf8")}catch(t){throw console.error("Error reading past state from path:",i,t),t}}c(aS,"readPastState");var th=c(async i=>{let e=[];for(let t of i){let r,n;try{r=JSON.parse(t.message),n={id:t.oid,height:e.length,parent_id:t.parentOids[0]===t.parentOids[1]?null:t.parentOids[0],metadata:{custom:{depending_branch_commit_id:t.originBranchOid??null}},...r},e.unshift(n)}catch{console.log("Skipping operation with invalid JSON message:",t);continue}}return e},"createUIMessages");var ng=class ng{async list(e,t){let r=await fo(e);return{messages:(await th(r)).map((f,m)=>({...f,height:m,created_at:new Date(f.created_at),updated_at:new Date(f.updated_at)}))}}async create(e,t){let r=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,n={created_at:new Date,updated_at:new Date,format:t.format,content:t.content};return await cS(e,JSON.stringify(n)),{message_id:r}}};c(ng,"LegitThreadMessages");var rh=ng;var sg=class sg{constructor(){pt(this,"messages",new rh)}async list(e){return{threads:(await lS()).map(r=>({id:r,title:r,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,t){}async delete(e){}};c(sg,"LegitThreads");var ih=sg;var og=class og extends Ad{constructor(t){super(t);pt(this,"runtime");pt(this,"legitFs",null);this.legitFs=t.legitFs,this.threads=new ih;let r=this.runs.stream;this.runs.stream=async n=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let m=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},l=new Headers;l.set("Content-Type","application/json");try{let a=await fetch(m.api??"/api/chat",{method:"POST",headers:l,credentials:m.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:m.runConfig??{}})});if(!a.ok)throw new Error(`Request failed with status ${a.status}`);return Xn.fromResponse(a,new Cd)}catch(a){return console.error("LegitLocal stream failed, falling back to default handler.",a),r.call(this.runs,n)}}}};c(og,"LegitLocal");var ag=og;import{ExportedMessageRepository as hA}from"@assistant-ui/react";var uA=c(i=>{if(i&&typeof i=="object"){let e=i,t=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:t}}return{custom:{}}},"normalizeMetadata"),dA="aui/v0";function pA(i){if(i.format!==dA)return null;let e=i.content;if(!e||typeof e!="object")return null;let t=e.role;if(t!=="assistant"&&t!=="user"&&t!=="system")return null;let r=e.content??[],n=typeof r=="string"||Array.isArray(r)?r:[],o=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(i.created_at),f=uA(i.metadata);return{...e,role:t,content:n,id:e.id??i.id,createdAt:o,metadata:f}}c(pA,"toThreadMessageLike");async function lg({threadId:i,threadApi:e}){console.log("sync initiated");let t=await fo(i),n=(await th(t)).map(pA).filter(o=>o!==null);e?.reset?.(n),e.import(hA.fromArray(n))}c(lg,"syncThreadFromLegitFs");var fS=c(i=>{if(typeof i=="string")return i;if(i===void 0)return"";try{return JSON.stringify(i)}catch{return""}},"serializeStructuredData");var sl=c(i=>i==null?null:typeof i=="string"||typeof i=="number"||typeof i=="boolean"?i:Array.isArray(i)?i.map(e=>sl(e)):typeof i=="object"?Object.fromEntries(Object.entries(i).map(([e,t])=>[e,sl(t)])):JSON.stringify(i),"toJsonValue"),mA=c((i,e)=>e?typeof i=="string"?{type:"error-text",value:i}:{type:"error-json",value:sl(i)}:typeof i=="string"?{type:"text",value:i}:{type:"json",value:sl(i)},"buildToolResultOutput"),gA=c(i=>{switch(i.type){case"text":return{type:"text",text:typeof i.text=="string"?i.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof i.toolCallId=="string"?i.toolCallId:`unknown-${Date.now()}`,toolName:typeof i.toolName=="string"?i.toolName:"unknown",input:sl(i.args??i.input??{})};default:return null}},"mapAssistantContentPart"),yA=c(i=>i.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof i.toolCallId=="string"?i.toolCallId:`unknown-${Date.now()}`,toolName:typeof i.toolName=="string"?i.toolName:"unknown",output:mA(i.result??i.output,!!i.isError)},"mapToolContentPart"),p2=c(i=>i.map(e=>{let t=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:t.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").join("")};case"user":return{role:"user",content:t.map(n=>{switch(n.type){case"text":return{type:"text",text:typeof n.text=="string"?n.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:t.map(n=>gA(n)).filter(Boolean)};case"tool":{let r=t.map(n=>yA(n)).filter(Boolean);return r.length>0?{role:"tool",content:r}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function m2(i){let[e,t]=xo();(async()=>{try{let n=null,o=new Map;for await(let f of i.fullStream)switch(f.type){case"text-start":n=t.addTextPart();break;case"text-delta":n||(n=t.addTextPart()),n.append(f.text);break;case"text-end":n?.close(),n=null;break;case"tool-input-start":{let m=f.id;if(!o.has(m)){let l=t.addToolCallPart({toolCallId:m,toolName:f.toolName});o.set(m,l)}break}case"tool-input-delta":{let m=f.id,l=o.get(m);l&&l.argsText.append(f.delta);break}case"tool-input-end":{let m=f.id,l=o.get(m);l&&l.argsText.close();break}case"tool-call":{let m=f.toolCallId;if(!o.get(m)){let a=t.addToolCallPart({toolCallId:m,toolName:f.toolName,args:f.input});o.set(m,a)}break}case"tool-result":{let m=f.toolCallId,l=o.get(m);l&&l.setResponse({result:fS(f.output),isError:!1});break}case"tool-error":{let m=f.toolCallId,l=o.get(m);l&&l.setResponse({result:fS(f.error),isError:!0});break}case"start-step":{let m=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;t.enqueue({type:"step-start",path:[],messageId:m});break}case"finish-step":{let m=f.usage;t.enqueue({type:"step-finish",path:[],finishReason:f.finishReason,usage:{promptTokens:m.promptTokens??m.prompt?.tokens??0,completionTokens:m.completionTokens??m.completion?.tokens??0},isContinued:!1});break}case"finish":{let m=f.totalUsage;t.enqueue({type:"message-finish",path:[],finishReason:f.finishReason,usage:{promptTokens:m.promptTokens??m.prompt?.tokens??0,completionTokens:m.completionTokens??m.completion?.tokens??0}});break}case"error":{t.enqueue({type:"error",path:[],error:f.error instanceof Error?f.error.message:typeof f.error=="string"?f.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}n?.close(),o.forEach(f=>f.close()),t.close()}catch(n){t.enqueue({type:"error",path:[],error:n instanceof Error?n.message:typeof n=="string"?n:"Unknown error"}),t.close()}})();let r=new Nd;return Xn.toResponse(e,r)}c(m2,"streamTextToDataStreamResponse");import{useEffect as wA}from"react";import{useAssistantApi as bA}from"@assistant-ui/react";var _A=100;function E2(){let{legitFs:i,threadId:e}=ig(),r=bA().thread();return wA(()=>{if(!i||!e)return;let n=!1,o,f=null,m=c(()=>{n||(o=setTimeout(l,_A))},"scheduleNext"),l=c(async()=>{try{let a=await Zf(e);if(n||a===f)return;let{isRunning:g,isLoading:y}=r.getState();if(g||y)return;setTimeout(async()=>{await lg({threadId:e,threadApi:r}),f=a},100)}catch(a){a.code!=="ENOENT"&&console.error("Failed to poll Legit head",a)}finally{m()}},"tick");return m(),()=>{n=!0,o!==void 0&&clearTimeout(o)}},[i,r,e]),null}c(E2,"LegitFsHeadPoller");export{E2 as LegitFsHeadPoller,cA as LegitFsProvider,ag as LegitLocal,p2 as convertMessagesToModelMessages,m2 as streamTextToDataStreamResponse,lg as syncThreadFromLegitFs,ig as useLegitFs};
137
137
  /*!
138
138
  * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
139
139
  * SPDX-License-Identifier: LGPL-3.0-or-later