@waffle-os/git 0.0.0-stage → 0.0.24

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.
@@ -0,0 +1,182 @@
1
+ var gw=Object.create;var Ho=Object.defineProperty;var yw=Object.getOwnPropertyDescriptor;var bw=Object.getOwnPropertyNames;var _w=Object.getPrototypeOf,vw=Object.prototype.hasOwnProperty;var Ji=(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 C=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var xw=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bw(e))!vw.call(t,i)&&i!==r&&Ho(t,i,{get:()=>e[i],enumerable:!(n=yw(e,i))||n.enumerable});return t};var kt=(t,e,r)=>(r=t!=null?gw(_w(t)):{},xw(e||!t||!t.__esModule?Ho(r,"default",{value:t,enumerable:!0}):r,t));var qo=C((sv,Qi)=>{typeof Object.create=="function"?Qi.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Qi.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Wo=C((ov,ea)=>{try{if(ta=Ji("util"),typeof ta.inherits!="function")throw"";ea.exports=ta.inherits}catch{ea.exports=qo()}var ta});var Vn=C((ra,Vo)=>{var Zn=Ji("buffer"),Jt=Zn.Buffer;function Zo(t,e){for(var r in t)e[r]=t[r]}Jt.from&&Jt.alloc&&Jt.allocUnsafe&&Jt.allocUnsafeSlow?Vo.exports=Zn:(Zo(Zn,ra),ra.Buffer=De);function De(t,e,r){return Jt(t,e,r)}De.prototype=Object.create(Jt.prototype);Zo(Jt,De);De.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Jt(t,e,r)};De.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Jt(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};De.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Jt(t)};De.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Zn.SlowBuffer(t)}});var Yo=C((cv,Xo)=>{var Ew={}.toString;Xo.exports=Array.isArray||function(t){return Ew.call(t)=="[object Array]"}});var nr=C((fv,Ko)=>{"use strict";Ko.exports=TypeError});var na=C((lv,Jo)=>{"use strict";Jo.exports=Object});var tc=C((uv,Qo)=>{"use strict";Qo.exports=Error});var rc=C((dv,ec)=>{"use strict";ec.exports=EvalError});var ic=C((hv,nc)=>{"use strict";nc.exports=RangeError});var sc=C((pv,ac)=>{"use strict";ac.exports=ReferenceError});var ia=C((wv,oc)=>{"use strict";oc.exports=SyntaxError});var fc=C((mv,cc)=>{"use strict";cc.exports=URIError});var uc=C((gv,lc)=>{"use strict";lc.exports=Math.abs});var hc=C((yv,dc)=>{"use strict";dc.exports=Math.floor});var wc=C((bv,pc)=>{"use strict";pc.exports=Math.max});var gc=C((_v,mc)=>{"use strict";mc.exports=Math.min});var bc=C((vv,yc)=>{"use strict";yc.exports=Math.pow});var vc=C((xv,_c)=>{"use strict";_c.exports=Math.round});var Ec=C((Ev,xc)=>{"use strict";xc.exports=Number.isNaN||function(e){return e!==e}});var kc=C((Sv,Sc)=>{"use strict";var Sw=Ec();Sc.exports=function(e){return Sw(e)||e===0?e:e<0?-1:1}});var Ac=C((kv,$c)=>{"use strict";$c.exports=Object.getOwnPropertyDescriptor});var ir=C(($v,Oc)=>{"use strict";var Xn=Ac();if(Xn)try{Xn([],"length")}catch{Xn=null}Oc.exports=Xn});var Gr=C((Av,Rc)=>{"use strict";var Yn=Object.defineProperty||!1;if(Yn)try{Yn({},"a",{value:1})}catch{Yn=!1}Rc.exports=Yn});var aa=C((Ov,Tc)=>{"use strict";Tc.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},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 i=42;e[r]=i;for(var a 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 s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var Pc=C((Rv,Ic)=>{"use strict";var Cc=typeof Symbol<"u"&&Symbol,kw=aa();Ic.exports=function(){return typeof Cc!="function"||typeof Symbol!="function"||typeof Cc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:kw()}});var sa=C((Tv,Bc)=>{"use strict";Bc.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var oa=C((Cv,Dc)=>{"use strict";var $w=na();Dc.exports=$w.getPrototypeOf||null});var Uc=C((Iv,jc)=>{"use strict";var Aw="Function.prototype.bind called on incompatible ",Ow=Object.prototype.toString,Rw=Math.max,Tw="[object Function]",Nc=function(e,r){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var a=0;a<r.length;a+=1)n[a+e.length]=r[a];return n},Cw=function(e,r){for(var n=[],i=r||0,a=0;i<e.length;i+=1,a+=1)n[a]=e[i];return n},Iw=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};jc.exports=function(e){var r=this;if(typeof r!="function"||Ow.apply(r)!==Tw)throw new TypeError(Aw+r);for(var n=Cw(arguments,1),i,a=function(){if(this instanceof i){var c=r.apply(this,Nc(n,arguments));return Object(c)===c?c:this}return r.apply(e,Nc(n,arguments))},s=Rw(0,r.length-n.length),o=[],f=0;f<s;f++)o[f]="$"+f;if(i=Function("binder","return function ("+Iw(o,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var l=function(){};l.prototype=r.prototype,i.prototype=new l,l.prototype=null}return i}});var ar=C((Pv,Mc)=>{"use strict";var Pw=Uc();Mc.exports=Function.prototype.bind||Pw});var Kn=C((Bv,Fc)=>{"use strict";Fc.exports=Function.prototype.call});var Jn=C((Dv,zc)=>{"use strict";zc.exports=Function.prototype.apply});var Gc=C((Nv,Lc)=>{"use strict";Lc.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var ca=C((jv,Hc)=>{"use strict";var Bw=ar(),Dw=Jn(),Nw=Kn(),jw=Gc();Hc.exports=jw||Bw.call(Nw,Dw)});var Qn=C((Uv,qc)=>{"use strict";var Uw=ar(),Mw=nr(),Fw=Kn(),zw=ca();qc.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Mw("a function is required");return zw(Uw,Fw,e)}});var Kc=C((Mv,Yc)=>{"use strict";var Lw=Qn(),Wc=ir(),Vc;try{Vc=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var fa=!!Vc&&Wc&&Wc(Object.prototype,"__proto__"),Xc=Object,Zc=Xc.getPrototypeOf;Yc.exports=fa&&typeof fa.get=="function"?Lw([fa.get]):typeof Zc=="function"?function(e){return Zc(e==null?e:Xc(e))}:!1});var la=C((Fv,ef)=>{"use strict";var Jc=sa(),Qc=oa(),tf=Kc();ef.exports=Jc?function(e){return Jc(e)}:Qc?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Qc(e)}:tf?function(e){return tf(e)}:null});var nf=C((zv,rf)=>{"use strict";var Gw=Function.prototype.call,Hw=Object.prototype.hasOwnProperty,qw=ar();rf.exports=qw.call(Gw,Hw)});var ha=C((Lv,lf)=>{"use strict";var G,Ww=na(),Zw=tc(),Vw=rc(),Xw=ic(),Yw=sc(),fr=ia(),cr=nr(),Kw=fc(),Jw=uc(),Qw=hc(),t0=wc(),e0=gc(),r0=bc(),n0=vc(),i0=kc(),cf=Function,ua=function(t){try{return cf('"use strict"; return ('+t+").constructor;")()}catch{}},Hr=ir(),a0=Gr(),da=function(){throw new cr},s0=Hr?(function(){try{return arguments.callee,da}catch{try{return Hr(arguments,"callee").get}catch{return da}}})():da,sr=Pc()(),ft=la(),o0=oa(),c0=sa(),ff=Jn(),qr=Kn(),or={},f0=typeof Uint8Array>"u"||!ft?G:ft(Uint8Array),Ne={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":sr&&ft?ft([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":or,"%AsyncGenerator%":or,"%AsyncGeneratorFunction%":or,"%AsyncIteratorPrototype%":or,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Zw,"%eval%":eval,"%EvalError%":Vw,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":cf,"%GeneratorFunction%":or,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":sr&&ft?ft(ft([][Symbol.iterator]())):G,"%JSON%":typeof JSON=="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!sr||!ft?G:ft(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ww,"%Object.getOwnPropertyDescriptor%":Hr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Xw,"%ReferenceError%":Yw,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!sr||!ft?G:ft(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":sr&&ft?ft(""[Symbol.iterator]()):G,"%Symbol%":sr?Symbol:G,"%SyntaxError%":fr,"%ThrowTypeError%":s0,"%TypedArray%":f0,"%TypeError%":cr,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":Kw,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":qr,"%Function.prototype.apply%":ff,"%Object.defineProperty%":a0,"%Object.getPrototypeOf%":o0,"%Math.abs%":Jw,"%Math.floor%":Qw,"%Math.max%":t0,"%Math.min%":e0,"%Math.pow%":r0,"%Math.round%":n0,"%Math.sign%":i0,"%Reflect.getPrototypeOf%":c0};if(ft)try{null.error}catch(t){af=ft(ft(t)),Ne["%Error.prototype%"]=af}var af,l0=function t(e){var r;if(e==="%AsyncFunction%")r=ua("async function () {}");else if(e==="%GeneratorFunction%")r=ua("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ua("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ft&&(r=ft(i.prototype))}return Ne[e]=r,r},sf={__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"]},Wr=ar(),ti=nf(),u0=Wr.call(qr,Array.prototype.concat),d0=Wr.call(ff,Array.prototype.splice),of=Wr.call(qr,String.prototype.replace),ei=Wr.call(qr,String.prototype.slice),h0=Wr.call(qr,RegExp.prototype.exec),p0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w0=/\\(\\)?/g,m0=function(e){var r=ei(e,0,1),n=ei(e,-1);if(r==="%"&&n!=="%")throw new fr("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new fr("invalid intrinsic syntax, expected opening `%`");var i=[];return of(e,p0,function(a,s,o,f){i[i.length]=o?of(f,w0,"$1"):s||a}),i},g0=function(e,r){var n=e,i;if(ti(sf,n)&&(i=sf[n],n="%"+i[0]+"%"),ti(Ne,n)){var a=Ne[n];if(a===or&&(a=l0(n)),typeof a>"u"&&!r)throw new cr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new fr("intrinsic "+e+" does not exist!")};lf.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new cr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new cr('"allowMissing" argument must be a boolean');if(h0(/^%?[^%]*%?$/,e)===null)throw new fr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=m0(e),i=n.length>0?n[0]:"",a=g0("%"+i+"%",r),s=a.name,o=a.value,f=!1,l=a.alias;l&&(i=l[0],d0(n,u0([0,1],l)));for(var c=1,u=!0;c<n.length;c+=1){var d=n[c],h=ei(d,0,1),p=ei(d,-1);if((h==='"'||h==="'"||h==="`"||p==='"'||p==="'"||p==="`")&&h!==p)throw new fr("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(f=!0),i+="."+d,s="%"+i+"%",ti(Ne,s))o=Ne[s];else if(o!=null){if(!(d in o)){if(!r)throw new cr("base intrinsic for "+e+" exists, but the property is not available.");return}if(Hr&&c+1>=n.length){var w=Hr(o,d);u=!!w,u&&"get"in w&&!("originalValue"in w.get)?o=w.get:o=o[d]}else u=ti(o,d),o=o[d];u&&!f&&(Ne[s]=o)}}return o}});var pa=C((Gv,hf)=>{"use strict";var uf=ha(),df=Qn(),y0=df([uf("%String.prototype.indexOf%")]);hf.exports=function(e,r){var n=uf(e,!!r);return typeof n=="function"&&y0(e,".prototype.")>-1?df([n]):n}});var gf=C((Hv,mf)=>{"use strict";var wf=Function.prototype.toString,lr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ma,ri;if(typeof lr=="function"&&typeof Object.defineProperty=="function")try{ma=Object.defineProperty({},"length",{get:function(){throw ri}}),ri={},lr(function(){throw 42},null,ma)}catch(t){t!==ri&&(lr=null)}else lr=null;var b0=/^\s*class\b/,ga=function(e){try{var r=wf.call(e);return b0.test(r)}catch{return!1}},wa=function(e){try{return ga(e)?!1:(wf.call(e),!0)}catch{return!1}},ni=Object.prototype.toString,_0="[object Object]",v0="[object Function]",x0="[object GeneratorFunction]",E0="[object HTMLAllCollection]",S0="[object HTML document.all class]",k0="[object HTMLCollection]",$0=typeof Symbol=="function"&&!!Symbol.toStringTag,A0=!(0 in[,]),ya=function(){return!1};typeof document=="object"&&(pf=document.all,ni.call(pf)===ni.call(document.all)&&(ya=function(e){if((A0||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=ni.call(e);return(r===E0||r===S0||r===k0||r===_0)&&e("")==null}catch{}return!1}));var pf;mf.exports=lr?function(e){if(ya(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{lr(e,null,ma)}catch(r){if(r!==ri)return!1}return!ga(e)&&wa(e)}:function(e){if(ya(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if($0)return wa(e);if(ga(e))return!1;var r=ni.call(e);return r!==v0&&r!==x0&&!/^\[object HTML/.test(r)?!1:wa(e)}});var _f=C((qv,bf)=>{"use strict";var O0=gf(),R0=Object.prototype.toString,yf=Object.prototype.hasOwnProperty,T0=function(e,r,n){for(var i=0,a=e.length;i<a;i++)yf.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))},C0=function(e,r,n){for(var i=0,a=e.length;i<a;i++)n==null?r(e.charAt(i),i,e):r.call(n,e.charAt(i),i,e)},I0=function(e,r,n){for(var i in e)yf.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))};function P0(t){return R0.call(t)==="[object Array]"}bf.exports=function(e,r,n){if(!O0(r))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=n),P0(e)?T0(e,r,i):typeof e=="string"?C0(e,r,i):I0(e,r,i)}});var xf=C((Wv,vf)=>{"use strict";vf.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Sf=C((Zv,Ef)=>{"use strict";var ba=xf(),B0=typeof globalThis>"u"?global:globalThis;Ef.exports=function(){for(var e=[],r=0;r<ba.length;r++)typeof B0[ba[r]]=="function"&&(e[e.length]=ba[r]);return e}});var Of=C((Vv,Af)=>{"use strict";var kf=Gr(),D0=ia(),ur=nr(),$f=ir();Af.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new ur("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ur("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ur("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ur("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ur("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ur("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,f=!!$f&&$f(e,r);if(kf)kf(e,r,{configurable:s===null&&f?f.configurable:!s,enumerable:i===null&&f?f.enumerable:!i,value:n,writable:a===null&&f?f.writable:!a});else if(o||!i&&!a&&!s)e[r]=n;else throw new D0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Cf=C((Xv,Tf)=>{"use strict";var _a=Gr(),Rf=function(){return!!_a};Rf.hasArrayLengthDefineBug=function(){if(!_a)return null;try{return _a([],"length",{value:1}).length!==1}catch{return!0}};Tf.exports=Rf});var Nf=C((Yv,Df)=>{"use strict";var N0=ha(),If=Of(),j0=Cf()(),Pf=ir(),Bf=nr(),U0=N0("%Math.floor%");Df.exports=function(e,r){if(typeof e!="function")throw new Bf("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||U0(r)!==r)throw new Bf("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Pf){var s=Pf(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!n)&&(j0?If(e,"length",r,!0,!0):If(e,"length",r)),e}});var Uf=C((Kv,jf)=>{"use strict";var M0=ar(),F0=Jn(),z0=ca();jf.exports=function(){return z0(M0,F0,arguments)}});var zf=C((Jv,ii)=>{"use strict";var L0=Nf(),Mf=Gr(),G0=Qn(),Ff=Uf();ii.exports=function(e){var r=G0(arguments),n=1+e.length-(arguments.length-1);return L0(r,n>0?n:0,!0)};Mf?Mf(ii.exports,"apply",{value:Ff}):ii.exports.apply=Ff});var Gf=C((Qv,Lf)=>{"use strict";var H0=aa();Lf.exports=function(){return H0()&&!!Symbol.toStringTag}});var Vf=C((tx,Zf)=>{"use strict";var oi=_f(),q0=Sf(),Hf=zf(),xa=pa(),si=ir(),ai=la(),W0=xa("Object.prototype.toString"),Wf=Gf()(),qf=typeof globalThis>"u"?global:globalThis,va=q0(),Ea=xa("String.prototype.slice"),Z0=xa("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n<e.length;n+=1)if(e[n]===r)return n;return-1},ci={__proto__:null};Wf&&si&&ai?oi(va,function(t){var e=new qf[t];if(Symbol.toStringTag in e&&ai){var r=ai(e),n=si(r,Symbol.toStringTag);if(!n&&r){var i=ai(r);n=si(i,Symbol.toStringTag)}if(n&&n.get){var a=Hf(n.get);ci["$"+t]=a}}}):oi(va,function(t){var e=new qf[t],r=e.slice||e.set;if(r){var n=Hf(r);ci["$"+t]=n}});function V0(t){var e=!1;return oi(ci,function(r,n){if(!e)try{"$"+r(t)===n&&(e=Ea(n,1))}catch{}}),e}function X0(t){var e=!1;return oi(ci,function(r,n){if(!e)try{r(t),e=Ea(n,1)}catch{}}),e}function Y0(t){return Z0(va,t)>-1}function K0(t){if(!t||typeof t!="object")return!1;if(!Wf){var e=Ea(W0(t),8,-1);return Y0(e)?e:e!=="Object"?!1:X0(t)}return si?V0(t):null}Zf.exports=K0});var Yf=C((ex,Xf)=>{"use strict";var J0=Vf();Xf.exports=function(e){return!!J0(e)}});var Jf=C((rx,Kf)=>{"use strict";var Q0=nr(),tm=pa(),em=tm("TypedArray.prototype.buffer",!0),rm=Yf();Kf.exports=em||function(e){if(!rm(e))throw new Q0("Not a Typed Array");return e.buffer}});var el=C((nx,tl)=>{"use strict";var zt=Vn().Buffer,nm=Yo(),im=Jf(),am=ArrayBuffer.isView||function(e){try{return im(e),!0}catch{return!1}},sm=typeof Uint8Array<"u",Qf=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",om=Qf&&(zt.prototype instanceof Uint8Array||zt.TYPED_ARRAY_SUPPORT);tl.exports=function(e,r){if(zt.isBuffer(e))return e.constructor&&!("isBuffer"in e)?zt.from(e):e;if(typeof e=="string")return zt.from(e,r);if(Qf&&am(e)){if(e.byteLength===0)return zt.alloc(0);if(om){var n=zt.from(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength===e.byteLength)return n}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=zt.from(i);if(a.length===e.byteLength)return a}if(sm&&e instanceof Uint8Array)return zt.from(e);var s=nm(e);if(s)for(var o=0;o<e.length;o+=1){var f=e[o];if(typeof f!="number"||f<0||f>255||~~f!==f)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||zt.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return zt.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var nl=C((ix,rl)=>{"use strict";var cm=Vn().Buffer,fm=el();function fi(t,e){this._block=cm.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}fi.prototype.update=function(t,e){t=fm(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,a=this._len,s=0;s<i;){for(var o=a%n,f=Math.min(i-s,n-o),l=0;l<f;l++)r[o+l]=t[s+l];a+=f,s+=f,a%n===0&&this._update(r)}return this._len+=i,this};fi.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 n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};fi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};rl.exports=fi});var Sa=C((ax,al)=>{"use strict";var lm=Wo(),il=nl(),um=Vn().Buffer,dm=[1518500249,1859775393,-1894007588,-899497514],hm=new Array(80);function Zr(){this.init(),this._w=hm,il.call(this,64,56)}lm(Zr,il);Zr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function pm(t){return t<<1|t>>>31}function wm(t){return t<<5|t>>>27}function mm(t){return t<<30|t>>>2}function gm(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Zr.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=pm(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var f=0;f<80;++f){var l=~~(f/20),c=wm(r)+gm(l,n,i,a)+s+e[f]+dm[l]|0;s=a,a=i,i=mm(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Zr.prototype._hash=function(){var t=um.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};al.exports=Zr});var ol=C((sx,sl)=>{"use strict";var Bt=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||Bt.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Bt.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Bt.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Bt.DEFAULT_MAX_PENDING};Bt.DEFAULT_TIMEOUT=0;Bt.DEFAULT_MAX_OCCUPATION_TIME=0;Bt.DEFAULT_MAX_EXECUTION_TIME=0;Bt.DEFAULT_MAX_PENDING=1e3;Bt.prototype.acquire=function(t,e,r,n){if(Array.isArray(t))return this._acquireBatch(t,e,r,n);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof r!="function"&&(n=r,r=null,s=new this.Promise(function(m,x){i=m,a=x})),n=n||{};var o=!1,f=null,l=null,c=null,u=this,d=function(m,x,$){l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),m&&(u.queues[t]&&u.queues[t].length===0&&delete u.queues[t],u.domainReentrant&&delete u.domains[t]),o||(s?x?a(x):i($):typeof r=="function"&&r(x,$),o=!0),m&&u.queues[t]&&u.queues[t].length>0&&u.queues[t].shift()()},h=function(m){if(o)return d(m);f&&(clearTimeout(f),f=null),u.domainReentrant&&m&&(u.domains[t]=process.domain);var x=n.maxExecutionTime||u.maxExecutionTime;if(x&&(c=setTimeout(function(){u.queues[t]&&d(m,new Error("Maximum execution time is exceeded "+t))},x)),e.length===1){var $=!1;try{e(function(S,R){$||($=!0,d(m,S,R))})}catch(S){$||($=!0,d(m,S))}}else u._promiseTry(function(){return e()}).then(function(S){d(m,void 0,S)},function(S){d(m,S)})};u.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=n.maxPending||u.maxPending;if(!u.queues[t])u.queues[t]=[],h(!0);else if(u.domainReentrant&&process.domain&&process.domain===u.domains[t])h(!1);else if(u.queues[t].length>=p)d(!1,new Error("Too many pending tasks in queue "+t));else{var w=function(){h(!0)};n.skipQueue?u.queues[t].unshift(w):u.queues[t].push(w);var E=n.timeout||u.timeout;E&&(f=setTimeout(function(){f=null,d(!1,new Error("async-lock timed out in queue "+t))},E))}var g=n.maxOccupationTime||u.maxOccupationTime;if(g&&(l=setTimeout(function(){u.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},g)),s)return s};Bt.prototype._acquireBatch=function(t,e,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(o,f){return function(l){i.acquire(o,f,l,n)}},s=t.reduceRight(function(o,f){return a(f,o)},e);if(typeof r=="function")s(r);else return new this.Promise(function(o,f){s.length===1?s(function(l,c){l?f(l):o(c)}):o(s())})};Bt.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Bt.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};sl.exports=Bt});var ka=C((ox,cl)=>{"use strict";cl.exports=ol()});var $a=C((cx,fl)=>{"use strict";function ym(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qt(t,e,r){return e=e instanceof RegExp?e:new RegExp(ym(e),"g"),t.replace(e,r)}var bm={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Qt(e,"./","/"),e=Qt(e,"..","."),e=Qt(e," ","-"),e=Qt(e,/^[~^:?*\\\-]/g,""),e=Qt(e,/[~^:?*\\]/g,"-"),e=Qt(e,/[~^:?*\\\-]$/g,""),e=Qt(e,"@{","-"),e=Qt(e,/\.$/g,""),e=Qt(e,/\/$/g,""),e=Qt(e,/\.lock$/g,""),e}};fl.exports=bm});var Oa=C(Aa=>{var ll;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof Aa=="object"?t(Aa):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(ll={}):t(ll={})})(function(t){t.version="1.2.2";function e(){for(var b=0,y=new Array(256),_=0;_!=256;++_)b=_,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,y[_]=b;return typeof Int32Array<"u"?new Int32Array(y):y}var r=e();function n(b){var y=0,_=0,A=0,k=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(A=0;A!=256;++A)k[A]=b[A];for(A=0;A!=256;++A)for(_=b[A],y=256+A;y<4096;y+=256)_=k[y]=_>>>8^b[_&255];var T=[];for(A=1;A!=16;++A)T[A-1]=typeof Int32Array<"u"?k.subarray(A*256,A*256+256):k.slice(A*256,A*256+256);return T}var i=n(r),a=i[0],s=i[1],o=i[2],f=i[3],l=i[4],c=i[5],u=i[6],d=i[7],h=i[8],p=i[9],w=i[10],E=i[11],g=i[12],m=i[13],x=i[14];function $(b,y){for(var _=y^-1,A=0,k=b.length;A<k;)_=_>>>8^r[(_^b.charCodeAt(A++))&255];return~_}function S(b,y){for(var _=y^-1,A=b.length-15,k=0;k<A;)_=x[b[k++]^_&255]^m[b[k++]^_>>8&255]^g[b[k++]^_>>16&255]^E[b[k++]^_>>>24]^w[b[k++]]^p[b[k++]]^h[b[k++]]^d[b[k++]]^u[b[k++]]^c[b[k++]]^l[b[k++]]^f[b[k++]]^o[b[k++]]^s[b[k++]]^a[b[k++]]^r[b[k++]];for(A+=15;k<A;)_=_>>>8^r[(_^b[k++])&255];return~_}function R(b,y){for(var _=y^-1,A=0,k=b.length,T=0,B=0;A<k;)T=b.charCodeAt(A++),T<128?_=_>>>8^r[(_^T)&255]:T<2048?(_=_>>>8^r[(_^(192|T>>6&31))&255],_=_>>>8^r[(_^(128|T&63))&255]):T>=55296&&T<57344?(T=(T&1023)+64,B=b.charCodeAt(A++)&1023,_=_>>>8^r[(_^(240|T>>8&7))&255],_=_>>>8^r[(_^(128|T>>2&63))&255],_=_>>>8^r[(_^(128|B>>6&15|(T&3)<<4))&255],_=_>>>8^r[(_^(128|B&63))&255]):(_=_>>>8^r[(_^(224|T>>12&15))&255],_=_>>>8^r[(_^(128|T>>6&63))&255],_=_>>>8^r[(_^(128|T&63))&255]);return~_}t.table=r,t.bstr=$,t.buf=S,t.str=R})});var le=C(xt=>{"use strict";var _m=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function vm(t,e){return Object.prototype.hasOwnProperty.call(t,e)}xt.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 n in r)vm(r,n)&&(t[n]=r[n])}}return t};xt.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var xm={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+n),i);return}for(var a=0;a<n;a++)t[i+a]=e[r+a]},flattenChunks:function(t){var e,r,n,i,a,s;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(s=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)a=t[e],s.set(a,i),i+=a.length;return s}},Em={arraySet:function(t,e,r,n,i){for(var a=0;a<n;a++)t[i+a]=e[r+a]},flattenChunks:function(t){return[].concat.apply([],t)}};xt.setTyped=function(t){t?(xt.Buf8=Uint8Array,xt.Buf16=Uint16Array,xt.Buf32=Int32Array,xt.assign(xt,xm)):(xt.Buf8=Array,xt.Buf16=Array,xt.Buf32=Array,xt.assign(xt,Em))};xt.setTyped(_m)});var Pl=C(pr=>{"use strict";var Sm=le(),km=4,ul=0,dl=1,$m=2;function hr(t){for(var e=t.length;--e>=0;)t[e]=0}var Am=0,yl=1,Om=2,Rm=3,Tm=258,Da=29,Qr=256,Xr=Qr+1+Da,dr=30,Na=19,bl=2*Xr+1,je=15,Ra=16,Cm=7,ja=256,_l=16,vl=17,xl=18,Pa=[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],li=[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],Im=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],El=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Pm=512,ue=new Array((Xr+2)*2);hr(ue);var Vr=new Array(dr*2);hr(Vr);var Yr=new Array(Pm);hr(Yr);var Kr=new Array(Tm-Rm+1);hr(Kr);var Ua=new Array(Da);hr(Ua);var ui=new Array(dr);hr(ui);function Ta(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Sl,kl,$l;function Ca(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Al(t){return t<256?Yr[t]:Yr[256+(t>>>7)]}function Jr(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function $t(t,e,r){t.bi_valid>Ra-r?(t.bi_buf|=e<<t.bi_valid&65535,Jr(t,t.bi_buf),t.bi_buf=e>>Ra-t.bi_valid,t.bi_valid+=r-Ra):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function te(t,e,r){$t(t,r[e*2],r[e*2+1])}function Ol(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}function Bm(t){t.bi_valid===16?(Jr(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)}function Dm(t,e){var r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,f=e.stat_desc.max_length,l,c,u,d,h,p,w=0;for(d=0;d<=je;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,l=t.heap_max+1;l<bl;l++)c=t.heap[l],d=r[r[c*2+1]*2+1]+1,d>f&&(d=f,w++),r[c*2+1]=d,!(c>n)&&(t.bl_count[d]++,h=0,c>=o&&(h=s[c-o]),p=r[c*2],t.opt_len+=p*(d+h),a&&(t.static_len+=p*(i[c*2+1]+h)));if(w!==0){do{for(d=f-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[f]--,w-=2}while(w>0);for(d=f;d!==0;d--)for(c=t.bl_count[d];c!==0;)u=t.heap[--l],!(u>n)&&(r[u*2+1]!==d&&(t.opt_len+=(d-r[u*2+1])*r[u*2],r[u*2+1]=d),c--)}}function Rl(t,e,r){var n=new Array(je+1),i=0,a,s;for(a=1;a<=je;a++)n[a]=i=i+r[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=Ol(n[o]++,o))}}function Nm(){var t,e,r,n,i,a=new Array(je+1);for(r=0,n=0;n<Da-1;n++)for(Ua[n]=r,t=0;t<1<<Pa[n];t++)Kr[r++]=n;for(Kr[r-1]=n,i=0,n=0;n<16;n++)for(ui[n]=i,t=0;t<1<<li[n];t++)Yr[i++]=n;for(i>>=7;n<dr;n++)for(ui[n]=i<<7,t=0;t<1<<li[n]-7;t++)Yr[256+i++]=n;for(e=0;e<=je;e++)a[e]=0;for(t=0;t<=143;)ue[t*2+1]=8,t++,a[8]++;for(;t<=255;)ue[t*2+1]=9,t++,a[9]++;for(;t<=279;)ue[t*2+1]=7,t++,a[7]++;for(;t<=287;)ue[t*2+1]=8,t++,a[8]++;for(Rl(ue,Xr+1,a),t=0;t<dr;t++)Vr[t*2+1]=5,Vr[t*2]=Ol(t,5);Sl=new Ta(ue,Pa,Qr+1,Xr,je),kl=new Ta(Vr,li,0,dr,je),$l=new Ta(new Array(0),Im,0,Na,Cm)}function Tl(t){var e;for(e=0;e<Xr;e++)t.dyn_ltree[e*2]=0;for(e=0;e<dr;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Na;e++)t.bl_tree[e*2]=0;t.dyn_ltree[ja*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Cl(t){t.bi_valid>8?Jr(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function jm(t,e,r,n){Cl(t),n&&(Jr(t,r),Jr(t,~r)),Sm.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function hl(t,e,r,n){var i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]}function Ia(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&hl(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!hl(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function pl(t,e,r){var n,i,a=0,s,o;if(t.last_lit!==0)do n=t.pending_buf[t.d_buf+a*2]<<8|t.pending_buf[t.d_buf+a*2+1],i=t.pending_buf[t.l_buf+a],a++,n===0?te(t,i,e):(s=Kr[i],te(t,s+Qr+1,e),o=Pa[s],o!==0&&(i-=Ua[s],$t(t,i,o)),n--,s=Al(n),te(t,s,r),o=li[s],o!==0&&(n-=ui[s],$t(t,n,o)));while(a<t.last_lit);te(t,ja,e)}function Ba(t,e){var r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,f=-1,l;for(t.heap_len=0,t.heap_max=bl,s=0;s<a;s++)r[s*2]!==0?(t.heap[++t.heap_len]=f=s,t.depth[s]=0):r[s*2+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=f<2?++f:0,r[l*2]=1,t.depth[l]=0,t.opt_len--,i&&(t.static_len-=n[l*2+1]);for(e.max_code=f,s=t.heap_len>>1;s>=1;s--)Ia(t,r,s);l=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Ia(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,r[l*2]=r[s*2]+r[o*2],t.depth[l]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,r[s*2+1]=r[o*2+1]=l,t.heap[1]=l++,Ia(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Dm(t,e),Rl(r,f,t.bl_count)}function wl(t,e,r){var n,i=-1,a,s=e[1],o=0,f=7,l=4;for(s===0&&(f=138,l=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=e[(n+1)*2+1],!(++o<f&&a===s)&&(o<l?t.bl_tree[a*2]+=o:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[_l*2]++):o<=10?t.bl_tree[vl*2]++:t.bl_tree[xl*2]++,o=0,i=a,s===0?(f=138,l=3):a===s?(f=6,l=3):(f=7,l=4))}function ml(t,e,r){var n,i=-1,a,s=e[1],o=0,f=7,l=4;for(s===0&&(f=138,l=3),n=0;n<=r;n++)if(a=s,s=e[(n+1)*2+1],!(++o<f&&a===s)){if(o<l)do te(t,a,t.bl_tree);while(--o!==0);else a!==0?(a!==i&&(te(t,a,t.bl_tree),o--),te(t,_l,t.bl_tree),$t(t,o-3,2)):o<=10?(te(t,vl,t.bl_tree),$t(t,o-3,3)):(te(t,xl,t.bl_tree),$t(t,o-11,7));o=0,i=a,s===0?(f=138,l=3):a===s?(f=6,l=3):(f=7,l=4)}}function Um(t){var e;for(wl(t,t.dyn_ltree,t.l_desc.max_code),wl(t,t.dyn_dtree,t.d_desc.max_code),Ba(t,t.bl_desc),e=Na-1;e>=3&&t.bl_tree[El[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function Mm(t,e,r,n){var i;for($t(t,e-257,5),$t(t,r-1,5),$t(t,n-4,4),i=0;i<n;i++)$t(t,t.bl_tree[El[i]*2+1],3);ml(t,t.dyn_ltree,e-1),ml(t,t.dyn_dtree,r-1)}function Fm(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return ul;if(t.dyn_ltree[18]!==0||t.dyn_ltree[20]!==0||t.dyn_ltree[26]!==0)return dl;for(r=32;r<Qr;r++)if(t.dyn_ltree[r*2]!==0)return dl;return ul}var gl=!1;function zm(t){gl||(Nm(),gl=!0),t.l_desc=new Ca(t.dyn_ltree,Sl),t.d_desc=new Ca(t.dyn_dtree,kl),t.bl_desc=new Ca(t.bl_tree,$l),t.bi_buf=0,t.bi_valid=0,Tl(t)}function Il(t,e,r,n){$t(t,(Am<<1)+(n?1:0),3),jm(t,e,r,!0)}function Lm(t){$t(t,yl<<1,3),te(t,ja,ue),Bm(t)}function Gm(t,e,r,n){var i,a,s=0;t.level>0?(t.strm.data_type===$m&&(t.strm.data_type=Fm(t)),Ba(t,t.l_desc),Ba(t,t.d_desc),s=Um(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?Il(t,e,r,n):t.strategy===km||a===i?($t(t,(yl<<1)+(n?1:0),3),pl(t,ue,Vr)):($t(t,(Om<<1)+(n?1:0),3),Mm(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),pl(t,t.dyn_ltree,t.dyn_dtree)),Tl(t),n&&Cl(t)}function Hm(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[(Kr[r]+Qr+1)*2]++,t.dyn_dtree[Al(e)*2]++),t.last_lit===t.lit_bufsize-1}pr._tr_init=zm;pr._tr_stored_block=Il;pr._tr_flush_block=Gm;pr._tr_tally=Hm;pr._tr_align=Lm});var Ma=C((dx,Bl)=>{"use strict";function qm(t,e,r,n){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+e[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}Bl.exports=qm});var Fa=C((hx,Dl)=>{"use strict";function Wm(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var Zm=Wm();function Vm(t,e,r,n){var i=Zm,a=n+r;t^=-1;for(var s=n;s<a;s++)t=t>>>8^i[(t^e[s])&255];return t^-1}Dl.exports=Vm});var di=C((px,Nl)=>{"use strict";Nl.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 ql=C(ne=>{"use strict";var Et=le(),Ut=Pl(),Fl=Ma(),be=Fa(),Xm=di(),ze=0,Ym=1,Km=3,Se=4,jl=5,re=0,Ul=1,Mt=-2,Jm=-3,za=-5,Qm=-1,tg=1,hi=2,eg=3,rg=4,ng=0,ig=2,gi=8,ag=9,sg=15,og=8,cg=29,fg=256,Ga=fg+1+cg,lg=30,ug=19,dg=2*Ga+1,hg=15,q=3,xe=258,Lt=xe+q+1,pg=32,yi=42,Ha=69,pi=73,wi=91,mi=103,Ue=113,en=666,it=1,rn=2,Me=3,gr=4,wg=3;function Ee(t,e){return t.msg=Xm[e],e}function Ml(t){return(t<<1)-(t>4?9:0)}function ve(t){for(var e=t.length;--e>=0;)t[e]=0}function _e(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(Et.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))}function pt(t,e){Ut._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,_e(t.strm)}function W(t,e){t.pending_buf[t.pending++]=e}function tn(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function mg(t,e,r,n){var i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,Et.arraySet(e,t.input,t.next_in,i,r),t.state.wrap===1?t.adler=Fl(t.adler,e,i,r):t.state.wrap===2&&(t.adler=be(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)}function zl(t,e){var r=t.max_chain_length,n=t.strstart,i,a,s=t.prev_length,o=t.nice_match,f=t.strstart>t.w_size-Lt?t.strstart-(t.w_size-Lt):0,l=t.window,c=t.w_mask,u=t.prev,d=t.strstart+xe,h=l[n+s-1],p=l[n+s];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(l[i+s]!==p||l[i+s-1]!==h||l[i]!==l[n]||l[++i]!==l[n+1])){n+=2,i++;do;while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<d);if(a=xe-(d-n),n=d-xe,a>s){if(t.match_start=e,s=a,a>=o)break;h=l[n+s-1],p=l[n+s]}}while((e=u[e&c])>f&&--r!==0);return s<=t.lookahead?s:t.lookahead}function Fe(t){var e=t.w_size,r,n,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Lt)){Et.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,r=n;do i=t.head[--r],t.head[r]=i>=e?i-e:0;while(--n);n=e,r=n;do i=t.prev[--r],t.prev[r]=i>=e?i-e:0;while(--n);a+=e}if(t.strm.avail_in===0)break;if(n=mg(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=n,t.lookahead+t.insert>=q)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+q-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<q)););}while(t.lookahead<Lt&&t.strm.avail_in!==0)}function gg(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Fe(t),t.lookahead===0&&e===ze)return it;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((t.strstart===0||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,pt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Lt&&(pt(t,!1),t.strm.avail_out===0))return it}return t.insert=0,e===Se?(pt(t,!0),t.strm.avail_out===0?Me:gr):(t.strstart>t.block_start&&(pt(t,!1),t.strm.avail_out===0),it)}function La(t,e){for(var r,n;;){if(t.lookahead<Lt){if(Fe(t),t.lookahead<Lt&&e===ze)return it;if(t.lookahead===0)break}if(r=0,t.lookahead>=q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+q-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-Lt&&(t.match_length=zl(t,r)),t.match_length>=q)if(n=Ut._tr_tally(t,t.strstart-t.match_start,t.match_length-q),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=q){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+q-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 n=Ut._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(pt(t,!1),t.strm.avail_out===0))return it}return t.insert=t.strstart<q-1?t.strstart:q-1,e===Se?(pt(t,!0),t.strm.avail_out===0?Me:gr):t.last_lit&&(pt(t,!1),t.strm.avail_out===0)?it:rn}function wr(t,e){for(var r,n,i;;){if(t.lookahead<Lt){if(Fe(t),t.lookahead<Lt&&e===ze)return it;if(t.lookahead===0)break}if(r=0,t.lookahead>=q&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+q-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=q-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Lt&&(t.match_length=zl(t,r),t.match_length<=5&&(t.strategy===tg||t.match_length===q&&t.strstart-t.match_start>4096)&&(t.match_length=q-1)),t.prev_length>=q&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-q,n=Ut._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-q),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+q-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=q-1,t.strstart++,n&&(pt(t,!1),t.strm.avail_out===0))return it}else if(t.match_available){if(n=Ut._tr_tally(t,0,t.window[t.strstart-1]),n&&pt(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return it}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=Ut._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<q-1?t.strstart:q-1,e===Se?(pt(t,!0),t.strm.avail_out===0?Me:gr):t.last_lit&&(pt(t,!1),t.strm.avail_out===0)?it:rn}function yg(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=xe){if(Fe(t),t.lookahead<=xe&&e===ze)return it;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=q&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=t.strstart+xe;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);t.match_length=xe-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=q?(r=Ut._tr_tally(t,1,t.match_length-q),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Ut._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(pt(t,!1),t.strm.avail_out===0))return it}return t.insert=0,e===Se?(pt(t,!0),t.strm.avail_out===0?Me:gr):t.last_lit&&(pt(t,!1),t.strm.avail_out===0)?it:rn}function bg(t,e){for(var r;;){if(t.lookahead===0&&(Fe(t),t.lookahead===0)){if(e===ze)return it;break}if(t.match_length=0,r=Ut._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(pt(t,!1),t.strm.avail_out===0))return it}return t.insert=0,e===Se?(pt(t,!0),t.strm.avail_out===0?Me:gr):t.last_lit&&(pt(t,!1),t.strm.avail_out===0)?it:rn}function ee(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var mr;mr=[new ee(0,0,0,0,gg),new ee(4,4,8,4,La),new ee(4,5,16,8,La),new ee(4,6,32,32,La),new ee(4,4,16,16,wr),new ee(8,16,32,32,wr),new ee(8,16,128,128,wr),new ee(8,32,128,256,wr),new ee(32,128,258,1024,wr),new ee(32,258,258,4096,wr)];function _g(t){t.window_size=2*t.w_size,ve(t.head),t.max_lazy_match=mr[t.level].max_lazy,t.good_match=mr[t.level].good_length,t.nice_match=mr[t.level].nice_length,t.max_chain_length=mr[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=q-1,t.match_available=0,t.ins_h=0}function vg(){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=gi,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 Et.Buf16(dg*2),this.dyn_dtree=new Et.Buf16((2*lg+1)*2),this.bl_tree=new Et.Buf16((2*ug+1)*2),ve(this.dyn_ltree),ve(this.dyn_dtree),ve(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16(hg+1),this.heap=new Et.Buf16(2*Ga+1),ve(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*Ga+1),ve(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}function Ll(t){var e;return!t||!t.state?Ee(t,Mt):(t.total_in=t.total_out=0,t.data_type=ig,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?yi:Ue,t.adler=e.wrap===2?0:1,e.last_flush=ze,Ut._tr_init(e),re)}function Gl(t){var e=Ll(t);return e===re&&_g(t.state),e}function xg(t,e){return!t||!t.state||t.state.wrap!==2?Mt:(t.state.gzhead=e,re)}function Hl(t,e,r,n,i,a){if(!t)return Mt;var s=1;if(e===Qm&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>ag||r!==gi||n<8||n>15||e<0||e>9||a<0||a>rg)return Ee(t,Mt);n===8&&(n=9);var o=new vg;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+q-1)/q),o.window=new Et.Buf8(o.w_size*2),o.head=new Et.Buf16(o.hash_size),o.prev=new Et.Buf16(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Et.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=a,o.method=r,Gl(t)}function Eg(t,e){return Hl(t,e,gi,sg,og,ng)}function Sg(t,e){var r,n,i,a;if(!t||!t.state||e>jl||e<0)return t?Ee(t,Mt):Mt;if(n=t.state,!t.output||!t.input&&t.avail_in!==0||n.status===en&&e!==Se)return Ee(t,t.avail_out===0?za:Mt);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===yi)if(n.wrap===2)t.adler=0,W(n,31),W(n,139),W(n,8),n.gzhead?(W(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)),W(n,n.gzhead.time&255),W(n,n.gzhead.time>>8&255),W(n,n.gzhead.time>>16&255),W(n,n.gzhead.time>>24&255),W(n,n.level===9?2:n.strategy>=hi||n.level<2?4:0),W(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(W(n,n.gzhead.extra.length&255),W(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=be(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Ha):(W(n,0),W(n,0),W(n,0),W(n,0),W(n,0),W(n,n.level===9?2:n.strategy>=hi||n.level<2?4:0),W(n,wg),n.status=Ue);else{var s=gi+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=hi||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=pg),s+=31-s%31,n.status=Ue,tn(n,s),n.strstart!==0&&(tn(n,t.adler>>>16),tn(n,t.adler&65535)),t.adler=1}if(n.status===Ha)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),_e(t),i=n.pending,n.pending===n.pending_buf_size));)W(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=pi)}else n.status=pi;if(n.status===pi)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),_e(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=wi)}else n.status=wi;if(n.status===wi)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),_e(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=be(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=mi)}else n.status=mi;if(n.status===mi&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&_e(t),n.pending+2<=n.pending_buf_size&&(W(n,t.adler&255),W(n,t.adler>>8&255),t.adler=0,n.status=Ue)):n.status=Ue),n.pending!==0){if(_e(t),t.avail_out===0)return n.last_flush=-1,re}else if(t.avail_in===0&&Ml(e)<=Ml(r)&&e!==Se)return Ee(t,za);if(n.status===en&&t.avail_in!==0)return Ee(t,za);if(t.avail_in!==0||n.lookahead!==0||e!==ze&&n.status!==en){var f=n.strategy===hi?bg(n,e):n.strategy===eg?yg(n,e):mr[n.level].func(n,e);if((f===Me||f===gr)&&(n.status=en),f===it||f===Me)return t.avail_out===0&&(n.last_flush=-1),re;if(f===rn&&(e===Ym?Ut._tr_align(n):e!==jl&&(Ut._tr_stored_block(n,0,0,!1),e===Km&&(ve(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),_e(t),t.avail_out===0))return n.last_flush=-1,re}return e!==Se?re:n.wrap<=0?Ul:(n.wrap===2?(W(n,t.adler&255),W(n,t.adler>>8&255),W(n,t.adler>>16&255),W(n,t.adler>>24&255),W(n,t.total_in&255),W(n,t.total_in>>8&255),W(n,t.total_in>>16&255),W(n,t.total_in>>24&255)):(tn(n,t.adler>>>16),tn(n,t.adler&65535)),_e(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?re:Ul)}function kg(t){var e;return!t||!t.state?Mt:(e=t.state.status,e!==yi&&e!==Ha&&e!==pi&&e!==wi&&e!==mi&&e!==Ue&&e!==en?Ee(t,Mt):(t.state=null,e===Ue?Ee(t,Jm):re))}function $g(t,e){var r=e.length,n,i,a,s,o,f,l,c;if(!t||!t.state||(n=t.state,s=n.wrap,s===2||s===1&&n.status!==yi||n.lookahead))return Mt;for(s===1&&(t.adler=Fl(t.adler,e,r,0)),n.wrap=0,r>=n.w_size&&(s===0&&(ve(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new Et.Buf8(n.w_size),Et.arraySet(c,e,r-n.w_size,n.w_size,0),e=c,r=n.w_size),o=t.avail_in,f=t.next_in,l=t.input,t.avail_in=r,t.next_in=0,t.input=e,Fe(n);n.lookahead>=q;){i=n.strstart,a=n.lookahead-(q-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+q-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--a);n.strstart=i,n.lookahead=q-1,Fe(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=q-1,n.match_available=0,t.next_in=f,t.input=l,t.avail_in=o,n.wrap=s,re}ne.deflateInit=Eg;ne.deflateInit2=Hl;ne.deflateReset=Gl;ne.deflateResetKeep=Ll;ne.deflateSetHeader=xg;ne.deflate=Sg;ne.deflateEnd=kg;ne.deflateSetDictionary=$g;ne.deflateInfo="pako deflate (from Nodeca project)"});var qa=C(yr=>{"use strict";var bi=le(),Wl=!0,Zl=!0;try{String.fromCharCode.apply(null,[0])}catch{Wl=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Zl=!1}var nn=new bi.Buf8(256);for(de=0;de<256;de++)nn[de]=de>=252?6:de>=248?5:de>=240?4:de>=224?3:de>=192?2:1;var de;nn[254]=nn[254]=1;yr.string2buf=function(t){var e,r,n,i,a,s=t.length,o=0;for(i=0;i<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<s&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),o+=r<128?1:r<2048?2:r<65536?3:4;for(e=new bi.Buf8(o),a=0,i=0;a<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<s&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e};function Vl(t,e){if(e<65534&&(t.subarray&&Zl||!t.subarray&&Wl))return String.fromCharCode.apply(null,bi.shrinkBuf(t,e));for(var r="",n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r}yr.buf2binstring=function(t){return Vl(t,t.length)};yr.binstring2buf=function(t){for(var e=new bi.Buf8(t.length),r=0,n=e.length;r<n;r++)e[r]=t.charCodeAt(r);return e};yr.buf2string=function(t,e){var r,n,i,a,s=e||t.length,o=new Array(s*2);for(n=0,r=0;r<s;){if(i=t[r++],i<128){o[n++]=i;continue}if(a=nn[i],a>4){o[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r<s;)i=i<<6|t[r++]&63,a--;if(a>1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return Vl(o,n)};yr.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+nn[t[r]]>e?r:e}});var Wa=C((gx,Xl)=>{"use strict";function Ag(){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}Xl.exports=Ag});var Ql=C(on=>{"use strict";var an=ql(),sn=le(),Va=qa(),Xa=di(),Og=Wa(),Jl=Object.prototype.toString,Rg=0,Za=4,br=0,Yl=1,Kl=2,Tg=-1,Cg=0,Ig=8;function Le(t){if(!(this instanceof Le))return new Le(t);this.options=sn.assign({level:Tg,method:Ig,chunkSize:16384,windowBits:15,memLevel:8,strategy:Cg,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 Og,this.strm.avail_out=0;var r=an.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==br)throw new Error(Xa[r]);if(e.header&&an.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=Va.string2buf(e.dictionary):Jl.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=an.deflateSetDictionary(this.strm,n),r!==br)throw new Error(Xa[r]);this._dict_set=!0}}Le.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Za:Rg,typeof t=="string"?r.input=Va.string2buf(t):Jl.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 sn.Buf8(n),r.next_out=0,r.avail_out=n),i=an.deflate(r,a),i!==Yl&&i!==br)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===Za||a===Kl))&&(this.options.to==="string"?this.onData(Va.buf2binstring(sn.shrinkBuf(r.output,r.next_out))):this.onData(sn.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Yl);return a===Za?(i=an.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===br):(a===Kl&&(this.onEnd(br),r.avail_out=0),!0)};Le.prototype.onData=function(t){this.chunks.push(t)};Le.prototype.onEnd=function(t){t===br&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=sn.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Ya(t,e){var r=new Le(e);if(r.push(t,!0),r.err)throw r.msg||Xa[r.err];return r.result}function Pg(t,e){return e=e||{},e.raw=!0,Ya(t,e)}function Bg(t,e){return e=e||{},e.gzip=!0,Ya(t,e)}on.Deflate=Le;on.deflate=Ya;on.deflateRaw=Pg;on.gzip=Bg});var eu=C((bx,tu)=>{"use strict";var _i=30,Dg=12;tu.exports=function(e,r){var n,i,a,s,o,f,l,c,u,d,h,p,w,E,g,m,x,$,S,R,b,y,_,A,k;n=e.state,i=e.next_in,A=e.input,a=i+(e.avail_in-5),s=e.next_out,k=e.output,o=s-(r-e.avail_out),f=s+(e.avail_out-257),l=n.dmax,c=n.wsize,u=n.whave,d=n.wnext,h=n.window,p=n.hold,w=n.bits,E=n.lencode,g=n.distcode,m=(1<<n.lenbits)-1,x=(1<<n.distbits)-1;t:do{w<15&&(p+=A[i++]<<w,w+=8,p+=A[i++]<<w,w+=8),$=E[p&m];e:for(;;){if(S=$>>>24,p>>>=S,w-=S,S=$>>>16&255,S===0)k[s++]=$&65535;else if(S&16){R=$&65535,S&=15,S&&(w<S&&(p+=A[i++]<<w,w+=8),R+=p&(1<<S)-1,p>>>=S,w-=S),w<15&&(p+=A[i++]<<w,w+=8,p+=A[i++]<<w,w+=8),$=g[p&x];r:for(;;){if(S=$>>>24,p>>>=S,w-=S,S=$>>>16&255,S&16){if(b=$&65535,S&=15,w<S&&(p+=A[i++]<<w,w+=8,w<S&&(p+=A[i++]<<w,w+=8)),b+=p&(1<<S)-1,b>l){e.msg="invalid distance too far back",n.mode=_i;break t}if(p>>>=S,w-=S,S=s-o,b>S){if(S=b-S,S>u&&n.sane){e.msg="invalid distance too far back",n.mode=_i;break t}if(y=0,_=h,d===0){if(y+=c-S,S<R){R-=S;do k[s++]=h[y++];while(--S);y=s-b,_=k}}else if(d<S){if(y+=c+d-S,S-=d,S<R){R-=S;do k[s++]=h[y++];while(--S);if(y=0,d<R){S=d,R-=S;do k[s++]=h[y++];while(--S);y=s-b,_=k}}}else if(y+=d-S,S<R){R-=S;do k[s++]=h[y++];while(--S);y=s-b,_=k}for(;R>2;)k[s++]=_[y++],k[s++]=_[y++],k[s++]=_[y++],R-=3;R&&(k[s++]=_[y++],R>1&&(k[s++]=_[y++]))}else{y=s-b;do k[s++]=k[y++],k[s++]=k[y++],k[s++]=k[y++],R-=3;while(R>2);R&&(k[s++]=k[y++],R>1&&(k[s++]=k[y++]))}}else if((S&64)===0){$=g[($&65535)+(p&(1<<S)-1)];continue r}else{e.msg="invalid distance code",n.mode=_i;break t}break}}else if((S&64)===0){$=E[($&65535)+(p&(1<<S)-1)];continue e}else if(S&32){n.mode=Dg;break t}else{e.msg="invalid literal/length code",n.mode=_i;break t}break}}while(i<a&&s<f);R=w>>3,i-=R,w-=R<<3,p&=(1<<w)-1,e.next_in=i,e.next_out=s,e.avail_in=i<a?5+(a-i):5-(i-a),e.avail_out=s<f?257+(f-s):257-(s-f),n.hold=p,n.bits=w}});var cu=C((_x,ou)=>{"use strict";var ru=le(),_r=15,nu=852,iu=592,au=0,Ka=1,su=2,Ng=[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],jg=[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],Ug=[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],Mg=[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];ou.exports=function(e,r,n,i,a,s,o,f){var l=f.bits,c=0,u=0,d=0,h=0,p=0,w=0,E=0,g=0,m=0,x=0,$,S,R,b,y,_=null,A=0,k,T=new ru.Buf16(_r+1),B=new ru.Buf16(_r+1),M=null,et=0,gt,yt,Pt;for(c=0;c<=_r;c++)T[c]=0;for(u=0;u<i;u++)T[r[n+u]]++;for(p=l,h=_r;h>=1&&T[h]===0;h--);if(p>h&&(p=h),h===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,f.bits=1,0;for(d=1;d<h&&T[d]===0;d++);for(p<d&&(p=d),g=1,c=1;c<=_r;c++)if(g<<=1,g-=T[c],g<0)return-1;if(g>0&&(e===au||h!==1))return-1;for(B[1]=0,c=1;c<_r;c++)B[c+1]=B[c]+T[c];for(u=0;u<i;u++)r[n+u]!==0&&(o[B[r[n+u]]++]=u);if(e===au?(_=M=o,k=19):e===Ka?(_=Ng,A-=257,M=jg,et-=257,k=256):(_=Ug,M=Mg,k=-1),x=0,u=0,c=d,y=s,w=p,E=0,R=-1,m=1<<p,b=m-1,e===Ka&&m>nu||e===su&&m>iu)return 1;for(;;){gt=c-E,o[u]<k?(yt=0,Pt=o[u]):o[u]>k?(yt=M[et+o[u]],Pt=_[A+o[u]]):(yt=96,Pt=0),$=1<<c-E,S=1<<w,d=S;do S-=$,a[y+(x>>E)+S]=gt<<24|yt<<16|Pt|0;while(S!==0);for($=1<<c-1;x&$;)$>>=1;if($!==0?(x&=$-1,x+=$):x=0,u++,--T[c]===0){if(c===h)break;c=r[n+o[u]]}if(c>p&&(x&b)!==R){for(E===0&&(E=p),y+=d,w=c-E,g=1<<w;w+E<h&&(g-=T[w+E],!(g<=0));)w++,g<<=1;if(m+=1<<w,e===Ka&&m>nu||e===su&&m>iu)return 1;R=x&b,a[R]=p<<24|w<<16|y-s|0}}return x!==0&&(a[y+x]=c-E<<24|64<<16|0),f.bits=p,0}});var Gu=C(Gt=>{"use strict";var Dt=le(),ns=Ma(),ie=Fa(),Fg=eu(),cn=cu(),zg=0,Bu=1,Du=2,fu=4,Lg=5,vi=6,Ge=0,Gg=1,Hg=2,Ft=-2,Nu=-3,is=-4,qg=-5,lu=8,ju=1,uu=2,du=3,hu=4,pu=5,wu=6,mu=7,gu=8,yu=9,bu=10,Si=11,he=12,Ja=13,_u=14,Qa=15,vu=16,xu=17,Eu=18,Su=19,xi=20,Ei=21,ku=22,$u=23,Au=24,Ou=25,Ru=26,ts=27,Tu=28,Cu=29,Y=30,as=31,Wg=32,Zg=852,Vg=592,Xg=15,Yg=Xg;function Iu(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function Kg(){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 Dt.Buf16(320),this.work=new Dt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Uu(t){var e;return!t||!t.state?Ft:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=ju,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Dt.Buf32(Zg),e.distcode=e.distdyn=new Dt.Buf32(Vg),e.sane=1,e.back=-1,Ge)}function Mu(t){var e;return!t||!t.state?Ft:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,Uu(t))}function Fu(t,e){var r,n;return!t||!t.state||(n=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Ft:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,Mu(t))}function zu(t,e){var r,n;return t?(n=new Kg,t.state=n,n.window=null,r=Fu(t,e),r!==Ge&&(t.state=null),r):Ft}function Jg(t){return zu(t,Yg)}var Pu=!0,es,rs;function Qg(t){if(Pu){var e;for(es=new Dt.Buf32(512),rs=new Dt.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(cn(Bu,t.lens,0,288,es,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;cn(Du,t.lens,0,32,rs,0,t.work,{bits:5}),Pu=!1}t.lencode=es,t.lenbits=9,t.distcode=rs,t.distbits=5}function Lu(t,e,r,n){var i,a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Dt.Buf8(a.wsize)),n>=a.wsize?(Dt.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),Dt.arraySet(a.window,e,r-n,i,a.wnext),n-=i,n?(Dt.arraySet(a.window,e,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function ty(t,e){var r,n,i,a,s,o,f,l,c,u,d,h,p,w,E=0,g,m,x,$,S,R,b,y,_=new Dt.Buf8(4),A,k,T=[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 Ft;r=t.state,r.mode===he&&(r.mode=Ja),s=t.next_out,i=t.output,f=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,l=r.hold,c=r.bits,u=o,d=f,y=Ge;t:for(;;)switch(r.mode){case ju:if(r.wrap===0){r.mode=Ja;break}for(;c<16;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(r.wrap&2&&l===35615){r.check=0,_[0]=l&255,_[1]=l>>>8&255,r.check=ie(r.check,_,2,0),l=0,c=0,r.mode=uu;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){t.msg="incorrect header check",r.mode=Y;break}if((l&15)!==lu){t.msg="unknown compression method",r.mode=Y;break}if(l>>>=4,c-=4,b=(l&15)+8,r.wbits===0)r.wbits=b;else if(b>r.wbits){t.msg="invalid window size",r.mode=Y;break}r.dmax=1<<b,t.adler=r.check=1,r.mode=l&512?bu:he,l=0,c=0;break;case uu:for(;c<16;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(r.flags=l,(r.flags&255)!==lu){t.msg="unknown compression method",r.mode=Y;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Y;break}r.head&&(r.head.text=l>>8&1),r.flags&512&&(_[0]=l&255,_[1]=l>>>8&255,r.check=ie(r.check,_,2,0)),l=0,c=0,r.mode=du;case du:for(;c<32;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.head&&(r.head.time=l),r.flags&512&&(_[0]=l&255,_[1]=l>>>8&255,_[2]=l>>>16&255,_[3]=l>>>24&255,r.check=ie(r.check,_,4,0)),l=0,c=0,r.mode=hu;case hu:for(;c<16;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.head&&(r.head.xflags=l&255,r.head.os=l>>8),r.flags&512&&(_[0]=l&255,_[1]=l>>>8&255,r.check=ie(r.check,_,2,0)),l=0,c=0,r.mode=pu;case pu:if(r.flags&1024){for(;c<16;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.length=l,r.head&&(r.head.extra_len=l),r.flags&512&&(_[0]=l&255,_[1]=l>>>8&255,r.check=ie(r.check,_,2,0)),l=0,c=0}else r.head&&(r.head.extra=null);r.mode=wu;case wu:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Dt.arraySet(r.head.extra,n,a,h,b)),r.flags&512&&(r.check=ie(r.check,n,h,a)),o-=h,a+=h,r.length-=h),r.length))break t;r.length=0,r.mode=mu;case mu:if(r.flags&2048){if(o===0)break t;h=0;do b=n[a+h++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b));while(b&&h<o);if(r.flags&512&&(r.check=ie(r.check,n,h,a)),o-=h,a+=h,b)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=gu;case gu:if(r.flags&4096){if(o===0)break t;h=0;do b=n[a+h++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b));while(b&&h<o);if(r.flags&512&&(r.check=ie(r.check,n,h,a)),o-=h,a+=h,b)break t}else r.head&&(r.head.comment=null);r.mode=yu;case yu:if(r.flags&512){for(;c<16;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(l!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Y;break}l=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=he;break;case bu:for(;c<32;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}t.adler=r.check=Iu(l),l=0,c=0,r.mode=Si;case Si:if(r.havedict===0)return t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=o,r.hold=l,r.bits=c,Hg;t.adler=r.check=1,r.mode=he;case he:if(e===Lg||e===vi)break t;case Ja:if(r.last){l>>>=c&7,c-=c&7,r.mode=ts;break}for(;c<3;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}switch(r.last=l&1,l>>>=1,c-=1,l&3){case 0:r.mode=_u;break;case 1:if(Qg(r),r.mode=xi,e===vi){l>>>=2,c-=2;break t}break;case 2:r.mode=xu;break;case 3:t.msg="invalid block type",r.mode=Y}l>>>=2,c-=2;break;case _u:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Y;break}if(r.length=l&65535,l=0,c=0,r.mode=Qa,e===vi)break t;case Qa:r.mode=vu;case vu:if(h=r.length,h){if(h>o&&(h=o),h>f&&(h=f),h===0)break t;Dt.arraySet(i,n,a,h,s),o-=h,a+=h,f-=h,s+=h,r.length-=h;break}r.mode=he;break;case xu:for(;c<14;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(r.nlen=(l&31)+257,l>>>=5,c-=5,r.ndist=(l&31)+1,l>>>=5,c-=5,r.ncode=(l&15)+4,l>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Y;break}r.have=0,r.mode=Eu;case Eu:for(;r.have<r.ncode;){for(;c<3;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.lens[T[r.have++]]=l&7,l>>>=3,c-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},y=cn(zg,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,y){t.msg="invalid code lengths set",r.mode=Y;break}r.have=0,r.mode=Su;case Su:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[l&(1<<r.lenbits)-1],g=E>>>24,m=E>>>16&255,x=E&65535,!(g<=c);){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(x<16)l>>>=g,c-=g,r.lens[r.have++]=x;else{if(x===16){for(k=g+2;c<k;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(l>>>=g,c-=g,r.have===0){t.msg="invalid bit length repeat",r.mode=Y;break}b=r.lens[r.have-1],h=3+(l&3),l>>>=2,c-=2}else if(x===17){for(k=g+3;c<k;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,b=0,h=3+(l&7),l>>>=3,c-=3}else{for(k=g+7;c<k;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,b=0,h=11+(l&127),l>>>=7,c-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Y;break}for(;h--;)r.lens[r.have++]=b}}if(r.mode===Y)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Y;break}if(r.lenbits=9,A={bits:r.lenbits},y=cn(Bu,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,y){t.msg="invalid literal/lengths set",r.mode=Y;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},y=cn(Du,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,y){t.msg="invalid distances set",r.mode=Y;break}if(r.mode=xi,e===vi)break t;case xi:r.mode=Ei;case Ei:if(o>=6&&f>=258){t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=o,r.hold=l,r.bits=c,Fg(t,d),s=t.next_out,i=t.output,f=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,l=r.hold,c=r.bits,r.mode===he&&(r.back=-1);break}for(r.back=0;E=r.lencode[l&(1<<r.lenbits)-1],g=E>>>24,m=E>>>16&255,x=E&65535,!(g<=c);){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(m&&(m&240)===0){for($=g,S=m,R=x;E=r.lencode[R+((l&(1<<$+S)-1)>>$)],g=E>>>24,m=E>>>16&255,x=E&65535,!($+g<=c);){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}l>>>=$,c-=$,r.back+=$}if(l>>>=g,c-=g,r.back+=g,r.length=x,m===0){r.mode=Ru;break}if(m&32){r.back=-1,r.mode=he;break}if(m&64){t.msg="invalid literal/length code",r.mode=Y;break}r.extra=m&15,r.mode=ku;case ku:if(r.extra){for(k=r.extra;c<k;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=$u;case $u:for(;E=r.distcode[l&(1<<r.distbits)-1],g=E>>>24,m=E>>>16&255,x=E&65535,!(g<=c);){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if((m&240)===0){for($=g,S=m,R=x;E=r.distcode[R+((l&(1<<$+S)-1)>>$)],g=E>>>24,m=E>>>16&255,x=E&65535,!($+g<=c);){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}l>>>=$,c-=$,r.back+=$}if(l>>>=g,c-=g,r.back+=g,m&64){t.msg="invalid distance code",r.mode=Y;break}r.offset=x,r.extra=m&15,r.mode=Au;case Au:if(r.extra){for(k=r.extra;c<k;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Y;break}r.mode=Ou;case Ou:if(f===0)break t;if(h=d-f,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Y;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),w=r.window}else w=i,p=s-r.offset,h=r.length;h>f&&(h=f),f-=h,r.length-=h;do i[s++]=w[p++];while(--h);r.length===0&&(r.mode=Ei);break;case Ru:if(f===0)break t;i[s++]=r.length,f--,r.mode=Ei;break;case ts:if(r.wrap){for(;c<32;){if(o===0)break t;o--,l|=n[a++]<<c,c+=8}if(d-=f,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?ie(r.check,i,d,s-d):ns(r.check,i,d,s-d)),d=f,(r.flags?l:Iu(l))!==r.check){t.msg="incorrect data check",r.mode=Y;break}l=0,c=0}r.mode=Tu;case Tu:if(r.wrap&&r.flags){for(;c<32;){if(o===0)break t;o--,l+=n[a++]<<c,c+=8}if(l!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Y;break}l=0,c=0}r.mode=Cu;case Cu:y=Gg;break t;case Y:y=Nu;break t;case as:return is;case Wg:default:return Ft}return t.next_out=s,t.avail_out=f,t.next_in=a,t.avail_in=o,r.hold=l,r.bits=c,(r.wsize||d!==t.avail_out&&r.mode<Y&&(r.mode<ts||e!==fu))&&Lu(t,t.output,t.next_out,d-t.avail_out)?(r.mode=as,is):(u-=t.avail_in,d-=t.avail_out,t.total_in+=u,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?ie(r.check,i,d,t.next_out-d):ns(r.check,i,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===he?128:0)+(r.mode===xi||r.mode===Qa?256:0),(u===0&&d===0||e===fu)&&y===Ge&&(y=qg),y)}function ey(t){if(!t||!t.state)return Ft;var e=t.state;return e.window&&(e.window=null),t.state=null,Ge}function ry(t,e){var r;return!t||!t.state||(r=t.state,(r.wrap&2)===0)?Ft:(r.head=e,e.done=!1,Ge)}function ny(t,e){var r=e.length,n,i,a;return!t||!t.state||(n=t.state,n.wrap!==0&&n.mode!==Si)?Ft:n.mode===Si&&(i=1,i=ns(i,e,r,0),i!==n.check)?Nu:(a=Lu(t,e,r,r),a?(n.mode=as,is):(n.havedict=1,Ge))}Gt.inflateReset=Mu;Gt.inflateReset2=Fu;Gt.inflateResetKeep=Uu;Gt.inflateInit=Jg;Gt.inflateInit2=zu;Gt.inflate=ty;Gt.inflateEnd=ey;Gt.inflateGetHeader=ry;Gt.inflateSetDictionary=ny;Gt.inflateInfo="pako inflate (from Nodeca project)"});var ss=C((xx,Hu)=>{"use strict";Hu.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 Wu=C((Ex,qu)=>{"use strict";function iy(){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}qu.exports=iy});var Vu=C(ln=>{"use strict";var vr=Gu(),fn=le(),ki=qa(),tt=ss(),os=di(),ay=Wa(),sy=Wu(),Zu=Object.prototype.toString;function He(t){if(!(this instanceof He))return new He(t);this.options=fn.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)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ay,this.strm.avail_out=0;var r=vr.inflateInit2(this.strm,e.windowBits);if(r!==tt.Z_OK)throw new Error(os[r]);if(this.header=new sy,vr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ki.string2buf(e.dictionary):Zu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=vr.inflateSetDictionary(this.strm,e.dictionary),r!==tt.Z_OK)))throw new Error(os[r])}He.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,o,f,l,c=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?tt.Z_FINISH:tt.Z_NO_FLUSH,typeof t=="string"?r.input=ki.binstring2buf(t):Zu.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 fn.Buf8(n),r.next_out=0,r.avail_out=n),a=vr.inflate(r,tt.Z_NO_FLUSH),a===tt.Z_NEED_DICT&&i&&(a=vr.inflateSetDictionary(this.strm,i)),a===tt.Z_BUF_ERROR&&c===!0&&(a=tt.Z_OK,c=!1),a!==tt.Z_STREAM_END&&a!==tt.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===tt.Z_STREAM_END||r.avail_in===0&&(s===tt.Z_FINISH||s===tt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=ki.utf8border(r.output,r.next_out),f=r.next_out-o,l=ki.buf2string(r.output,o),r.next_out=f,r.avail_out=n-f,f&&fn.arraySet(r.output,r.output,o,f,0),this.onData(l)):this.onData(fn.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==tt.Z_STREAM_END);return a===tt.Z_STREAM_END&&(s=tt.Z_FINISH),s===tt.Z_FINISH?(a=vr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===tt.Z_OK):(s===tt.Z_SYNC_FLUSH&&(this.onEnd(tt.Z_OK),r.avail_out=0),!0)};He.prototype.onData=function(t){this.chunks.push(t)};He.prototype.onEnd=function(t){t===tt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=fn.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function cs(t,e){var r=new He(e);if(r.push(t,!0),r.err)throw r.msg||os[r.err];return r.result}function oy(t,e){return e=e||{},e.raw=!0,cs(t,e)}ln.Inflate=He;ln.inflate=cs;ln.inflateRaw=oy;ln.ungzip=cs});var fs=C((kx,Yu)=>{"use strict";var cy=le().assign,fy=Ql(),ly=Vu(),uy=ss(),Xu={};cy(Xu,fy,ly,uy);Yu.exports=Xu});var ls=C(($x,Ju)=>{"use strict";var Ku=(t,e)=>function(...r){let n=e.promiseModule;return new n((i,a)=>{e.multiArgs?r.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?r.push((s,o)=>{s?a(s):i(o)}):r.push(i),t.apply(this,r)})};Ju.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 n=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;r==="function"?i=function(...a){return e.excludeMain?t(...a):Ku(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&n(a)?Ku(s,e):s}return i}});var gs=C((Ax,sd)=>{function Qu(t){return Array.isArray(t)?t:[t]}var hs="",td=" ",us="\\",dy=/^\s+$/,hy=/(?:[^\\]|^)\\$/,py=/^\\!/,wy=/^\\#/,my=/\r?\n/g,gy=/^\.*\/|^\.+$/,ds="/",nd="node-ignore";typeof Symbol<"u"&&(nd=Symbol.for("node-ignore"));var ed=nd,yy=(t,e,r)=>Object.defineProperty(t,e,{value:r}),by=/([0-z])-([0-z])/g,id=()=>!1,_y=t=>t.replace(by,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:hs),vy=t=>{let{length:e}=t;return t.slice(0,e-e%2)},xy=[[/^\uFEFF/,()=>hs],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?td:hs)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+td}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>us],[/\\\\/g,()=>us],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===us?`\\[${r}${vy(n)}${i}`:i==="]"&&n.length%2===0?`[${_y(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],rd=Object.create(null),Ey=(t,e)=>{let r=rd[t];return r||(r=xy.reduce((n,[i,a])=>n.replace(i,a.bind(t)),t),rd[t]=r),e?new RegExp(r,"i"):new RegExp(r)},ms=t=>typeof t=="string",Sy=t=>t&&ms(t)&&!dy.test(t)&&!hy.test(t)&&t.indexOf("#")!==0,ky=t=>t.split(my),ps=class{constructor(e,r,n,i){this.origin=e,this.pattern=r,this.negative=n,this.regex=i}},$y=(t,e)=>{let r=t,n=!1;t.indexOf("!")===0&&(n=!0,t=t.substr(1)),t=t.replace(py,"!").replace(wy,"#");let i=Ey(t,e);return new ps(r,t,n,i)},Ay=(t,e)=>{throw new e(t)},pe=(t,e,r)=>ms(t)?t?pe.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),ad=t=>gy.test(t);pe.isNotRelative=ad;pe.convert=t=>t;var ws=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){yy(this,ed,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[ed]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(Sy(e)){let r=$y(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,Qu(ms(e)?ky(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let n=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&n!==i||s&&!n&&!i&&!r)return;a.regex.test(e)&&(n=!s,i=s)}),{ignored:n,unignored:i}}_test(e,r,n,i){let a=e&&pe.convert(e);return pe(a,e,this._allowRelativePaths?id:Ay),this._t(a,r,n,i)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(ds)),i.pop(),!i.length)return r[e]=this._testOne(e,n);let a=this._t(i.join(ds)+ds,r,n,i);return r[e]=a.ignored?a:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Qu(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},$i=t=>new ws(t),Oy=t=>pe(t&&pe.convert(t),t,id);$i.isPathValid=Oy;$i.default=$i;sd.exports=$i;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");pe.convert=t;let e=/^[a-z]:\//i;pe.isNotRelative=r=>e.test(r)||ad(r)}});var cd=C((Ox,od)=>{od.exports=function(t,e){var r=t,n=e,i=r.length,a=n.length,s=!1,o=null,f=i+1,l=[],c=[],u=[],d="",h=-1,p=0,w=1,E,g,m=function(){i>=a&&(E=r,g=i,r=n,n=E,i=a,a=g,s=!0,f=i+1)},x=function(b,y,_){return{x:b,y,k:_}},$=function(b,y){return{elem:b,t:y}},S=function(b,y,_){var A,k,T;for(y>_?A=l[b-1+f]:A=l[b+1+f],T=Math.max(y,_),k=T-b;k<i&&T<a&&r[k]===n[T];)++k,++T;return l[b+f]=c.length,c[c.length]=new x(k,T,A),T},R=function(b){var y,_,A,k,T;for(y=_=1,A=k=0,T=b.length-1;T>=0;--T)for(;A<b[T].x||k<b[T].y;)b[T].y-b[T].x>k-A?(s?u[u.length]=new $(n[k],h):u[u.length]=new $(n[k],w),++_,++k):b[T].y-b[T].x<k-A?(s?u[u.length]=new $(r[A],w):u[u.length]=new $(r[A],h),++y,++A):(u[u.length]=new $(r[A],p),d+=r[A],++y,++_,++A,++k)};return m(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return o},getlcs:function(){return d},getses:function(){return u},compose:function(){var b,y,_,A,k,T,B,M;for(b=a-i,y=i+a+3,_={},B=0;B<y;++B)_[B]=-1,l[B]=-1;A=-1;do{for(++A,M=-A;M<=b-1;++M)_[M+f]=S(M,_[M-1+f]+1,_[M+1+f]);for(M=b+A;M>=b+1;--M)_[M+f]=S(M,_[M-1+f]+1,_[M+1+f]);_[b+f]=S(b,_[b-1+f]+1,_[b+1+f])}while(_[b+f]!==a);for(o=b+2*A,k=l[b+f],T=[];k!==-1;)T[T.length]=new x(c[k].x,c[k].y,null),k=c[k].k;R(T)}}}});var ud=C((Rx,ld)=>{var Ry=cd();function Ty(t,e){var r=new Ry(t,e);r.compose();for(var n=r.getses(),i,a,s=t.length-1,o=e.length-1,f=n.length-1;f>=0;--f)n[f].t===r.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):n[f].t===r.SES_DELETE?s--:n[f].t===r.SES_ADD&&o--;var l={file1index:-1,file2index:-1,chain:null};return a?(a.chain=l,i):l}function fd(t,e){for(var r=[],n=t.length,i=e.length,a=Ty(t,e);a!==null;a=a.chain){var s=n-a.file1index-1,o=i-a.file2index-1;n=a.file1index,i=a.file2index,(s||o)&&r.push({file1:[n+1,s],file2:[i+1,o]})}return r.reverse(),r}function Cy(t,e,r){var n,i=fd(e,t),a=fd(e,r),s=[];function o(B,M){s.push([B.file1[0],M,B.file1[1],B.file2[0],B.file2[1]])}for(n=0;n<i.length;n++)o(i[n],0);for(n=0;n<a.length;n++)o(a[n],2);s.sort(function(B,M){return B[0]-M[0]});var f=[],l=0;function c(B){B>l&&(f.push([1,l,B-l]),l=B)}for(var u=0;u<s.length;u++){for(var d=u,h=s[u],p=h[0],w=p+h[2];u<s.length-1;){var E=s[u+1],g=E[0];if(g>w)break;w=Math.max(w,g+E[2]),u++}if(c(p),d==u)h[4]>0&&f.push([h[1],h[3],h[4]]);else{var m={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(n=d;n<=u;n++){h=s[n];var x=h[1],$=m[x],S=h[0],R=S+h[2],b=h[3],y=b+h[4];$[0]=Math.min(b,$[0]),$[1]=Math.max(y,$[1]),$[2]=Math.min(S,$[2]),$[3]=Math.max(R,$[3])}var _=m[0][0]+(p-m[0][2]),A=m[0][1]+(w-m[0][3]),k=m[2][0]+(p-m[2][2]),T=m[2][1]+(w-m[2][3]);f.push([-1,_,A-_,p,w-p,k,T-k])}l=w}return c(e.length),f}function Iy(t,e,r){var n=[],i=[t,e,r],a=Cy(t,e,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function f(h){for(var p=0;p<h.length;p++)s.push(h[p])}function l(h){if(h[2]!=h[6])return!0;for(var p=h[1],w=h[5],E=0;E<h[2];E++)if(t[E+p]!=r[E+w])return!0;return!1}for(var c=0;c<a.length;c++){var u=a[c],d=u[0];d==-1?l(u)?(o(),n.push({conflict:{a:t.slice(u[1],u[1]+u[2]),aIndex:u[1],o:e.slice(u[3],u[3]+u[4]),oIndex:u[3],b:r.slice(u[5],u[5]+u[6]),bIndex:u[5]}})):f(i[0].slice(u[1],u[1]+u[2])):f(i[d].slice(u[1],u[1]+u[2]))}return o(),n}ld.exports=Iy});var Be=C(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});function Ie(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Fd=Ie(Sa()),Py=Ie(ka()),kr=Ie($a()),By=Ie(Oa()),Ls=Ie(fs()),Dy=Ji("crypto"),Ai=Ie(ls()),Ny=Ie(gs()),jy=Ie(ud()),F=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){let e=this;return{code:e.code,data:e.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new t(e.message),n=r;return n.code=e.code,n.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},pn=class t extends F{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=t.code,this.data={filepaths:e}}};pn.code="UnmergedPathsError";var U=class t extends F{constructor(e){super(`An internal error caused this command to fail.
2
+
3
+ If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
4
+
5
+ If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};U.code="InternalError";var We=class t extends F{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};We.code="UnsafeFilepathError";var Ht=class{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 n=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,n}write(e,r,n){let i=this.buffer.write(e,this._start,r,n);return this._start+=r,i}copy(e,r,n){let i=e.copy(this.buffer,this._start,r,n);return this._start+=i,i}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}},dd=/[\ud800-￿]/;function hd(t,e,r){if(r<55296||r>57343)return!1;if(r<56320){let i=e+1<t.length?t.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?t.charCodeAt(e-1):0;return n<55296||n>56319}function Mi(t,e){if(!dd.test(t)&&!dd.test(e))return-(t<e)||+(t>e);let r=Math.min(t.length,e.length);for(let n=0;n<r;n++){let i=t.charCodeAt(n),a=e.charCodeAt(n);if(i!==a){if(hd(t,n,i)&&(i=65533),hd(e,n,a)&&(a=65533),i===a)continue;return i>=55296&&a>=55296&&(i+=i>=57344?-2048:8192,a+=a>=57344?-2048:8192),i<a?-1:1}}return t.length<e.length?-1:t.length>e.length?1:0}function zd(t,e){return Mi(t.path,e.path)}function Ld(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}var ae=2**32;function pd(t,e,r,n){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=n.valueOf());let i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function $e(t){let[e,r]=pd(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[n,i]=pd(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%ae,ctimeNanoseconds:r%ae,mtimeSeconds:n%ae,mtimeNanoseconds:i%ae,dev:t.dev%ae,ino:t.ino%ae,mode:Ld(t.mode%ae),uid:t.uid%ae,gid:t.gid%ae,size:t.size>-1?t.size%ae:0}}function Uy(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var ys=null;async function me(t){return ys===null&&(ys=await Fy()),ys?Gd(t):My(t)}function My(t){return new Fd().update(t).digest("hex")}async function Gd(t){let e=await crypto.subtle.digest("SHA-1",t);return Uy(e)}async function Fy(){try{return await Gd(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}function zy(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function Ly(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)}var Os=class t{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 t.fromBuffer(e);if(e===null)return new t(null);throw new U("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new U("Index file is empty (.git/index)");let r=new t,n=new Ht(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new U(`Invalid dircache magic file number: ${i}`);let a=await me(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new U(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=n.readUInt32BE();if(o!==2)throw new U(`Unsupported dircache version: ${o}`);let f=n.readUInt32BE(),l=0;for(;!n.eof()&&l<f;){let c={};c.ctimeSeconds=n.readUInt32BE(),c.ctimeNanoseconds=n.readUInt32BE(),c.mtimeSeconds=n.readUInt32BE(),c.mtimeNanoseconds=n.readUInt32BE(),c.dev=n.readUInt32BE(),c.ino=n.readUInt32BE(),c.mode=n.readUInt32BE(),c.uid=n.readUInt32BE(),c.gid=n.readUInt32BE(),c.size=n.readUInt32BE(),c.oid=n.slice(20).toString("hex");let u=n.readUInt16BE();c.flags=zy(u);let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new U(`Got a path length of: ${d}`);if(c.path=n.toString("utf8",d),c.path.includes("..\\")||c.path.includes("../"))throw new We(c.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new U(`Expected 1-8 null characters but got '${p}' after ${c.path}`);if(n.eof())throw new U("Unexpected end of file")}c.stages=[],r._addEntry(c),l++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(zd)}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:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=$e(r);let a=Buffer.from(e),s={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:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),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(`
6
+ `)}static async _entryToBuffer(e){let r=Buffer.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Ht(i),s=$e(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(Ly(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),r=new Ht(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let f of o.stages)f&&f!==o&&n.push(t._entryToBuffer(f));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([e,i]),s=await me(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Oi(t,e,r=!0,n=!0){let i=$e(t),a=$e(e);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size||i.mtimeNanoseconds!==a.mtimeNanoseconds||i.ctimeNanoseconds!==a.ctimeNanoseconds||a.mtimeSeconds>=Math.floor(Date.now()/1e3)-1}var bs;function Gy(){return bs===void 0&&(bs=new Py({maxPending:1/0})),bs}function lt(t,e){return Gy().acquire(t,e)}var _s=Symbol("IndexCache");function Hy(){return{map:new Map,stats:new Map}}async function qy(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await Os.from(i);r.map.set(e,a),r.stats.set(e,n)}async function Wy(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);if(i===null)return!1;if(Oi(n,i))return!0;let a=$e(n),s=$e(i);return a.mtimeNanoseconds!==s.mtimeNanoseconds||a.ctimeNanoseconds!==s.ctimeNanoseconds}var J=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[_s]||(n[_s]=Hy());let s=`${r}/index`,o,f=[];return await lt(s,async()=>{let l=n[_s];await Wy(e,s,l)&&await qy(e,s,l);let c=l.map.get(s);if(f=c.unmergedPaths,f.length&&!i)throw new pn(f);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),l.stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function Ri(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Ze(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function Hd(t){let e=new Map,r=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:Ri(i),metadata:{},children:[]};e.set(i,a),a.parent=r(Ze(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},n=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:Ri(i),metadata:a,parent:r(Ze(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function Zy(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 U(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Rs=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=J.acquire({fs:e,gitdir:r,cache:n},async function(a){return Hd(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let r=e._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Mi),a}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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:$e(n.metadata);e._type=n.type==="tree"?"tree":Zy(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},Fi=Symbol("GitWalkSymbol");function ge(){let t=Object.create(null);return Object.defineProperty(t,Fi,{value:function({fs:e,gitdir:r,cache:n}){return new Rs({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var H=class t extends F{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};H.code="NotFoundError";var ut=class t extends F{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};ut.code="ObjectTypeError";var Ae=class t extends F{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ae.code="InvalidOidError";var Nt=class t extends F{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};Nt.code="InvalidRefNameError";var wn=class t extends F{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
7
+ [remote "${e}"]
8
+ fetch = +refs/heads/*:refs/remotes/origin/*
9
+ `),this.code=this.name=t.code,this.data={remote:e}}};wn.code="NoRefspecError";var Ti=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
10
+ `).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{let a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(e){return new t(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(`
11
+ `)+`
12
+ `}},Ci=class t{constructor({remotePath:e,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:r,force:n,matchPrefix:i})}static from(e){let[r,n,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",f=i==="*";if(f!==(s==="*"))throw new U("Invalid refspec");return new t({remotePath:n,localPath:a,force:o,matchPrefix:f})}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}},Ts=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(Ci.from(n));return new t(r)}add(e){let r=Ci.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(e){let r=null;for(let n of this.rules){let i=n.translate(e);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function Vy(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?t.endsWith("^{}")?1:-1:i}var Xy=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function $r(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!Xy.test(t)&&(!!e||t.includes("/"))}function Yy(t,e){let r="",n=0,i=-1,a=0,s="\0";for(let o=0;o<=t.length;++o){if(o<t.length)s=t[o];else{if(s==="/")break;s="/"}if(s==="/"){if(!(i===o-1||a===1))if(a===2){if(r.length<2||n!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let f=r.lastIndexOf("/");f===-1?(r="",n=0):(r=r.slice(0,f),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}else if(r.length!==0){r="",n=0,i=o,a=0;continue}}e&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s==="."&&a!==-1?++a:a=-1}return r}function Ky(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function Jy(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=Ky(t),r=t[0]==="/"||e!==null&&t[2]==="/",n=t.at(-1)==="/",i=e?t.slice(2):t,a=Yy(i,!r);if(!a.length){let s=e?r?e+"/":e:r?"/":".";return n&&!r?s+"/":s}return n&&(a+="/"),e?r?`${e}/${a}`:`${e}${a}`:r?`/${a}`:a}function O(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let n=t[r].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":Jy(e)}var Qy=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},un=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}`)},wd={core:{filemode:un,bare:un,logallrefupdates:un,symlinks:un,ignorecase:un,bigFileThreshold:Qy}},tb=/^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/,eb=/^[A-Za-z0-9-.]+$/,rb=/^([A-Za-z][A-Za-z0-9-]*)(?:\s*=\s*(.*))?$/,nb=/^[A-Za-z][A-Za-z0-9-]*$/,ib=t=>{let e=tb.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n&&n.replace(/\\(.)/g,"$1")]}return null},ab=t=>{let e=rb.exec(t);if(e!=null){let[r,n="true"]=e.slice(1);return[r,sb(n)]}return null},md=new Map([["t"," "],["b","\b"],["n",`
13
+ `],["\\","\\"],['"','"']]),sb=t=>{let e="",r="",n=!1;for(let i=0;i<t.length;i++){let a=t[i];if(!n&&/[ \t\r\v\f]/.test(a)){e!==""&&(r+=a);continue}if(!n&&(a==="#"||a===";"))break;e+=r,r="",a==="\\"&&md.has(t[i+1])?e+=md.get(t[++i]):a==='"'?n=!n:e+=a}return e},ob=t=>{if(typeof t!="string")return t;let e=t.startsWith(" ")||t.endsWith(" ")||/[#;]/.test(t)?'"':"",r=t.replace(/[\\"\n\t]/g,n=>n===`
14
+ `?"\\n":n===" "?"\\t":`\\${n}`);return`${e}${r}${e}`},gd=t=>t!=null?t.toLowerCase():null,Cs=(t,e,r)=>[gd(t),e,gd(r)].filter(n=>n!=null).join("."),yd=t=>{let e=t.split("."),r=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:r,subsection:i,name:n,path:Cs(r,i,n),sectionPath:Cs(r,i,null),isSection:!!r}},cb=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),Is=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(`
15
+ `).map(i=>{let a=null,s=null,o=i.trim(),f=ib(o),l=f!=null;if(l)[r,n]=f;else{let u=ab(o);u!=null&&([a,s]=u)}let c=Cs(r,n,a);return{line:i,isSection:l,section:r,subsection:n,name:a,value:s,path:c}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=yd(e).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let f=wd[a]&&wd[a][s];return f?f(o):o});return r?i:i.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(n=>!(n.section===e&&n.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:f,isSection:l}=yd(e),c=cb(this.parsedConfig,u=>u.path===o);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],d=Object.assign({},u,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{let u=this.parsedConfig.findIndex(h=>h.path===f),d={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(eb.test(i)&&nb.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,d);else{let h={isSection:l,section:i,subsection:a,modified:!0,path:f};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:n,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?` ${i} = ${ob(a)}`:n!=null?`[${r} "${n}"]`:`[${r}]`:e).join(`
16
+ `)}},Q=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return Is.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},dn=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],Ps=["config","description","index","shallow","commondir"];function qe(t){if(Ps.includes(t))throw new Nt(t,`refs/heads/${t}`);if(!$r(t,!0))throw new Nt(t,kr.clean(t))}var I=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:f=!1,pruneTags:l=!1}){for(let g of i.values())if(!g.match(/[0-9a-f]{40}/))throw new Ae(g);let c=await Q.get({fs:e,gitdir:r});if(!o){if(o=await c.getall(`remote.${n}.fetch`),o.length===0)throw new wn(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let u=Ts.from(o),d=new Map,h=u.translate([...i.keys()]),p=[];for(let[g,m]of u.translate([...a.keys()])){let x=u.translateOne(a.get(g));x&&(qe(x),p.push([m,`ref: ${x}`]))}let w=s?[...i.keys()].filter(g=>g.startsWith("refs/tags")&&!g.endsWith("^{}")):[];for(let[,g]of h)qe(g);for(let[g]of p)qe(g);if(w.forEach(qe),l){let g=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:g.map(m=>`refs/tags/${m}`)})}for(let g of w)if(!await t.exists({fs:e,gitdir:r,ref:g})){let m=i.get(g);d.set(g,m)}for(let[g,m]of h){let x=i.get(g);d.set(m,x)}for(let[g,m]of p)d.set(g,m);let E=[];if(f){for(let g of u.localNamespaces()){let m=(await t.listRefs({fs:e,gitdir:r,filepath:g})).map(x=>`${g}/${x}`);for(let x of m)d.has(x)||E.push(x)}E.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:E})}for(let[g,m]of d)await lt(g,async()=>e.write(O(r,g),`${m.trim()}
17
+ `,"utf8"));return{pruned:E}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(qe(n),!i.match(/[0-9a-f]{40}/))throw new Ae(i);await lt(n,async()=>e.write(O(r,n),`${i.trim()}
18
+ `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){qe(n),await lt(n,async()=>e.write(O(r,n),`ref: ${i.trim()}
19
+ `,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:n}){return t.deleteRefs({fs:e,gitdir:r,refs:[n]})}static async deleteRefs({fs:e,gitdir:r,refs:n}){n.forEach(qe),await Promise.all(n.map(o=>e.rm(O(r,o))));let i=await lt("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),a=Ti.from(i),s=a.refs.size;for(let o of n)a.refs.has(o)&&a.delete(o);a.refs.size<s&&(i=a.toString(),await lt("packed-refs",async()=>e.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:n,depth:i=void 0,visited:a=new Set}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),t.resolve({fs:e,gitdir:r,ref:n,depth:i,visited:a});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let s=await t.packedRefs({fs:e,gitdir:r}),o=dn(n).filter(f=>!Ps.includes(f));for(let f of o){let l=await lt(f,async()=>await e.read(`${r}/${f}`,{encoding:"utf8"})||s.get(f));if(l){if(a.has(f))throw new U(`Circular reference detected while resolving ref "${f}"`);return a.add(f),t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i,visited:a})}}throw new H(n)}static async isUnbornBranch({fs:e,gitdir:r,ref:n}){let i;try{i=await t.resolve({fs:e,gitdir:r,ref:"HEAD",depth:2})}catch(a){if(a instanceof H)return!1;throw a}return i.startsWith("refs/heads/")?n==="HEAD"||dn(n).includes(i):!1}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch(i){if(i instanceof H)return!1;throw i}}static async expand({fs:e,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await t.packedRefs({fs:e,gitdir:r}),a=dn(n).filter(s=>!Ps.includes(s));for(let s of a)if(await lt(s,async()=>e.exists(`${r}/${s}`))||i.has(s))return s;throw new H(n)}static async expandAgainstMap({ref:e,map:r}){let n=dn(e);for(let i of n)if(await r.has(i))return i;throw new H(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let a=dn(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new H(e)}static async packedRefs({fs:e,gitdir:r}){let n=await lt("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Ti.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=await t.packedRefs({fs:e,gitdir:r}),a=null;try{a=await e.readdirDeep(`${r}/${n}`),a=a.map(s=>s.replace(`${r}/${n}/`,""))}catch{a=[]}for(let s of i.keys())s.startsWith(n)&&(s=s.replace(n+"/",""),a.includes(s)||a.push(s));return a.sort(Vy),a}static async listBranches({fs:e,gitdir:r,remote:n}){return n?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${n}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function fb(t,e){return Mi(bd(t),bd(e))}function bd(t){return t.mode==="040000"?t.path+"/":t.path}function qd(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 U(`Unexpected GitTree entry mode: ${t}`)}function lb(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf(32,r);if(n===-1)throw new U(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let i=t.indexOf(0,r);if(i===-1)throw new U(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=t.slice(r,n).toString("utf8");a==="40000"&&(a="040000");let s=qd(a),o=t.slice(n+1,i).toString("utf8"),f=o.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),c=f.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(o.includes("\\")||o.includes("/")||f==="."||f===".."||c===".git"||/^\.?git~[1-9]$/.test(c))throw new We(o);let u=t.slice(i+1,i+21).toString("hex");r=i+21,e.push({mode:a,path:o,oid:u,type:s})}return e}function ub(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 U(`Could not understand file mode: ${t}`)}function db(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=ub(t.mode),t.type||(t.type=qd(t.mode)),t}var Ot=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=lb(e);else if(Array.isArray(e))this._entries=e.map(db);else throw new U("invalid type passed to GitTree constructor");this._entries.sort(zd)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
20
+ `)}toObject(){let e=[...this._entries];return e.sort(fb),Buffer.concat(e.map(r=>{let n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Oe=class{static wrap({type:e,object:r}){let n=`${e} ${r.length}\0`,i=n.length,a=i+r.length,s=new Uint8Array(a);for(let o=0;o<i;o++)s[o]=n.charCodeAt(o);return s.set(r,i),s}static unwrap(e){let r=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,r).toString("utf8"),a=e.slice(r+1,n).toString("utf8"),s=e.length-(n+1);if(parseInt(a)!==s)throw new U(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(n+1))}}};async function Wd({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await t.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function hb(t,e){let r=new Ht(t),n=_d(r);if(n!==e.byteLength)throw new U(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=_d(r),a,s=xd(r,e);if(s.byteLength===i)a=s;else{let o=[s],f=s.byteLength;for(;!r.eof();){let l=xd(r,e);o.push(l),f+=l.byteLength}if(i!==f)throw new U(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${f} bytes`);a=Buffer.concat(o,i)}return a}function _d(t){let e=0,r=0,n=null;do n=t.readUInt8(),e|=(n&127)<<r,r+=7;while(n&128);return e}function vd(t,e,r){let n=0,i=0;for(;r--;)e&1&&(n|=t.readUInt8()<<i),e>>=1,i+=8;return n}function xd(t,e){let r=t.readUInt8(),n=128,i=15,a=112;if(r&n){let s=vd(t,r&i,4),o=vd(t,(r&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(r)}function pb(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function Zd(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:pb(t)}var Ii=class{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=Zd(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>wb(r);){let n=await this._next();if(this._ended)break;r.push(n)}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()}};function wb(t){return t.reduce((e,r)=>e+r.length,0)}async function mb(t,e){let r=new Ii(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new U(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new U(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){let s=r.tell(),{type:o,length:f,ofs:l,reference:c}=await gb(r),u=new Ls.Inflate;for(;!u.result;){let d=await r.chunk();if(!d)break;if(u.push(d,!1),u.err)throw new U(`Pako error: ${u.msg}`);if(u.result){if(u.result.length!==f)throw new U("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-u.strm.avail_in);let h=r.tell();await e({data:u.result,type:o,num:a,offset:s,end:h,reference:c,ofs:l})}}}}async function gb(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let s=4;do e=await t.byte(),n|=(e&127)<<s,s+=7;while(e&128)}let i,a;if(r===6){let s=0;i=0;let o=[];do e=await t.byte(),i|=(e&127)<<s,s+=7,o.push(e);while(e&128);a=Buffer.from(o)}return r===7&&(a=await t.read(20)),{type:r,length:n,ofs:i,reference:a}}var Ar=class t extends F{constructor(e){super(`Invalid compressed buffer: ${e}`),this.code=this.name=t.code,this.data={message:e}}};Ar.code="DecompressionError";async function yb(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);try{return new Uint8Array(await new Response(r).arrayBuffer())}catch(n){throw n&&n.name==="TypeError"&&n.message===""?new Ar("decompression failed"):n}}var vs=!1;async function Vd(t){vs===null&&(vs=bb());try{return vs?await yb(t):Ls.inflate(t)}catch(e){throw typeof e=="string"?new Ar(e):e}}function bb(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}function _b(t){let e=[],r=0,n=0;do{r=t.readUInt8();let i=r&127;e.push(i),n=r&128}while(n);return e.reduce((i,a)=>i+1<<7|a,-1)}function vb(t,e){let r=e,n=4,i=null;do i=t.readUInt8(),r|=(i&127)<<n,n+=7;while(i&128);return r}var mn=class t{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let n=new Ht(e);if(n.slice(4).toString("hex")!=="ff744f63")return;let a=n.readUInt32BE();if(a!==2)throw new U(`Unable to read version ${a} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new U("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+1020);let s=n.readUInt32BE(),o=[];for(let c=0;c<s;c++){let u=n.slice(20).toString("hex");o[c]=u}n.seek(n.tell()+4*s);let f=new Map;for(let c=0;c<s;c++)f.set(o[c],n.readUInt32BE());let l=n.slice(20).toString("hex");return new t({hashes:o,crcs:{},offsets:f,packfileSha:l,getExternalRefDelta:r})}static async fromPack({pack:e,getExternalRefDelta:r,onProgress:n}){let i={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},a={},s=e.slice(-20).toString("hex"),o=[],f={},l=new Map,c=null,u=null;await mb([e],async({data:E,type:g,reference:m,offset:x,num:$})=>{c===null&&(c=$);let S=Math.floor((c-$)*100/c);S!==u&&n&&await n({phase:"Receiving objects",loaded:c-$,total:c}),u=S,g=i[g],["commit","tree","blob","tag"].includes(g)?a[x]={type:g,offset:x}:g==="ofs-delta"?a[x]={type:g,offset:x}:g==="ref-delta"&&(a[x]={type:g,offset:x})});let d=Object.keys(a).map(Number);for(let[E,g]of d.entries()){let m=E+1===d.length?e.byteLength-20:d[E+1],x=a[g],$=By.buf(e.slice(g,m))>>>0;x.end=m,x.crc=$}let h=new t({pack:Promise.resolve(e),packfileSha:s,crcs:f,hashes:o,offsets:l,getExternalRefDelta:r});u=null;let p=0,w=[0,0,0,0,0,0,0,0,0,0,0,0];for(let E in a){E=Number(E);let g=Math.floor(p*100/c);g!==u&&n&&await n({phase:"Resolving deltas",loaded:p,total:c}),p++,u=g;let m=a[E];if(!m.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:x,object:$}=await h.readSlice({start:E});w[h.readDepth]+=1;let S=await me(Oe.wrap({type:x,object:$}));m.oid=S,o.push(S),l.set(S,E),f[S]=m.crc}catch{continue}}return o.sort(),h}async toBuffer(){let e=[],r=(l,c)=>{e.push(Buffer.from(l,c))};r("ff744f63","hex"),r("00000002","hex");let n=new Ht(Buffer.alloc(256*4));for(let l=0;l<256;l++){let c=0;for(let u of this.hashes)parseInt(u.slice(0,2),16)<=l&&c++;n.writeUInt32BE(c)}e.push(n.buffer);for(let l of this.hashes)r(l,"hex");let i=new Ht(Buffer.alloc(this.hashes.length*4));for(let l of this.hashes)i.writeUInt32BE(this.crcs[l]);e.push(i.buffer);let a=new Ht(Buffer.alloc(this.hashes.length*4));for(let l of this.hashes)a.writeUInt32BE(this.offsets.get(l));e.push(a.buffer),r(this.packfileSha,"hex");let s=Buffer.concat(e),o=await me(s),f=Buffer.alloc(20);return f.write(o,"hex"),Buffer.concat([s,f])}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 U(`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"},n=await this.pack;if(!n)throw new U("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let i=n.slice(e),a=new Ht(i),s=a.readUInt8(),o=s&112,f=r[o];if(f===void 0)throw new U("Unrecognized type: 0b"+o.toString(2));let l=s&15,c=l;s&128&&(c=vb(a,l));let d=null,h=null;if(f==="ofs_delta"){let w=_b(a),E=e-w;({object:d,type:f}=await this.readSlice({start:E}))}if(f==="ref_delta"){let w=a.slice(20).toString("hex");({object:d,type:f}=await this.read({oid:w}))}let p=i.slice(a.tell());if(h=Buffer.from(await Vd(p)),h.byteLength!==c)throw new U(`Packfile told us object would have length ${c} but it had length ${h.byteLength}`);return d&&(h=Buffer.from(hb(h,d))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:h}),{type:f,format:"content",object:h}}},xr=Symbol("PackfileCache");async function xb({fs:t,filename:e,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){let a=await t.read(e);return mn.fromIdx({idx:a,getExternalRefDelta:r})}function Gs({fs:t,cache:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){e[xr]||(e[xr]=new Map);let s=e[xr].get(r);return s||(s=xb({fs:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),e[xr].set(r,s),s.catch(()=>{e[xr].get(r)===s&&e[xr].delete(r)})),s}var Ed=8*1024*1024;async function Eb(t,{start:e=0,end:r=t.length}={}){let n=Dy.createHash("sha1");for(let i=e;i<r;i+=Ed)n.update(t.subarray(i,Math.min(i+Ed,r)));return n.digest("hex")}async function Sb({fs:t,cache:e,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(O(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let f=`${r}/objects/pack/${o}`,l=await Gs({fs:t,cache:e,filename:f,getExternalRefDelta:a});if(l.error)throw new U(l.error);if(l.offsets.has(n)){let c=f.replace(/idx$/,"pack");if(!l.pack){let h=t.read(c);l.pack=h,h.catch(()=>{l.pack===h&&(l.pack=null)})}let u=await l.pack;if(!u)throw l.pack=null,new U(`Could not read packfile at ${c}. The file may be missing, corrupted, or too large to read into memory.`);l._checksumVerification||(l._checksumVerification=kb(u,l.packfileSha)),await l._checksumVerification;let d=await l.read({oid:n,getExternalRefDelta:a});return d.format="content",d.source=`objects/pack/${o.replace(/idx$/,"pack")}`,d}}return null}async function kb(t,e){let r=t.subarray(-20),n=Array.from(r).map(a=>a.toString(16).padStart(2,"0")).join("");if(n!==e)throw new U(`Packfile trailer mismatch: expected ${e}, got ${n}. The packfile may be corrupted.`);let i=await Eb(t,{start:0,end:t.length-20});if(i!==e)throw new U(`Packfile payload corrupted: calculated ${i} but expected ${e}. The packfile may have been tampered with.`)}async function X({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){if(!["deflated","wrapped","content"].includes(i))throw new U(`invalid requested format "${i}"`);let a=c=>X({fs:t,cache:e,gitdir:r,oid:c}),s;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await Wd({fs:t,gitdir:r,oid:n})),!s){if(s=await Sb({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a}),!s)throw new H(n);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await Vd(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await me(s.object);if(o!==n)throw new U(`SHA check failed! Expected ${n}, computed ${o}`);let{object:f,type:l}=Oe.unwrap(s.object);return s.type=l,s.object=f,s.format="content",s}var qt=class t extends F{constructor(e,r,n=!0){super(`Failed to create ${e} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:n}}};qt.code="AlreadyExistsError";var gn=class t extends F{constructor(e,r,n){super(`Found multiple ${e} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:n}}};gn.code="AmbiguousError";var yn=class t extends F{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};yn.code="CheckoutConflictError";var bn=class t extends F{constructor(e){super(`Your local changes to the following files would be overwritten by cherry-pick: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};bn.code="CherryPickLocalChangesError";var _n=class t extends F{constructor(e,r){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${r} parents and require specifying which parent to use as the base.`),this.code=this.name=t.code,this.data={oid:e,parentCount:r}}};_n.code="CherryPickMergeCommitError";var vn=class t extends F{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=t.code,this.data={oid:e}}};vn.code="CherryPickRootCommitError";var Or=class t extends F{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=t.code,this.data={ref:e,oid:r}}};Or.code="CommitNotFetchedError";var xn=class t extends F{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=t.code,this.data={}}};xn.code="EmptyCommitError";var En=class t extends F{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};En.code="EmptyServerResponseError";var Sn=class t extends F{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Sn.code="FastForwardError";var kn=class t extends F{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};kn.code="GitPushError";var Rr=class t extends F{constructor(e,r,n){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:n}}};Rr.code="HttpError";var ye=class t extends F{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=t.code,this.data={reason:e}}};ye.code="InvalidFilepathError";var $n=class t extends F{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};$n.code="MaxDepthError";var Tr=class t extends F{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Tr.code="MergeNotSupportedError";var Ve=class t extends F{constructor(e,r,n,i){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=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:n,deleteByTheirs:i}}};Ve.code="MergeConflictError";var wt=class t extends F{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};wt.code="MissingNameError";var At=class t extends F{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};At.code="MissingParameterError";var Xe=class t extends F{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=t.code,this.data={errors:e},this.errors=e}};Xe.code="MultipleGitError";var Ye=class t extends F{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};Ye.code="ParseError";var Cr=class t extends F{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=t.code,this.data={reason:e}}};Cr.code="PushRejectedError";var ke=class t extends F{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};ke.code="RemoteCapabilityError";var An=class t extends F{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=t.code,this.data={preview:e,response:r}}};An.code="SmartHttpError";var On=class t extends F{constructor(e,r,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:n}}};On.code="UnknownTransportError";var Rn=class t extends F{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};Rn.code="UrlParseError";var Ir=class t extends F{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Ir.code="UserCanceledError";var Tn=class t extends F{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=t.code,this.data={filepath:e}}};Tn.code="IndexResetError";var Cn=class t extends F{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=t.code,this.data={ref:e}}};Cn.code="NoCommitError";var Xd=Object.freeze({__proto__:null,AlreadyExistsError:qt,AmbiguousError:gn,CheckoutConflictError:yn,CherryPickLocalChangesError:bn,CherryPickMergeCommitError:_n,CherryPickRootCommitError:vn,CommitNotFetchedError:Or,DecompressionError:Ar,EmptyCommitError:xn,EmptyServerResponseError:En,FastForwardError:Sn,GitPushError:kn,HttpError:Rr,InternalError:U,InvalidFilepathError:ye,InvalidOidError:Ae,InvalidRefNameError:Nt,MaxDepthError:$n,MergeNotSupportedError:Tr,MergeConflictError:Ve,MissingNameError:wt,MissingParameterError:At,MultipleGitError:Xe,NoRefspecError:wn,NotFoundError:H,ObjectTypeError:ut,ParseError:Ye,PushRejectedError:Cr,RemoteCapabilityError:ke,SmartHttpError:An,UnknownTransportError:On,UnsafeFilepathError:We,UrlParseError:Rn,UserCanceledError:Ir,UnmergedPathsError:pn,IndexResetError:Tn,NoCommitError:Cn});function Bs({name:t,email:e,timestamp:r,timezoneOffset:n}){return n=$b(n),`${t} <${e}> ${r} ${n}`}function $b(t){let e=Ab(Ob(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let n=String(r),i=String(t);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(e===-1?"-":"+")+n+i}function Ab(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function Ob(t){return t===0?t:-t}function we(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
21
+ `,t}function Pi(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:Rb(i)}}function Rb(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),Tb(n)}function Tb(t){return t===0?t:-t}var Rt=class t{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=t.render(e);else throw new U("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
22
+ type ${e.type}
23
+ tag ${e.tag}
24
+ tagger ${Bs(e.tagger)}
25
+
26
+ ${e.message}
27
+ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
28
+
29
+ `))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
30
+
31
+ `)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
32
+ `),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=`
33
+ `+i.slice(1):r.push(i);let n={};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.tagger&&(n.tagger=Pi(n.tagger)),n.committer&&(n.committer=Pi(n.committer)),n}withoutSignature(){let e=we(this._tag);return e.indexOf(`
34
+ -----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
35
+ -----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
36
+ -----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return we(e)}payload(){return this.withoutSignature()+`
37
+ `}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:a}=await r({payload:i,secretKey:n});a=we(a);let s=i+a;return t.from(s)}};function xs(t){return t.trim().split(`
38
+ `).map(e=>" "+e).join(`
39
+ `)+`
40
+ `}function Cb(t){return t.split(`
41
+ `).map(e=>e.replace(/^ /,"")).join(`
42
+ `)}var Tt=class t{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=t.render(e);else throw new U("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),a=we(n+`
43
+ gpgsig`+xs(r)+`
44
+ `+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return we(e.slice(e.indexOf(`
45
+
46
+ `)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
47
+
48
+ `))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
49
+ `),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=`
50
+ `+i.slice(1):r.push(i);let n={parent:[]};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.author&&(n.author=Pi(n.author)),n.committer&&(n.committer=Pi(n.committer)),n}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
51
+ `:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
52
+ `,e.parent){if(e.parent.length===void 0)throw new U("commit 'parent' property should be an array");for(let a of e.parent)r+=`parent ${a}
53
+ `}let n=e.author;r+=`author ${Bs(n)}
54
+ `;let i=e.committer||e.author;return r+=`committer ${Bs(i)}
55
+ `,e.gpgsig&&(r+="gpgsig"+xs(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
56
+ `+we(e.message)}render(){return this._commit}withoutSignature(){let e=we(this._commit);if(e.indexOf(`
57
+ gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
58
+ gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
59
+ `)+28);return we(r+`
60
+ `+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return Cb(e)}static async sign(e,r,n){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await r({payload:i,secretKey:n});s=we(s);let f=t.justHeaders(e._commit)+`
61
+ gpgsig`+xs(s)+`
62
+ `+a;return t.from(f)}};async function Pr({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Ot.from([]),oid:n};let{type:i,object:a}=await X({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Rt.from(a).parse().object,Pr({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=Tt.from(a).parse().tree,Pr({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new ut(n,i,"tree");return{tree:Ot.from(a),oid:n}}var Ds=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await I.resolve({fs:e,gitdir:r,ref:n})}catch(l){if(l instanceof H&&await I.isUnbornBranch({fs:e,gitdir:r,ref:n}))o="4b825dc642cb6eb9a060e54bf8d69288fbee4904";else throw l}let f=await Pr({fs:e,cache:this.cache,gitdir:r,oid:o});return f.type="tree",f.mode="40000",s.set(".",f),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:n,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(r);if(!o)throw new Error(`No obj for ${r}`);let f=o.oid;if(!f)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:l,object:c}=await X({fs:n,cache:i,gitdir:a,oid:f});if(l!==o.type)throw new ut(f,l,o.type);let u=Ot.from(c);for(let d of u)s.set(O(r,d.path),d);return u.entries().map(d=>O(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:n}=r.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(e._fullpath);e._mode=Ld(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(e._fullpath).oid,{type:f,object:l}=await X({fs:n,cache:i,gitdir:a,oid:o});f!=="blob"?e._content=void 0:e._content=new Uint8Array(l)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function at({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Fi,{value:function({fs:r,gitdir:n,cache:i}){return new Ds({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var Ns=class{constructor({fs:e,dir:r,gitdir:n,cache:i,refresh:a=!0}){this.fs=e,this.cache=i,this.dir=r,this.gitdir=n,this.refresh=a,this.refreshQueue=[],this.flushed=!1,this.config=null;let s=this;this.ConstructEntry=class{constructor(f){this._fullpath=f,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)}}}async readdir(e){if(await e.type()!=="tree")return null;let r=e._fullpath,{fs:n,dir:i}=this,a=await n.readdir(O(i,r));return a===null?null:a.map(s=>O(r,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{fs:r,dir:n}=this,i=await r.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=$e(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let a;if(await e.mode()>>12===10)a=await r.readlink(`${n}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,i)).get("core.autocrlf");a=await r.read(`${n}/${e._fullpath}`,{autocrlf:o})}e._actualSize=a.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(a)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:n,gitdir:i,cache:a}=this,s;await J.acquire({fs:n,gitdir:i,cache:a},async function(o){let f=o.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!f||Oi(l,f,u,d)){let h=await e.content();h===void 0?s=void 0:(s=await me(Oe.wrap({type:"blob",object:h})),r.refresh&&f&&s===f.oid&&(!u||l.mode===f.mode)&&Oi(l,f,u,d)&&(r.flushed?o.insert({filepath:e._fullpath,stats:l,oid:s}):r.refreshQueue.push({filepath:e._fullpath,stage:f,stats:l,oid:s})))}else s=f.oid}),e._oid=s}return e._oid}async flush(){let{fs:e,gitdir:r,cache:n,refreshQueue:i}=this;this.refreshQueue=[],this.flushed=!0,i.length!==0&&await J.acquire({fs:e,gitdir:r,cache:n},async a=>{for(let{filepath:s,stage:o,stats:f,oid:l}of i)a.entriesMap.get(s)===o&&a.insert({filepath:s,stats:f,oid:l})})}async _getGitConfig(e,r){return this.config?this.config:(this.config=await Q.get({fs:e,gitdir:r}),this.config)}};function Qe({refresh:t=!0}={}){let e=Object.create(null);return Object.defineProperty(e,Fi,{value:function({fs:r,dir:n,gitdir:i,cache:a}){return new Ns({fs:r,dir:n,gitdir:i,cache:a,refresh:t})}}),Object.freeze(e),e}function Ib(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var Yd=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),js=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};function*Pb(t){let e=new js,r,n=[],i=t.length;for(let a=0;a<i;a++)n[a]=t[a].next().value,n[a]!==void 0&&e.consider(n[a]);if(e.value!==null)for(;;){let a=[];r=e.value,e.reset();for(let s=0;s<i;s++)n[s]!==void 0&&n[s]===r?(a[s]=n[s],n[s]=t[s].next().value):a[s]=null,n[s]!==void 0&&e.consider(n[s]);if(yield a,e.value===null)return}}async function Wt({fs:t,cache:e,dir:r,gitdir:n,trees:i,map:a=async(f,l)=>l,reduce:s=async(f,l)=>{let c=Yd(l);return f!==void 0&&c.unshift(f),c},iterate:o=(f,l)=>Promise.all([...l].map(f))}){let f=i.map(p=>p[Fi]({fs:t,dir:r,gitdir:n,cache:e})),l=new Array(f.length).fill("."),c=Ib(0,f.length),u=async p=>{c.forEach(g=>{let m=p[g];p[g]=m&&new f[g].ConstructEntry(m)});let E=(await Promise.all(c.map(g=>{let m=p[g];return m?f[g].readdir(m):[]}))).map(g=>(g===null?[]:g)[Symbol.iterator]());return{entries:p,children:Pb(E)}},d=async p=>{let{entries:w,children:E}=await u(p),g=w.find(x=>x&&x._fullpath)._fullpath,m=await a(g,w);if(m!==null){let x=await o(d,E);return x=x.filter($=>$!==void 0),s(m,x)}},h=await d(l);for(let p of f)p.flush&&await p.flush();return h}async function Kd(t,e,r=10){try{await t(e)}catch(n){if(n===null||n.code==="EEXIST")return;if(n.code!=="ENOENT")throw n;let i=Ze(e);if(i==="."||i==="/"||i===e)throw n;await Kd(t,i,r);for(let a=0;;a++)try{await t(e);return}catch(s){if(s===null||s.code==="EEXIST")return;if(s.code==="ENOENT"&&a<r){await new Promise(o=>setTimeout(o,0));continue}throw s}}}async function Us(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(n=>{let i=O(e,n);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?Us(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function Bb(t){return Db(t)&&Sd(t.then)&&Sd(t.catch)}function Db(t){return t&&typeof t=="object"}function Sd(t){return typeof t=="function"}function hn(t){let e=t.code;return typeof e!="string"?!1:e==="ENOENT"||e==="ENOTDIR"||e.includes("ENS")}function kd(t){return Bb((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(t))}var $d=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Ad(t,e){if(kd(e))for(let r of $d)t[`_${r}`]=e[r].bind(e);else for(let r of $d)t[`_${r}`]=Ai(e[r].bind(e));kd(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Us.bind(null,t)):(e.cp&&(t._cp=Ai(e.cp.bind(e))),e.rm?t._rm=Ai(e.rm.bind(e)):e.rmdir.length>2?t._rm=Ai(e.rmdir.bind(e)):t._rm=Us.bind(null,t))}var D=class{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?Ad(this,e.promises):Ad(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(n){if(hn(n))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,r={}){let n;try{n=await this._readFile(e,r)}catch(i){if(hn(i)||i.code==="EISDIR")return null;throw i}if(n==null)return null;if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
63
+ `),n=new TextEncoder().encode(n)}catch{}return typeof n!="string"&&(n=Buffer.from(n)),n}async write(e,r,n={}){try{await this._writeFile(e,r,n)}catch{await this.mkdir(Ze(e)),await this._writeFile(e,r,n)}}async mkdir(e){await Kd(this._mkdir,e)}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(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let r;try{r=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(hn(n))return[];throw n}return r.sort(Mi),r}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(hn(r))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let n=await this._readlink(e,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(hn(n))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function v(t,e){if(e===void 0)throw new At(t)}function Nb(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function j({fsp:t,dotgit:e}){v("fsp",t),v("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(n=>n.trimRight().substr(8)).then(n=>Nb(n)?n:O(Ze(e),n)):e}async function Bi(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())}async function Jd({fs:t,dir:e,gitdir:r=O(e,".git"),commit:n="HEAD",cache:i={}}){try{v("fs",t),v("dir",e),v("gitdir",r);let a=new D(t),s=[at({ref:n}),Qe(),ge()],o=[],f=await j({fsp:a,dotgit:r});await J.acquire({fs:a,gitdir:f,cache:i},async function(c){o=c.unmergedPaths});let l=await Wt({fs:a,cache:i,dir:e,gitdir:f,trees:s,map:async function(c,[u,d,h]){let p=!await Bi(d,h),w=o.includes(c),E=!await Bi(h,u);if(p||w)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:await d?.type()==="blob"||await h?.type()==="blob"?{path:c,type:"remove"}:!1;if(E)return!1;throw new Tn(c)}});await J.acquire({fs:a,gitdir:f,cache:i},async function(c){for(let u of l)if(u!==!1){if(u.type==="remove"){await a.rm(`${e}/${u.path}`),c.delete({filepath:u.path});continue}if(u.type==="blob"){let d=u.content;await a.write(`${e}/${u.path}`,d,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Re=class{static async isIgnored({fs:e,dir:r,gitdir:n=O(r,".git"),filepath:i}){if(Ri(i)===".git")return!0;if(i===".")return!1;let a="",s=O(n,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:O(r,".gitignore"),filepath:i}],f=i.split("/").filter(Boolean);for(let c=1;c<f.length;c++){let u=f.slice(0,c).join("/"),d=f.slice(c).join("/");o.push({gitignore:O(r,u,".gitignore"),filepath:d})}let l=!1;for(let[c,u]of o.entries()){let d=await e.read(u.gitignore,"utf8"),h=Ny();c===0&&h.add(a),h.add(d);let p=Ze(u.filepath);if(p!=="."&&h.ignores(p))return!0;l?l=!h.test(u.filepath).unignored:l=h.test(u.filepath).ignored}return l}};async function jb({fs:t,gitdir:e,object:r,format:n,oid:i}){if(n!=="deflated")throw new U("GitObjectStoreLoose expects objects to write to be in deflated format");let a=`objects/${i.slice(0,2)}/${i.slice(2)}`,s=`${e}/${a}`;await t.exists(s)||await t.write(s,r)}var Es=null;async function Qd(t){return Es===null&&(Es=Mb()),Es?Ub(t):Ls.deflate(t)}async function Ub(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function Mb(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function Ct({fs:t,gitdir:e,type:r,object:n,format:i="content",oid:a=void 0,dryRun:s=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=Oe.wrap({type:r,object:n})),a=await me(n),n=Buffer.from(await Qd(n))),s||await jb({fs:t,gitdir:e,object:n,format:"deflated",oid:a}),a}function th(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function eh({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n,cache:i={},force:a=!1,parallel:s=!0}){try{v("fs",t),v("dir",e),v("gitdir",r),v("filepath",n);let o=new D(t),f=await j({fsp:o,dotgit:r});await J.acquire({fs:o,gitdir:f,cache:i},async l=>{let u=await(await Q.get({fs:o,gitdir:f})).get("core.autocrlf");return Ms({dir:e,gitdir:f,fs:o,filepath:n,index:l,force:a,parallel:s,autocrlf:u})})}catch(o){throw o.caller="git.add",o}}function Fb(t,e){if(t.has({filepath:e}))return!0;let r=`${e}/`;for(let n of t.entriesMap.keys())if(n.startsWith(r))return!0;return!1}async function Ms({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:a,parallel:s,autocrlf:o}){n=Array.isArray(n)?n:[n];let f=n.map(async d=>{if(!a&&!Fb(i,d)&&await Re.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(O(t,d));if(!h)throw new H(d);if(h.isDirectory()){let p=await r.readdir(O(t,d));if(s){let w=p.map(E=>Ms({dir:t,gitdir:e,fs:r,filepath:[O(d,E)],index:i,force:a,parallel:s,autocrlf:o}));await Promise.all(w)}else for(let w of p)await Ms({dir:t,gitdir:e,fs:r,filepath:[O(d,w)],index:i,force:a,parallel:s,autocrlf:o})}else{let p=h.isSymbolicLink()?await r.readlink(O(t,d)).then(th):await r.read(O(t,d),{autocrlf:o});if(p===null)throw new H(d);let w=await Ct({fs:r,gitdir:e,type:"blob",object:p});i.insert({filepath:d,stats:h,oid:w})}}),l=await Promise.allSettled(f),c=l.filter(d=>d.status==="rejected").map(d=>d.reason);if(c.length>1)throw new Xe(c);if(c.length===1)throw c[0];return l.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function zb({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function Lb({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await t.readdir(O(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,f=await Gs({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(f.error)throw new U(f.error);if(f.offsets.has(n))return!0}return!1}async function Fs({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=o=>X({fs:t,cache:e,gitdir:r,oid:o}),s=await zb({fs:t,gitdir:r,oid:n});return s||(s=await Lb({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a})),s}async function In({fs:t,gitdir:e,path:r}){return(await Q.get({fs:t,gitdir:e})).get(r)}function rh(t,...e){for(let r of e)if(r)for(let n of Object.keys(r)){let i=r[n];i!==void 0&&(t[n]=i)}return t}async function Te({fs:t,gitdir:e,author:r,commit:n}){let i=Math.floor(Date.now()/1e3),a={name:await In({fs:t,gitdir:e,path:"user.name"}),email:await In({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=rh({},a,n?n.author:void 0,r);if(s.name!==void 0)return s}async function Ke({fs:t,gitdir:e,author:r,committer:n,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await In({fs:t,gitdir:e,path:"user.name"}),email:await In({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=rh({},s,i?i.committer:void 0,r,n);if(o.name!==void 0)return o}async function Bn({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await X({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Rt.from(a).parse().object,Bn({fs:t,cache:e,gitdir:r,oid:n});if(i!=="commit")throw new ut(n,i,"commit");return{commit:Tt.from(a),oid:n}}async function se({fs:t,cache:e,gitdir:r,oid:n}){let{commit:i,oid:a}=await Bn({fs:t,cache:e,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}var Gb="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function Dn({fs:t,cache:e,onSign:r,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:f=!1,dryRun:l=!1,noUpdateBranch:c=!1,disallowEmpty:u=!1,ref:d,parent:h,tree:p}){let w=!1,E=!1;d||(E=!(await t.read(`${n}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),d=await I.resolve({fs:t,gitdir:n,ref:"HEAD",depth:2}));let g,m;try{g=await I.resolve({fs:t,gitdir:n,ref:d})}catch(S){if(!(S instanceof H))throw S;w=!0}if(!w&&(f||u)&&(m=await se({fs:t,gitdir:n,oid:g,cache:e})),f&&w)throw new Cn(d);let x=f?await Te({fs:t,gitdir:n,author:a,commit:m.commit}):await Te({fs:t,gitdir:n,author:a});if(!x)throw new wt("author");let $=f?await Ke({fs:t,gitdir:n,author:x,committer:s,commit:m.commit}):await Ke({fs:t,gitdir:n,author:x,committer:s});if(!$)throw new wt("committer");return J.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async function(S){let b=Hd(S.entries).get(".");if(p||(p=await nh({fs:t,gitdir:n,inode:b,dryRun:l})),h?h=await Promise.all(h.map(async A=>{let k=await I.resolve({fs:t,gitdir:n,ref:A});for(;await Fs({fs:t,cache:e,gitdir:n,oid:k});){let{type:T,object:B}=await X({fs:t,cache:e,gitdir:n,oid:k});if(T==="commit")break;if(T!=="tag")throw new ut(k,T,"commit");k=Rt.from(B).parse().object}return k})):f?h=m.commit.parent:h=g?[g]:[],u&&!f&&(w&&p===Gb||!w&&p===m.commit.tree))throw new xn;if(!i)if(f)i=m.commit.message;else throw new At("message");let y=Tt.from({tree:p,parent:h,author:x,committer:$,message:i});o&&(y=await Tt.sign(y,r,o));let _=await Ct({fs:t,gitdir:n,type:"commit",object:y.toObject(),dryRun:l});return!c&&!l&&await I.writeRef({fs:t,gitdir:n,ref:E?"HEAD":d,value:_}),_})}async function nh({fs:t,gitdir:e,inode:r,dryRun:n}){let i=r.children;for(let f of i)f.type==="tree"&&(f.metadata.mode="040000",f.metadata.oid=await nh({fs:t,gitdir:e,inode:f,dryRun:n}));let a=i.map(f=>({mode:f.metadata.mode,path:f.basename,oid:f.metadata.oid,type:f.type})),s=Ot.from(a);return await Ct({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:n})}async function zi({fs:t,cache:e,gitdir:r,oid:n,filepath:i}){return(await ih({fs:t,cache:e,gitdir:r,oid:n,filepath:i})).oid}async function ih({fs:t,cache:e,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new ye("leading-slash");if(i.endsWith("/"))throw new ye("trailing-slash");let a=n,s=await Pr({fs:t,cache:e,gitdir:r,oid:n}),o=s.tree;if(i==="")return{mode:"040000",oid:s.oid,path:"",type:"tree"};{let f=i.split("/");return ah({fs:t,cache:e,gitdir:r,tree:o,pathArray:f,oid:a,filepath:i})}}async function ah({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let f of n)if(f.path===o){if(i.length===0)return f;{let{type:l,object:c}=await X({fs:t,cache:e,gitdir:r,oid:f.oid});if(l!=="tree")throw new ut(a,l,"tree",s);return n=Ot.from(c),ah({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s})}}throw new H(`file or directory found at "${a}:${s}"`)}async function Nr({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await zi({fs:t,cache:e,gitdir:r,oid:n,filepath:i}));let{tree:a,oid:s}=await Pr({fs:t,cache:e,gitdir:r,oid:n});return{oid:s,tree:a.entries()}}async function Nn({fs:t,gitdir:e,tree:r}){let n=Ot.from(r).toObject();return await Ct({fs:t,gitdir:e,type:"tree",object:n,format:"content"})}async function Hb({fs:t,cache:e,onSign:r,gitdir:n,ref:i,oid:a,note:s,force:o,author:f,committer:l,signingKey:c}){let u;try{u=await I.resolve({gitdir:n,fs:t,ref:i})}catch(g){if(!(g instanceof H))throw g}let h=(await Nr({fs:t,cache:e,gitdir:n,oid:u||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(g=>g.path!==a);else for(let g of h)if(g.path===a)throw new qt("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await Ct({fs:t,gitdir:n,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:p,type:"blob"});let w=await Nn({fs:t,gitdir:n,tree:h});return await Dn({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:w,parent:u&&[u],message:`Note added by 'isomorphic-git addNote'
64
+ `,author:f,committer:l,signingKey:c})}async function sh({fs:t,onSign:e,dir:r,gitdir:n=O(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:f,committer:l,signingKey:c,cache:u={}}){try{v("fs",t),v("gitdir",n),v("oid",a),v("note",s),c&&v("onSign",e);let d=new D(t),h=await Te({fs:d,gitdir:n,author:f});if(!h)throw new wt("author");let p=await Ke({fs:d,gitdir:n,author:h,committer:l});if(!p)throw new wt("committer");let w=await j({fsp:d,dotgit:n});return await Hb({fs:d,cache:u,onSign:e,gitdir:w,ref:i,oid:a,note:s,force:o,author:h,committer:p,signingKey:c})}catch(d){throw d.caller="git.addNote",d}}async function oh({fs:t,gitdir:e,remote:r,url:n,force:i}){if(!$r(r,!0))throw new Nt(r,kr.clean(r));let a=await Q.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new qt("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Q.save({fs:t,gitdir:e,config:a})}async function ch({fs:t,dir:e,gitdir:r=O(e,".git"),remote:n,url:i,force:a=!1}){try{v("fs",t),v("gitdir",r),v("remote",n),v("url",i);let s=new D(t),o=await j({fsp:s,dotgit:r});return await oh({fs:s,gitdir:o,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function qb({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:f,signingKey:l,force:c=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!c&&await I.exists({fs:t,gitdir:n,ref:i}))throw new qt("tag",i);let u=await I.resolve({fs:t,gitdir:n,ref:f||"HEAD"}),{type:d}=await X({fs:t,cache:e,gitdir:n,oid:u}),h=Rt.from({object:u,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});l&&(h=await Rt.sign(h,r,l));let p=await Ct({fs:t,gitdir:n,type:"tag",object:h.toObject()});await I.writeRef({fs:t,gitdir:n,ref:i,value:p})}async function fh({fs:t,onSign:e,dir:r,gitdir:n=O(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:f,signingKey:l,force:c=!1,cache:u={}}){try{v("fs",t),v("gitdir",n),v("ref",i),l&&v("onSign",e);let d=new D(t),h=await j({fsp:d,dotgit:n}),p=await Te({fs:d,gitdir:h,author:a});if(!p)throw new wt("tagger");return await qb({fs:d,cache:u,onSign:e,gitdir:h,ref:i,tagger:p,message:s,gpgsig:o,object:f,signingKey:l,force:c})}catch(d){throw d.caller="git.annotatedTag",d}}async function Wb({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:a=!1}){if(!$r(r,!0))throw new Nt(r,kr.clean(r));let s=`refs/heads/${r}`;if(!a&&await I.exists({fs:t,gitdir:e,ref:s}))throw new qt("branch",r,!1);let o;try{o=await I.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch(f){if(!(f instanceof H))throw f}o&&(o=(await Bn({fs:t,cache:{},gitdir:e,oid:o})).oid,await I.writeRef({fs:t,gitdir:e,ref:s,value:o})),i&&await I.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function lh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{v("fs",t),v("gitdir",r),v("ref",n);let o=new D(t),f=await j({fsp:o,dotgit:r});return await Wb({fs:o,gitdir:f,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}async function Pn(t,e,r){let n=r.split("/");n.pop();let i=e;for(let a of n){if(a===""||a===".")continue;i=`${i}/${a}`;let s=await t.lstat(i);if(s&&s.isSymbolicLink())throw new We(r)}}var Hs=(t,e)=>{if(t==="."||e==null||e.length===0||e===".")return!0;let r=e.endsWith("/")?e.slice(0,-1):e;return r==="."?!0:r.length>=t.length?r===t||r.startsWith(`${t}/`):t.startsWith(`${r}/`)};async function qs({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:f,noCheckout:l,noUpdateHead:c,dryRun:u,force:d,track:h=!0,restoreFromIndex:p=!1,nonBlocking:w=!1,batchSize:E=100}){let g;if(n)try{g=await I.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let m;try{m=await I.resolve({fs:t,gitdir:a,ref:o})}catch(x){if(o==="HEAD"||!(x instanceof H))throw x;let $=`${s}/${o}`;if(m=await I.resolve({fs:t,gitdir:a,ref:$}),h){let S=await Q.get({fs:t,gitdir:a});await S.set(`branch.${o}.remote`,s),await S.set(`branch.${o}.merge`,`refs/heads/${o}`),await Q.save({fs:t,gitdir:a,config:S})}await I.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:m})}if(!c)try{m=(await Bn({fs:t,cache:e,gitdir:a,oid:m})).oid}catch(x){throw x instanceof H?new Or(o,x.data.what):x}if(!l){let x;try{x=await Zb({fs:t,cache:e,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:f,restoreFromIndex:p})}catch(y){throw y instanceof H&&y.data.what===m?new Or(o,m):y}let $=x.filter(([y])=>y==="conflict").map(([y,_])=>_);if($.length>0)throw new yn($);let S=x.filter(([y])=>y==="error").map(([y,_])=>_);if(S.length>0)throw new U(S.join(", "));if(u){n&&await n({previousHead:g,newHead:m,type:f!=null&&f.length>0?"file":"branch"});return}let R=0,b=x.length;if(await J.acquire({fs:t,gitdir:a,cache:e},async function(y){await Promise.all(x.filter(([_])=>_==="delete"||_==="delete-index").map(async function([_,A]){let k=`${i}/${A}`;_==="delete"&&await t.rm(k),y.delete({filepath:A}),r&&await r({phase:"Updating workdir",loaded:++R,total:b})}))}),await J.acquire({fs:t,gitdir:a,cache:e},async function(y){for(let[_,A]of x)if(_==="rmdir"||_==="rmdir-index"){let k=`${i}/${A}`;try{_==="rmdir"&&await t.rmdir(k),y.delete({filepath:A}),r&&await r({phase:"Updating workdir",loaded:++R,total:b})}catch(T){if(T.code==="ENOTEMPTY")console.log(`Did not delete ${A} because directory is not empty`);else throw T}}}),await Promise.all(x.filter(([y])=>y==="mkdir"||y==="mkdir-index").map(async function([y,_]){let A=`${i}/${_}`;await Pn(t,i,_),await t.mkdir(A),r&&await r({phase:"Updating workdir",loaded:++R,total:b})})),w){let y=x.filter(([A])=>A==="create"||A==="create-index"||A==="update"||A==="mkdir-index"),_=await Od("Update Working Dir",y.map(([A,k,T,B,M])=>()=>Xb({fs:t,cache:e,gitdir:a,dir:i},[A,k,T,B,M])),r,E);await J.acquire({fs:t,gitdir:a,cache:e,allowUnmerged:!0},async function(A){await Od("Update Index",_.map(([k,T,B])=>()=>Vb({index:A,fullpath:k,oid:T,stats:B})),r,E)})}else await J.acquire({fs:t,gitdir:a,cache:e,allowUnmerged:!0},async function(y){let _=await Promise.allSettled(x.filter(([k])=>k==="create"||k==="create-index"||k==="update"||k==="mkdir-index").map(async function([k,T,B,M,et]){let gt=`${i}/${T}`;if(k!=="create-index"&&k!=="mkdir-index"){await Pn(t,i,T);let{object:Pt}=await X({fs:t,cache:e,gitdir:a,oid:B});if(et&&await t.rm(gt),M===33188)await t.write(gt,Pt);else if(M===33261)await t.write(gt,Pt,{mode:511});else if(M===40960)await t.writelink(gt,Pt);else throw new U(`Invalid mode 0o${M.toString(8)} detected in blob ${B}`)}let yt=await t.lstat(gt);M===33261&&(yt.mode=493),k==="mkdir-index"&&(yt.mode=57344),y.insert({filepath:T,stats:yt,oid:B}),r&&await r({phase:"Updating workdir",loaded:++R,total:b})})),A=[];for(let k of _)k.status==="rejected"&&(A.push(k.reason),console.error("[isomorphic-git checkout] task rejected:",k.reason?.stack??k.reason));if(A.length>0)throw new Xe(A)});n&&await n({previousHead:g,newHead:m,type:f!=null&&f.length>0?"file":"branch"})}if(!c){let x=await I.expand({fs:t,gitdir:a,ref:o});x.startsWith("refs/heads")?await I.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:x}):await I.writeRef({fs:t,gitdir:a,ref:"HEAD",value:m})}}async function Zb({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,ref:a,force:s,filepaths:o,restoreFromIndex:f}){let l=0;return Wt({fs:t,cache:e,dir:n,gitdir:i,trees:[f?ge():at({ref:a}),Qe(),ge()],map:async function(c,[u,d,h]){if(c===".")return;if(o&&!o.some(w=>Hs(c,w)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!h,!!u,!!d].map(Number).join("")){case"000":return;case"001":return!f&&s&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await d.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await d.oid()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]:await u.mode()!==await d.mode()?s?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await h.type()){case"tree":return["rmdir-index",c];case"blob":return await h.oid()!==await d.oid()?s?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await h.type()}`]}case"110":case"111":switch(`${await h.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await h.oid()===await u.oid()&&await h.mode()===await u.mode()&&!s)return;if(d){if(await d.oid()!==await h.oid()&&await d.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]}else if(s)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()];return await u.mode()!==await h.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await h.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await h.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=Yd(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function Vb({index:t,fullpath:e,stats:r,oid:n}){try{t.insert({filepath:e,stats:r,oid:n})}catch(i){console.warn(`Error inserting ${e} into index:`,i)}}async function Xb({fs:t,cache:e,gitdir:r,dir:n},[i,a,s,o,f]){let l=`${n}/${a}`;if(i!=="create-index"&&i!=="mkdir-index"){await Pn(t,n,a);let{object:u}=await X({fs:t,cache:e,gitdir:r,oid:s});if(f&&await t.rm(l),o===33188)await t.write(l,u);else if(o===33261)await t.write(l,u,{mode:511});else if(o===40960)await t.writelink(l,u);else throw new U(`Invalid mode 0o${o.toString(8)} detected in blob ${s}`)}let c=await t.lstat(l);return o===33261&&(c.mode=493),i==="mkdir-index"&&(c.mode=57344),[a,s,c]}async function Od(t,e,r,n){let i=[],a=[];for(let s=0;s<e.length;s+=n){let o=e.slice(s,s+n).map(l=>l());(await Promise.allSettled(o)).forEach(l=>{l.status==="fulfilled"?i.push(l.value):(a.push(l.reason),console.error(`[isomorphic-git ${t}] task rejected:`,l.reason?.stack??l.reason))}),r&&await r({phase:"Updating workdir",loaded:s+o.length,total:e.length})}if(a.length>0)throw new Xe(a);return i}async function Ws({fs:t,onProgress:e,onPostCheckout:r,dir:n,gitdir:i=O(n,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:f=!1,noUpdateHead:l=s===void 0,dryRun:c=!1,force:u=!1,track:d=!0,cache:h={},nonBlocking:p=!1,batchSize:w=100}){try{v("fs",t),v("dir",n),v("gitdir",i);let E=s||"HEAD",g=s===void 0&&o!=null&&o.length>0,m=new D(t),x=await j({fsp:m,dotgit:i});return await qs({fs:m,cache:h,onProgress:e,onPostCheckout:r,dir:n,gitdir:x,remote:a,ref:E,filepaths:o,noCheckout:f,noUpdateHead:l,dryRun:c,force:u,track:d,restoreFromIndex:g,nonBlocking:p,batchSize:w})}catch(E){throw E.caller="git.checkout",E}}var Ss=/^.*(\r?\n|$)/gm;function Yb({branches:t,contents:e}){let r=t[1],n=t[2],i=e[0],a=e[1],s=e[2],o=a.match(Ss),f=i.match(Ss),l=s.match(Ss),c=jy(o,f,l),u=7,d="",h=!0;for(let p of c)p.ok&&(d+=p.ok.join("")),p.conflict&&(h=!1,d+=`${"<".repeat(u)} ${r}
65
+ `,d+=p.conflict.a.join(""),d+=`${"=".repeat(u)}
66
+ `,d+=p.conflict.b.join(""),d+=`${">".repeat(u)} ${n}
67
+ `);return{cleanMerge:h,mergedText:d}}async function uh({fs:t,cache:e,dir:r,gitdir:n=O(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:f="ours",baseName:l="base",theirName:c="theirs",dryRun:u=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=at({ref:a}),w=at({ref:s}),E=at({ref:o}),g=[],m=[],x=[],$=[],S=await Wt({fs:t,cache:e,dir:r,gitdir:n,trees:[p,w,E],map:async function(R,[b,y,_]){let A=Ri(R),k=await Bi(b,y),T=await Bi(_,y);switch(`${k}-${T}`){case"false-false":return{mode:await y.mode(),path:A,oid:await y.oid(),type:await y.type()};case"false-true":return!_&&await b.type()==="tree"?{mode:await b.mode(),path:A,oid:await b.oid(),type:await b.type()}:_?{mode:await _.mode(),path:A,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!b&&await _.type()==="tree"?{mode:await _.mode(),path:A,oid:await _.oid(),type:await _.type()}:b?{mode:await b.mode(),path:A,oid:await b.oid(),type:await b.type()}:void 0;case"true-true":{if(b&&_&&await b.type()==="tree"&&await _.type()==="tree")return{mode:await b.mode(),path:A,oid:await b.oid(),type:"tree"};if(b&&_&&await b.type()==="blob"&&await _.type()==="blob")return Kb({fs:t,gitdir:n,path:A,ours:b,base:y,theirs:_,ourName:f,baseName:l,theirName:c,mergeDriver:h}).then(async B=>{if(B.cleanMerge)d||i.insert({filepath:R,oid:B.mergeResult.oid,stage:0});else if(g.push(R),m.push(R),!d){let M="";y&&await y.type()==="blob"&&(M=await y.oid());let et=await b.oid(),gt=await _.oid();i.delete({filepath:R}),M&&i.insert({filepath:R,oid:M,stage:1}),i.insert({filepath:R,oid:et,stage:2}),i.insert({filepath:R,oid:gt,stage:3})}return B.mergeResult});if(y&&!b&&_&&await y.type()==="blob"&&await _.type()==="blob"){if(g.push(R),x.push(R),!d){let B=await y.oid(),M=await _.oid();i.delete({filepath:R}),i.insert({filepath:R,oid:B,stage:1}),i.insert({filepath:R,oid:M,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:A}}if(y&&b&&!_&&await y.type()==="blob"&&await b.type()==="blob"){if(g.push(R),$.push(R),!d){let B=await y.oid(),M=await b.oid();i.delete({filepath:R}),i.insert({filepath:R,oid:B,stage:1}),i.insert({filepath:R,oid:M,stage:2})}return{mode:await b.mode(),oid:await b.oid(),type:"blob",path:A}}if(y&&!b&&!_&&(await y.type()==="blob"||await y.type()==="tree"))return;throw new Tr}}},reduce:g.length!==0&&(!r||d)?void 0:async(R,b)=>{let y=b.filter(Boolean);if(R&&!(R&&R.type==="tree"&&y.length===0&&R.path!==".")){if(y.length>0||R.path==="."&&y.length===0){let A=new Ot(y).toObject(),k=await Ct({fs:t,gitdir:n,type:"tree",object:A,dryRun:u});R.oid=k}return R}}});return g.length!==0?(r&&!d&&await Wt({fs:t,cache:e,dir:r,gitdir:n,trees:[at({ref:a}),at({ref:S.oid})],map:async function(R,[b,y]){let _=`${r}/${R}`,A=g.includes(R);if(!y&&await b?.type()==="blob"&&!A&&(await t.rm(_),i.delete({filepath:R})),await y?.type()!=="blob")return!0;let k=await y.mode(),T=await y.content();return await t.write(_,T,{mode:k}),A||i.insert({filepath:R,oid:await y.oid(),stats:await t.lstat(_)}),!0}}),new Ve(g,m,x,$)):S.oid}async function Kb({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:f,dryRun:l,mergeDriver:c=Yb}){let u="blob",d="100755",h="",p="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),p=Buffer.from(await i.content()).toString("utf8"));let w=d===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await n.oid(),type:u}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await a.oid(),type:u}};if(await a.oid()===h)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await n.oid(),type:u}};let E=Buffer.from(await n.content()).toString("utf8"),g=Buffer.from(await a.content()).toString("utf8"),{mergedText:m,cleanMerge:x}=await c({branches:[f,s,o],contents:[p,E,g],path:r}),$=await Ct({fs:t,gitdir:e,type:"blob",object:Buffer.from(m,"utf8"),dryRun:l});return{cleanMerge:x,mergeResult:{mode:w,path:r,oid:$,type:u}}}var Jb={stage:ge,workdir:Qe};async function Qb(t,e,r,n,i=null){let a=O(r,n),s=await t.lstat(a);if(!s)throw new H(a);if(s.isDirectory())throw new U(`${a}: file expected, but found directory`);let o=i?await Wd({fs:t,gitdir:e,oid:i}):void 0,f=o?i:void 0;return o||await lt(a,async()=>{let l=s.isSymbolicLink()?await t.readlink(a).then(th):await t.read(a);if(l===null)throw new H(a);f=await Ct({fs:t,gitdir:e,type:"blob",object:l})}),f}async function t_({fs:t,dir:e,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){let s=await Promise.all(a.children.map(i));a.oid=await Nn({fs:t,gitdir:r,tree:s}),a.mode=16384}}else a.type==="blob"&&(a.oid=await Qb(t,r,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function Rd({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",a=n.map(h=>typeof h=="string"?Jb[h]():h),s=[],c=await Wt({fs:t,cache:{},dir:e,gitdir:r,trees:a,map:async(h,[p,w])=>{if(!(h==="."||await Re.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&w)return(!p||await p.oid()!==await w.oid()&&await w.oid()!==void 0)&&s.push([p,w]),{mode:await w.mode(),path:h,oid:await w.oid(),type:await w.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0?p:void 0),iterate:async(h,p)=>{let w=[];for(let E of p){let[g,m]=E;i?m&&(await t.exists(`${e}/${m.toString()}`)?w.push(E):s.push([null,m])):g&&(m?w.push(E):s.push([g,null]))}return w.length?Promise.all(w.map(h)):[]}});if(s.length===0||c.length===0)return null;let d=(await t_({fs:t,dir:e,gitdir:r,entries:c})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return Nn({fs:t,gitdir:r,tree:d})}async function dh({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){let s=[],o=[],f=await Wt({fs:t,cache:{},dir:e,gitdir:r,trees:[at({ref:i}),at({ref:n})],map:async(l,[c,u])=>{if(l==="."||await Re.isIgnored({fs:t,dir:e,gitdir:r,filepath:l}))return;let d=u?await u.type():await c.type();if(d!=="tree"&&d!=="blob")return;if(!u&&c){let p=d==="tree"?"rmdir":"rm";return d==="tree"&&s.push(l),d==="blob"&&a&&o.push({filepath:l,oid:await c.oid()}),{method:p,filepath:l}}let h=await u.oid();if(!c||await c.oid()!==h)return d==="tree"?{method:"mkdir",filepath:l}:(a&&o.push({filepath:l,oid:h,stats:await t.lstat(O(e,l))}),{method:"write",filepath:l,oid:h})}});await lt(r,async()=>{for(let l of f){let c=O(e,l.filepath);switch(l.method){case"rmdir":await t.rmdir(c);break;case"mkdir":await Pn(t,e,l.filepath),await t.mkdir(c);break;case"rm":await t.rm(c);break;case"write":if(!s.some(u=>c.startsWith(u))){await Pn(t,e,l.filepath);let{object:u}=await X({fs:t,cache:{},gitdir:r,oid:l.oid});await t.exists(c)&&await t.rm(c),await t.write(c,u)}break}}}),await J.acquire({fs:t,gitdir:r,cache:{}},async l=>{o.forEach(({filepath:c,stats:u,oid:d})=>{l.insert({filepath:c,stats:u,oid:d})})})}async function Td({fs:t,cache:e,dir:r,gitdir:n,oid:i,dryRun:a=!1,noUpdateBranch:s=!1,abortOnConflict:o=!0,committer:f,mergeDriver:l}){let{commit:c,oid:u}=await se({fs:t,cache:e,gitdir:n,oid:i});if(c.parent.length>1)throw new _n(u,c.parent.length);if(c.parent.length===0)throw new vn(u);let d=await I.resolve({fs:t,gitdir:n,ref:"HEAD"}),{commit:h}=await se({fs:t,cache:e,gitdir:n,oid:d}),p=c.parent[0],{commit:w}=await se({fs:t,cache:e,gitdir:n,oid:p});if(r&&(!a&&!s||!o)){let m=await e_({fs:t,cache:e,dir:r,gitdir:n,headTree:h.tree,baseTree:w.tree,theirTree:c.tree,allTracked:!o});if(m.length>0)throw new bn(m)}let E=await J.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async m=>uh({fs:t,cache:e,dir:r,gitdir:n,index:m,ourOid:h.tree,baseOid:w.tree,theirOid:c.tree,ourName:"HEAD",baseName:`parent of ${u.slice(0,7)}`,theirName:u.slice(0,7),dryRun:a,abortOnConflict:o,mergeDriver:l}));if(E instanceof Ve)throw E;let g=await Dn({fs:t,cache:e,gitdir:n,message:c.message,tree:E,parent:[d],author:c.author,committer:f,dryRun:a,noUpdateBranch:s});return r&&!a&&!s&&await dh({fs:t,dir:r,gitdir:n,stashCommit:g,parentCommit:d,wasStaged:!0}),g}async function e_({fs:t,cache:e,dir:r,gitdir:n,headTree:i,baseTree:a,theirTree:s,allTracked:o}){let f=await Wt({fs:t,cache:e,dir:r,gitdir:n,trees:[at({ref:a}),at({ref:s})],map:async(l,[c,u])=>{if(l===".")return;if(c&&u&&await c.oid()===await u.oid())return null;if([c?await c.type():void 0,u?await u.type():void 0].includes("blob"))return l}});return f.length===0&&!o?[]:Wt({fs:t,cache:e,dir:r,gitdir:n,trees:[at({ref:i}),ge(),Qe()],map:async(l,[c,u,d])=>{if(l===".")return;if(!o&&!f.some(w=>Hs(l,w)))return null;let h=c&&await c.type()==="blob"?await c.oid():void 0;if(!f.includes(l)&&!(o&&h))return;if((u?await u.oid():void 0)!==h)return l;if(d&&(!h||await d.type()!=="blob"||await d.oid()!==h))return l}})}async function hh({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,cache:i={},committer:a,dryRun:s=!1,noUpdateBranch:o=!1,abortOnConflict:f=!0,mergeDriver:l}){try{v("fs",t),v("gitdir",r),v("oid",n);let c=new D(t),u=await j({fsp:c,dotgit:r}),{commit:d}=await se({fs:c,cache:i,gitdir:u,oid:n});if(d.parent&&d.parent.length>1)return await Td({fs:c,cache:i,dir:e,gitdir:u,oid:n,dryRun:s,noUpdateBranch:o,abortOnConflict:f,committer:void 0,mergeDriver:l});let h=await Ke({fs:c,gitdir:u,committer:a});if(!h)throw new wt("committer");return await Td({fs:c,cache:i,dir:e,gitdir:u,oid:n,dryRun:s,noUpdateBranch:o,abortOnConflict:f,committer:h,mergeDriver:l})}catch(c){throw c.caller="git.cherryPick",c}}var r_=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Er(t){let e=r_.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Pe({fs:t,gitdir:e,fullname:r=!1,test:n=!1}){let i=await I.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(n)try{await I.resolve({fs:t,gitdir:e,ref:i})}catch(a){if(a instanceof H)return;throw a}if(i.startsWith("refs/"))return r?i:Er(i)}function n_(t){return t=t.replace(/^[^/@:]+@([^/@:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function ph({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function jn(t,e){let r=Zd(t);for(;;){let{value:n,done:i}=await r.next();if(n&&await e(n),i)break}r.return&&r.return()}async function Di(t){let e=0,r=[];await jn(t,a=>{r.push(a),e+=a.byteLength});let n=new Uint8Array(e),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}var Cd=/^(https?:\/\/)([^/?#]+)@/i;function Id(t){let e=t.match(Cd);return e==null?{url:t,auth:{}}:{url:t.replace(Cd,"$1"),auth:i_(t,e[2])}}function i_(t,e){let r=a_(t),n=e.indexOf(":")!==-1;if(r!==null)return{username:Pd(r.username),password:n?Pd(r.password):void 0};let i=e.indexOf(":");return{username:n?e.slice(0,i):e,password:n?e.slice(i+1):void 0}}function a_(t){if(typeof URL!="function")return null;try{return new URL(t)}catch{return null}}function Pd(t){try{return decodeURIComponent(t)}catch{return t}}function zs(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var K=class{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,n=zs(4,r);return Buffer.concat([Buffer.from(n,"utf8"),e])}static streamReader(e){let r=new Ii(e);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await r.read(i-4);return a??!0}catch(i){return e.error=i,!0}}}};async function Bd(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let n=r.indexOf("=");if(n>-1){let i=r.slice(0,n),a=r.slice(n+1);e[i]=a}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function Dd(t,{service:e}){let r=new Set,n=new Map,i=new Map,a=K.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new En;if(s.includes("version 2"))return Bd(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ye(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:r,refs:n,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return Bd(a);let[f,l]=ks(o,"\0","\\x00");if(l.split(" ").map(c=>r.add(c)),f!=="0000000000000000000000000000000000000000 capabilities^{}"){let[c,u]=ks(f," "," ");for(n.set(u,c);;){let d=await a();if(d===!0)break;if(d!==null){let[h,p]=ks(d.toString("utf8")," "," ");n.set(p,h)}}}for(let c of r)if(c.startsWith("symref=")){let u=c.match(/symref=([^:]+):(.*)/);u.length===3&&i.set(u[1],u[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function ks(t,e,r){let n=t.trim().split(e);if(n.length!==2)throw new Ye(`Two strings separated by '${r}'`,t.toString("utf8"));return n}var Nd=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,jd=(t,e)=>{(e.username||e.password)&&(t.Authorization=ph(e)),e.headers&&Object.assign(t,e.headers)},$s=async t=>{try{let e=Buffer.from(await Di(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},Br=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:f,headers:l,signal:c,protocolVersion:u}){let{url:d,auth:h}=Id(f),p=s?Nd(s,d):d;(h.username||h.password)&&(l.Authorization=ph(h)),u===2&&(l["Git-Protocol"]="version=2");let w,E,g=!1;do if(w=await e.request({onProgress:r,method:"GET",url:`${p}/info/refs?service=${o}`,headers:l,signal:c}),E=!1,w.statusCode===401||w.statusCode===203){let m=g?a:n;if(m){if(h=await m(d,{...h,headers:{...l}}),h&&h.cancel)throw new Ir;h&&(jd(l,h),g=!0,E=!0)}}else w.statusCode===200&&g&&i&&await i(d,h);while(E);if(w.statusCode!==200){let{response:m}=await $s(w);throw new Rr(w.statusCode,w.statusMessage,m)}if(w.headers["content-type"]===`application/x-${o}-advertisement`){let m=await Dd(w.body,{service:o});return m.auth=h,m}else{let{preview:m,response:x,data:$}=await $s(w);try{let S=await Dd([$],{service:o});return S.auth=h,S}catch{throw new An(m,x)}}}static async connect({http:e,onProgress:r,corsProxy:n,service:i,url:a,auth:s,body:o,headers:f,signal:l}){let c=Id(a);c&&(a=c.url),n&&(a=Nd(n,a)),f["content-type"]=`application/x-${i}-request`,f.accept=`application/x-${i}-result`,jd(f,s);let u=await e.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:o,headers:f,signal:l});if(u.statusCode!==200){let{response:d}=$s(u);throw new Rr(u.statusCode,u.statusMessage,d)}return u}},Dr=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Br),r.set("https",Br);let n=o_({url:e});if(!n)throw new Rn(e);if(r.has(n.transport))return r.get(n.transport);throw new On(e,n.transport,n.transport==="ssh"?n_(e):void 0)}},s_=/^[^/@:]+@[^/@:]+:/;function o_({url:t}){if(s_.test(t))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]}}}var Ce=class{static async read({fs:e,gitdir:r}){let n=O(r,"shallow"),i=new Set;return await lt(n,async function(){let a=await e.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(`
68
+ `).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:r,oids:n}){let i=O(r,"shallow");if(n.size>0){let a=[...n].join(`
69
+ `)+`
70
+ `;await lt(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await lt(i,async function(){await e.rm(i)})}};function Ni({config:t,onAuth:e}){return e&&(async(r,n)=>{let i=n.username||await t.get(`credential.${r}.username`);return e(r,i?{...n,username:i}:n)})}function c_(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function wh(t,e){let r=t.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var Li={name:"isomorphic-git",version:"1.44.5",agent:"git/isomorphic-git@1.44.5"},Sr=class{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})}};function f_(t){let e=t.indexOf("\r"),r=t.indexOf(`
71
+ `);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function mh(t){let e=new Sr,r="";return(async()=>(await jn(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=f_(r);if(i===-1||i===r.length&&r[i-1]==="\r")break;e.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&e.write(r),e.end()))(),e}var ji=class{static demux(e){let r=K.streamReader(e),n=new Sr,i=new Sr,a=new Sr,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let f=o.slice(1);a.write(f),n.end(),a.end(),i.destroy(new Error(f.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function l_(t){let{packetlines:e,packfile:r,progress:n}=ji.demux(t),i=[],a=[],s=[],o=!1,f=!1;return new Promise((l,c)=>{jn(e,u=>{let d=u.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&c(new Ae(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&c(new Ae(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.push({oid:h,status:p}),p||(f=!0)}else d.startsWith("NAK")?(o=!0,f=!0):(f=!0,o=!0);f&&(t.error?c(t.error):l({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{f||(t.error?c(t.error):l({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function u_({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let f=` ${t.join(" ")}`;for(let l of e)o.push(K.encode(`want ${l}${f}
72
+ `)),f="";for(let l of n)o.push(K.encode(`shallow ${l}
73
+ `));i!==null&&o.push(K.encode(`deepen ${i}
74
+ `)),a!==null&&o.push(K.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
75
+ `));for(let l of s)o.push(K.encode(`deepen-not ${l}
76
+ `));o.push(K.flush());for(let l of r)o.push(K.encode(`have ${l}
77
+ `));return o.push(K.encode(`done
78
+ `)),o}async function Zs({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:f,ref:l,remoteRef:c,remote:u,url:d,corsProxy:h,depth:p=null,since:w=null,exclude:E=[],relative:g=!1,tags:m=!1,singleBranch:x=!1,headers:$={},prune:S=!1,pruneTags:R=!1}){let b=l||await Pe({fs:t,gitdir:f,test:!0}),y=await Q.get({fs:t,gitdir:f}),_=u||b&&await y.get(`branch.${b}.remote`)||"origin",A=d||await y.get(`remote.${_}.url`);if(typeof A>"u")throw new At("remote OR url");let k=c||b&&await y.get(`branch.${b}.merge`)||l||"HEAD";h===void 0&&(h=await y.get("http.corsProxy"));let T=Dr.getRemoteHelperFor({url:A}),B=await T.discover({http:r,onAuth:Ni({config:y,onAuth:a}),onAuthSuccess:s,onAuthFailure:Ni({config:y,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:A,headers:$,protocolVersion:1}),M=B.auth,et=B.refs;if(et.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!B.capabilities.has("shallow"))throw new ke("shallow","depth");if(w!==null&&!B.capabilities.has("deepen-since"))throw new ke("deepen-since","since");if(E.length>0&&!B.capabilities.has("deepen-not"))throw new ke("deepen-not","exclude");if(g===!0&&!B.capabilities.has("deepen-relative"))throw new ke("deepen-relative","relative");let{oid:gt,fullref:yt}=I.resolveAgainstMap({ref:k,map:et});for(let V of et.keys())V===yt||V==="HEAD"||V.startsWith("refs/heads/")||m&&V.startsWith("refs/tags/")||et.delete(V);let Pt=wh([...B.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Li.agent}`]);g&&Pt.push("deepen-relative");let Fr=x?[gt]:et.values(),Vi=x?[b]:await I.listRefs({fs:t,gitdir:f,filepath:"refs"}),rr=[];for(let V of Vi)try{V=await I.expand({fs:t,gitdir:f,ref:V});let ht=await I.resolve({fs:t,gitdir:f,ref:V});await Fs({fs:t,cache:e,gitdir:f,oid:ht})&&rr.push(ht)}catch{}rr=[...new Set(rr)];let vt=await Ce.read({fs:t,gitdir:f}),ot=B.capabilities.has("shallow")?[...vt]:[],Xt=u_({capabilities:Pt,wants:Fr,haves:rr,shallows:ot,depth:p,since:w,exclude:E}),ct=Buffer.from(await Di(Xt)),Yt=await T.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:A,auth:M,body:[ct],headers:$}),nt=await l_(Yt.body);Yt.headers&&(nt.headers=Yt.headers);for(let V of nt.shallows)if(!vt.has(V))try{let{object:ht}=await X({fs:t,cache:e,gitdir:f,oid:V}),jt=new Tt(ht),Kt=await Promise.all(jt.headers().parent.map(Lr=>Fs({fs:t,cache:e,gitdir:f,oid:Lr})));Kt.length===0||Kt.every(Lr=>Lr)||vt.add(V)}catch{vt.add(V)}for(let V of nt.unshallows)vt.delete(V);if(await Ce.write({fs:t,gitdir:f,oids:vt}),x){let V=new Map([[yt,gt]]),ht=new Map,jt=10,Kt=yt;for(;jt--;){let Ki=B.symrefs.get(Kt);if(Ki===void 0)break;ht.set(Kt,Ki),Kt=Ki}let Yi=et.get(Kt);Yi&&V.set(Kt,Yi);let{pruned:Lr}=await I.updateRemoteRefs({fs:t,gitdir:f,remote:_,refs:V,symrefs:ht,tags:m,prune:S});S&&(nt.pruned=Lr)}else{let{pruned:V}=await I.updateRemoteRefs({fs:t,gitdir:f,remote:_,refs:et,symrefs:B.symrefs,tags:m,prune:S,pruneTags:R});S&&(nt.pruned=V)}if(nt.HEAD=B.symrefs.get("HEAD"),nt.HEAD===void 0){let{oid:V}=I.resolveAgainstMap({ref:"HEAD",map:et});for(let[ht,jt]of et.entries())if(ht!=="HEAD"&&jt===V){nt.HEAD=ht;break}}let Xi=yt.startsWith("refs/tags")?"tag":"branch";if(nt.FETCH_HEAD={oid:gt,description:`${Xi} '${Er(yt)}' of ${A}`},n||i){let V=mh(nt.progress);jn(V,async ht=>{if(i&&await i(ht),n){let jt=ht.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);jt&&await n({phase:jt[1].trim(),loaded:parseInt(jt[2],10),total:parseInt(jt[3],10)})}})}let Wn=Buffer.from(await Di(nt.packfile));if(Yt.body.error)throw Yt.body.error;let Go=Wn.slice(-20).toString("hex"),zr={defaultBranch:nt.HEAD,fetchHead:nt.FETCH_HEAD.oid,fetchHeadDescription:nt.FETCH_HEAD.description};if(nt.headers&&(zr.headers=nt.headers),S&&(zr.pruned=nt.pruned),Go!==""&&!c_(Wn)){zr.packfile=`objects/pack/pack-${Go}.pack`;let V=O(f,zr.packfile);await t.write(V,Wn);let ht=Kt=>X({fs:t,cache:e,gitdir:f,oid:Kt}),jt=await mn.fromPack({pack:Wn,getExternalRefDelta:ht,onProgress:n});await t.write(V.replace(/\.pack$/,".idx"),await jt.toBuffer())}return zr}async function gh({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O(r,".git"),defaultBranch:i="master"}){if(await t.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>n+"/"+s);for(let s of a)await t.mkdir(s);await t.write(n+"/config",`[core]
79
+ repositoryformatversion = 0
80
+ filemode = false
81
+ bare = ${e}
82
+ `+(e?"":` logallrefupdates = true
83
+ `)+` symlinks = false
84
+ ignorecase = true
85
+ `),await t.write(n+"/HEAD",`ref: refs/heads/${i}
86
+ `)}async function d_({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:f,dir:l,gitdir:c,url:u,corsProxy:d,ref:h,remote:p,depth:w,since:E,exclude:g,relative:m,singleBranch:x,noCheckout:$,noTags:S,headers:R,nonBlocking:b,batchSize:y=100}){try{if(await gh({fs:t,gitdir:c}),await oh({fs:t,gitdir:c,remote:p,url:u,force:!1}),d){let k=await Q.get({fs:t,gitdir:c});await k.set("http.corsProxy",d),await Q.save({fs:t,gitdir:c,config:k})}let{defaultBranch:_,fetchHead:A}=await Zs({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:h,remote:p,corsProxy:d,depth:w,since:E,exclude:g,relative:m,singleBranch:x,headers:R,tags:!S});if(A===null)return;h=h||_,h=h.replace("refs/heads/",""),await qs({fs:t,cache:e,onProgress:n,onPostCheckout:f,dir:l,gitdir:c,ref:h,remote:p,noCheckout:$,nonBlocking:b,batchSize:y})}catch(_){throw await t.rmdir(c,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function yh({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:f,gitdir:l=O(f,".git"),url:c,corsProxy:u=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:w=void 0,exclude:E=[],relative:g=!1,singleBranch:m=!1,noCheckout:x=!1,noTags:$=!1,headers:S={},cache:R={},nonBlocking:b=!1,batchSize:y=100}){try{v("fs",t),v("http",e),v("gitdir",l),x||v("dir",f),v("url",c);let _=new D(t),A=await j({fsp:_,dotgit:l});return await d_({fs:_,cache:R,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:f,gitdir:A,url:c,corsProxy:u,ref:d,remote:h,depth:p,since:w,exclude:E,relative:g,singleBranch:m,noCheckout:x,noTags:$,headers:S,nonBlocking:b,batchSize:y})}catch(_){throw _.caller="git.clone",_}}async function bh({fs:t,onSign:e,dir:r,gitdir:n=O(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:f=!1,dryRun:l=!1,noUpdateBranch:c=!1,disallowEmpty:u=!1,ref:d,parent:h,tree:p,cache:w={}}){try{v("fs",t),f||v("message",i),o&&v("onSign",e);let E=new D(t),g=await j({fsp:E,dotgit:n});return await Dn({fs:E,cache:w,onSign:e,gitdir:g,message:i,author:a,committer:s,signingKey:o,amend:f,dryRun:l,noUpdateBranch:c,disallowEmpty:u,ref:d,parent:h,tree:p})}catch(E){throw E.caller="git.commit",E}}async function _h({fs:t,dir:e,gitdir:r=O(e,".git"),fullname:n=!1,test:i=!1}){try{v("fs",t),v("gitdir",r);let a=new D(t),s=await j({fsp:a,dotgit:r});return await Pe({fs:a,gitdir:s,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function h_({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await I.exists({fs:t,gitdir:e,ref:r}))throw new H(r);let i=await I.expand({fs:t,gitdir:e,ref:r}),a=await Pe({fs:t,gitdir:e,fullname:!0});if(i===a){let f=await I.resolve({fs:t,gitdir:e,ref:i});await I.writeRef({fs:t,gitdir:e,ref:"HEAD",value:f})}await I.deleteRef({fs:t,gitdir:e,ref:i});let s=Er(r),o=await Q.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await Q.save({fs:t,gitdir:e,config:o})}async function vh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n}){try{v("fs",t),v("ref",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await h_({fs:i,gitdir:a,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function xh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n}){try{v("fs",t),v("ref",n);let i=new D(t),a=await j({fsp:i,dotgit:r});await I.deleteRef({fs:i,gitdir:a,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function p_({fs:t,gitdir:e,remote:r}){let n=await Q.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await Q.save({fs:t,gitdir:e,config:n})}async function Eh({fs:t,dir:e,gitdir:r=O(e,".git"),remote:n}){try{v("fs",t),v("remote",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await p_({fs:i,gitdir:a,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function w_({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await I.deleteRef({fs:t,gitdir:e,ref:r})}async function Sh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n}){try{v("fs",t),v("ref",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await w_({fs:i,gitdir:a,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function m_({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function g_({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await t.readdir(O(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let f=`${r}/objects/pack/${o}`,l=await Gs({fs:t,cache:e,filename:f,getExternalRefDelta:i});if(l.error)throw new U(l.error);for(let c of l.offsets.keys())c.startsWith(n)&&a.push(c)}return a}async function y_({fs:t,cache:e,gitdir:r,oid:n}){let i=o=>X({fs:t,cache:e,gitdir:r,oid:o}),a=await m_({fs:t,gitdir:r,oid:n}),s=await g_({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new gn("oids",n,a):new H(`an object matching "${n}"`)}async function kh({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,cache:i={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await y_({fs:a,cache:i,gitdir:s,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function $h({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n}){try{v("fs",t),v("gitdir",r),v("ref",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await I.expand({fs:i,gitdir:a,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function Vs({fs:t,cache:e,gitdir:r,oids:n}){let i={},a=n.length,s=new Set,o=new Map,f=await Ce.read({fs:t,gitdir:r}),l=async d=>{if(o.has(d))return o.get(d);let{object:h,type:p}=await X({fs:t,cache:e,gitdir:r,oid:d});if(p!=="commit")throw new ut(d,p,"commit");let w=Tt.from(h),{parent:E}=w.parseHeaders(),g=f.has(d)?[]:E;return o.set(d,g),g},c=n.map((d,h)=>({index:h,oid:d}));for(;c.length;){for(let{oid:h,index:p}of c)await l(h),i[h]||(i[h]=new Set),i[h].add(p),i[h].size===a&&s.add(h);let d=new Map;for(let{oid:h,index:p}of c)if(!s.has(h))for(let w of await l(h))(!i[w]||!i[w].has(p))&&d.set(w+":"+p,{oid:w,index:p});c=Array.from(d.values())}if(s.size<2)return[...s];let u=new Set;for(let d of s){let h=[...await l(d)],p=new Set;for(;h.length;){let w=h.pop();p.has(w)||(p.add(w),s.has(w)?u.add(w):h.push(...await l(w)))}}return[...s].filter(d=>!u.has(d))}async function Ah({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:f=!1,noUpdateBranch:l=!1,abortOnConflict:c=!0,message:u,author:d,committer:h,signingKey:p,onSign:w,mergeDriver:E,allowUnrelatedHistories:g=!1}){i===void 0&&(i=await Pe({fs:t,gitdir:n,fullname:!0})),i=await I.expand({fs:t,gitdir:n,ref:i}),a=await I.expand({fs:t,gitdir:n,ref:a});let m=await I.resolve({fs:t,gitdir:n,ref:i}),{oid:x}=await Bn({fs:t,cache:e,gitdir:n,oid:await I.resolve({fs:t,gitdir:n,ref:a})}),$=await Vs({fs:t,cache:e,gitdir:n,oids:[m,x]});if($.length!==1)if($.length===0&&g)$.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Tr;let S=$[0];if(S===x)return{oid:m,alreadyMerged:!0};if(s&&S===m)return!f&&!l&&await I.writeRef({fs:t,gitdir:n,ref:i,value:x}),{oid:x,fastForward:!0};{if(o)throw new Sn;let R=await J.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async y=>uh({fs:t,cache:e,dir:r,gitdir:n,index:y,ourOid:m,theirOid:x,baseOid:S,ourName:"HEAD",baseName:"base",theirName:Er(a),dryRun:f,abortOnConflict:c,mergeDriver:E}));if(R instanceof Ve)throw R;return u||(u=`Merge branch '${Er(a)}' into ${Er(i)}`),{oid:await Dn({fs:t,cache:e,gitdir:n,message:u,ref:i,tree:R,parent:[m,x],author:d,committer:h,signingKey:p,onSign:w,dryRun:f,noUpdateBranch:l}),tree:R,mergeCommit:!0}}}async function Oh({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:f,gitdir:l,ref:c,url:u,remote:d,remoteRef:h,prune:p,pruneTags:w,fastForward:E,fastForwardOnly:g,corsProxy:m,singleBranch:x,headers:$,author:S,committer:R,signingKey:b}){try{if(!c){let A=await Pe({fs:t,gitdir:l});if(!A)throw new At("ref");c=A}let{fetchHead:y,fetchHeadDescription:_}=await Zs({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,corsProxy:m,ref:c,url:u,remote:d,remoteRef:h,singleBranch:x,headers:$,prune:p,pruneTags:w});await Ah({fs:t,cache:e,gitdir:l,ours:c,theirs:y,fastForward:E,fastForwardOnly:g,message:`Merge ${_}`,author:S,committer:R,signingKey:b,dryRun:!1,noUpdateBranch:!1}),await qs({fs:t,cache:e,onProgress:n,dir:f,gitdir:l,ref:c,remote:d,noCheckout:!1})}catch(y){throw y.caller="git.pull",y}}async function Rh({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:f=O(o,".git"),ref:l,url:c,remote:u,remoteRef:d,corsProxy:h,singleBranch:p,headers:w={},cache:E={}}){try{v("fs",t),v("http",e),v("gitdir",f);let g={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},m=new D(t),x=await j({fsp:m,dotgit:f});return await Oh({fs:m,cache:E,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:x,ref:l,url:c,remote:u,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:w,author:g,committer:g})}catch(g){throw g.caller="git.fastForward",g}}async function Th({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:f=O(o,".git"),ref:l,remote:c,remoteRef:u,url:d,corsProxy:h,depth:p=null,since:w=null,exclude:E=[],relative:g=!1,tags:m=!1,singleBranch:x=!1,headers:$={},prune:S=!1,pruneTags:R=!1,cache:b={}}){try{v("fs",t),v("http",e),v("gitdir",f);let y=new D(t),_=await j({fsp:y,dotgit:f});return await Zs({fs:y,cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:_,ref:l,remote:c,remoteRef:u,url:d,corsProxy:h,depth:p,since:w,exclude:E,relative:g,tags:m,singleBranch:x,headers:$,prune:S,pruneTags:R})}catch(y){throw y.caller="git.fetch",y}}async function Ch({fs:t,dir:e,gitdir:r=O(e,".git"),oids:n,cache:i={}}){try{v("fs",t),v("gitdir",r),v("oids",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await Vs({fs:a,cache:i,gitdir:s,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function Ih({fs:t,filepath:e}){if(await t.exists(O(e,".git")))return e;{let r=Ze(e);if(r===e)throw new H(`git root for ${e}`);return Ih({fs:t,filepath:r})}}async function Ph({fs:t,filepath:e}){try{return v("fs",t),v("filepath",e),await Ih({fs:new D(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function Bh({fs:t,dir:e,gitdir:r=O(e,".git"),path:n}){try{v("fs",t),v("gitdir",r),v("path",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await In({fs:i,gitdir:a,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function b_({fs:t,gitdir:e,path:r}){return(await Q.get({fs:t,gitdir:e})).getall(r)}async function Dh({fs:t,dir:e,gitdir:r=O(e,".git"),path:n}){try{v("fs",t),v("gitdir",r),v("path",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await b_({fs:i,gitdir:a,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}function Ud(t,e,r){let n=e.split("/"),i=n.pop();if(i==="__proto__"||n.includes("__proto__"))return;let a=t;for(let s of n)Object.prototype.hasOwnProperty.call(a,s)||(a[s]={}),a=a[s];a[i]=r}async function Nh({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{v("http",t),v("url",a);let l=await Dr.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),c={capabilities:[...l.capabilities]};for(let[u,d]of l.refs)Ud(c,u,d);for(let[u,d]of l.symrefs)Ud(c,u,d);return c}catch(f){throw f.caller="git.getRemoteInfo",f}}function jh(t,e,r,n){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(n){let f=a.replace("^{}",""),l=i[i.length-1],c=l?.ref===f?l:i.find(u=>u.ref===f);c!==void 0&&(c.peeled=s)}continue}let o={ref:a,oid:s};r&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function Uh({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:f=2}){try{v("http",t),v("url",a);let c=await Dr.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:f});if(c.protocolVersion===2)return{protocolVersion:c.protocolVersion,capabilities:c.capabilities2};let u={};for(let d of c.capabilities){let[h,p]=d.split("=");p?u[h]=p:u[h]=!0}return{protocolVersion:1,capabilities:u,refs:jh(c,void 0,!0,!0)}}catch(l){throw l.caller="git.getRemoteInfo2",l}}async function __({type:t,object:e,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Oe.wrap({type:t,object:e})),n=await me(e)),{oid:n,object:e}}async function Mh({object:t}){try{v("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:n}=await __({type:e,format:"content",object:t});return{oid:r,type:e,object:n,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function v_({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=O(n,a);let s=await t.read(a),o=l=>X({fs:t,cache:e,gitdir:i,oid:l}),f=await mn.fromPack({pack:s,getExternalRefDelta:o,onProgress:r});return await t.write(a.replace(/\.pack$/,".idx"),await f.toBuffer()),{oids:[...f.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function Fh({fs:t,onProgress:e,dir:r,gitdir:n=O(r,".git"),filepath:i,cache:a={}}){try{v("fs",t),v("dir",r),v("gitdir",r),v("filepath",i);let s=new D(t),o=await j({fsp:s,dotgit:n});return await v_({fs:s,cache:a,onProgress:e,dir:r,gitdir:o,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function zh({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O(r,".git"),defaultBranch:i="master"}){try{v("fs",t),v("gitdir",n),e||v("dir",r);let a=new D(t),s=await j({fsp:a,dotgit:n});return await gh({fs:a,bare:e,dir:r,gitdir:s,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function Lh({fs:t,cache:e,gitdir:r,oid:n,ancestor:i,depth:a}){let s=await Ce.read({fs:t,gitdir:r});if(!n)throw new At("oid");if(!i)throw new At("ancestor");if(n===i)return!1;let o=[n],f=new Set,l=0;for(;o.length;){if(l++===a)throw new $n(a);let c=o.shift(),{type:u,object:d}=await X({fs:t,cache:e,gitdir:r,oid:c});if(u!=="commit")throw new ut(c,u,"commit");let h=Tt.from(d).parse();for(let p of h.parent)if(p===i)return!0;if(!s.has(c))for(let p of h.parent)f.has(p)||(o.push(p),f.add(p))}return!1}async function Gh({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,ancestor:i,depth:a=-1,cache:s={}}){try{v("fs",t),v("gitdir",r),v("oid",n),v("ancestor",i);let o=new D(t),f=await j({fsp:o,dotgit:r});return await Lh({fs:o,cache:s,gitdir:f,oid:n,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function Hh({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n}){try{v("fs",t),v("dir",e),v("gitdir",r),v("filepath",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return Re.isIgnored({fs:i,dir:e,gitdir:a,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function qh({fs:t,dir:e,gitdir:r=O(e,".git"),remote:n}){try{v("fs",t),v("gitdir",r);let i=new D(t),a=await j({fsp:i,dotgit:r});return I.listBranches({fs:i,gitdir:a,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function x_({fs:t,gitdir:e,ref:r,cache:n}){if(r){let i=await I.resolve({gitdir:e,fs:t,ref:r}),a=[];return await Wh({fs:t,cache:n,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return J.acquire({fs:t,gitdir:e,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function Wh({fs:t,cache:e,gitdir:r,oid:n,filenames:i,prefix:a}){let{tree:s}=await Nr({fs:t,cache:e,gitdir:r,oid:n});for(let o of s)o.type==="tree"?await Wh({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:i,prefix:O(a,o.path)}):i.push(O(a,o.path))}async function Zh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,cache:i={}}){try{v("fs",t),v("gitdir",r);let a=new D(t),s=await j({fsp:a,dotgit:r});return await x_({fs:a,cache:i,gitdir:s,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function E_({fs:t,cache:e,gitdir:r,ref:n}){let i;try{i=await I.resolve({gitdir:r,fs:t,ref:n})}catch(o){if(o instanceof H)return[];throw o}return(await Nr({fs:t,cache:e,gitdir:r,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function Vh({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n="refs/notes/commits",cache:i={}}){try{v("fs",t),v("gitdir",r),v("ref",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await E_({fs:a,cache:i,gitdir:s,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function Xh({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n}){try{v("fs",t),v("gitdir",r);let i=new D(t),a=await j({fsp:i,dotgit:r});return I.listRefs({fs:i,gitdir:a,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function S_({fs:t,gitdir:e}){let r=await Q.get({fs:t,gitdir:e}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{let s=await r.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function Yh({fs:t,dir:e,gitdir:r=O(e,".git")}){try{v("fs",t),v("gitdir",r);let n=new D(t),i=await j({fsp:n,dotgit:r});return await S_({fs:n,gitdir:i})}catch(n){throw n.caller="git.listRemotes",n}}async function k_(t){let e=K.streamReader(t),r=[],n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,a,...s]=n.split(" "),o={ref:a,oid:i};for(let f of s){let[l,c]=f.split(":");l==="symref-target"?o.target=c:l==="peeled"&&(o.peeled=c)}r.push(o)}return r}async function $_({prefix:t,symrefs:e,peelTags:r}){let n=[];return n.push(K.encode(`command=ls-refs
87
+ `)),n.push(K.encode(`agent=${Li.agent}
88
+ `)),(r||e||t)&&n.push(K.delim()),r&&n.push(K.encode("peel")),e&&n.push(K.encode("symrefs")),t&&n.push(K.encode(`ref-prefix ${t}`)),n.push(K.flush()),n}async function Kh({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:f=2,prefix:l,symrefs:c,peelTags:u}){try{v("http",t),v("url",a);let d=await Br.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:f});if(d.protocolVersion===1)return jh(d,l,c,u);let h=await $_({prefix:l,symrefs:c,peelTags:u}),p=await Br.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return k_(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function Jh({fs:t,dir:e,gitdir:r=O(e,".git")}){try{v("fs",t),v("gitdir",r);let n=new D(t),i=await j({fsp:n,dotgit:r});return I.listTags({fs:n,gitdir:i})}catch(n){throw n.caller="git.listTags",n}}function A_(t,e){return t.committer.timestamp-e.committer.timestamp}var O_="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function Md({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===O_)return;let a=n,s,o=await Pr({fs:t,cache:e,gitdir:r,oid:n}),f=o.tree;return i===o.oid?s=o.path:(s=await Qh({fs:t,cache:e,gitdir:r,tree:f,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function Qh({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let f=n.entries().map(function(l){let c;return l.oid===i?(c=O(o,l.path),s.push(c)):l.type==="tree"&&(c=X({fs:t,cache:e,gitdir:r,oid:l.oid}).then(function({object:u}){return Qh({fs:t,cache:e,gitdir:r,tree:Ot.from(u),fileId:i,oid:a,filepaths:s,parentPath:O(o,l.path)})})),c});return await Promise.all(f),s}async function R_({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:a,since:s,author:o,force:f,follow:l,includeChanges:c}){let u=typeof s>"u"?void 0:Math.floor(s.valueOf()/1e3),d=o==null?void 0:new RegExp(o,"i"),h=({commit:y})=>d===void 0?!0:y.author?d.test(`${y.author.name} <${y.author.email}>`):!1,p=[],w=y=>{h(y)&&p.push(y)},E=await Ce.read({fs:t,gitdir:r}),g=await I.resolve({fs:t,gitdir:r,ref:i}),m=[await se({fs:t,cache:e,gitdir:r,oid:g})],x,$,S,R;function b(y){R&&n&&w(y)}for(;m.length>0;){let y=m.pop();if(u!==void 0&&y.commit.committer.timestamp<=u)break;if(n){let _;try{_=await ih({fs:t,cache:e,gitdir:r,oid:y.commit.tree,filepath:n}),S&&(x!==_.oid||$!==_.mode)&&w(S),x=_.oid,$=_.mode,S=y,R=!0}catch(A){if(A instanceof H){let k=l&&x;if(k&&(k=await Md({fs:t,cache:e,gitdir:r,oid:y.commit.tree,fileId:x}),k))if(Array.isArray(k)){if(S){let T=await Md({fs:t,cache:e,gitdir:r,oid:S.commit.tree,fileId:x});if(Array.isArray(T))if(k=k.filter(B=>T.indexOf(B)===-1),k.length===1)k=k[0],n=k,S&&w(S);else{k=!1,S&&w(S);break}}}else n=k,S&&w(S);if(!k){if(R&&x&&(w(S),!f))break;if(!f&&!l)throw A}S=y,R=!1}else throw A}}else w(y);if(a!==void 0&&p.length===a){b(y);break}if(!E.has(y.oid))for(let _ of y.commit.parent){let A=await se({fs:t,cache:e,gitdir:r,oid:_});m.map(k=>k.oid).includes(A.oid)||m.push(A)}m.length===0&&b(y),m.sort((_,A)=>A_(_.commit,A.commit))}if(c)for(let y of p)y.commit.changes=await T_({fs:t,cache:e,gitdir:r,commit:y,shallow:E.has(y.oid)});return p}async function T_({fs:t,cache:e,gitdir:r,commit:n,shallow:i}){let a=i||!n.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":n.commit.parent[0];return Wt({fs:t,cache:e,gitdir:r,trees:[at({ref:n.oid}),at({ref:a})],map:async(s,[o,f])=>{let[l,c]=await Promise.all([o&&o.type(),f&&f.type()]);if(l==="tree")return c&&c!=="tree"?[null,await f.oid(),s]:void 0;if(c==="tree")return l?[await o.oid(),null,s]:void 0;let[u,d]=await Promise.all([o?o.oid():null,f?f.oid():null]);if(u!==d)return[u,d,s]}})}async function tp({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,author:o,force:f,follow:l,includeChanges:c=!1,cache:u={}}){try{v("fs",t),v("gitdir",r),v("ref",i);let d=new D(t),h=await j({fsp:d,dotgit:r});return await R_({fs:d,cache:u,gitdir:h,filepath:n,ref:i,depth:a,since:s,author:o,force:f,follow:l,includeChanges:c})}catch(d){throw d.caller="git.log",d}}async function ep({fs:t,onSign:e,dir:r,gitdir:n=O(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:f=!1,noUpdateBranch:l=!1,abortOnConflict:c=!0,message:u,author:d,committer:h,signingKey:p,cache:w={},mergeDriver:E,allowUnrelatedHistories:g=!1}){try{v("fs",t),p&&v("onSign",e);let m=new D(t),x=await j({fsp:m,dotgit:n}),$=await Te({fs:m,gitdir:x,author:d});if(!$&&(!o||!s))throw new wt("author");let S=await Ke({fs:m,gitdir:x,author:$,committer:h});if(!S&&(!o||!s))throw new wt("committer");return await Ah({fs:m,cache:w,dir:r,gitdir:x,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:f,noUpdateBranch:l,abortOnConflict:c,message:u,author:$,committer:S,signingKey:p,onSign:e,mergeDriver:E,allowUnrelatedHistories:g})}catch(m){throw m.caller="git.merge",m}}var C_={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function rp({fs:t,cache:e,dir:r,gitdir:n=O(r,".git"),oids:i}){let a=new Fd,s=[];function o(c,u){let d=Buffer.from(c,u);s.push(d),a.update(d)}async function f({stype:c,object:u}){let d=C_[c],h=u.length,p=h>15?128:0,w=h&15;h=h>>>4;let E=(p|d|w).toString(16);for(o(E,"hex");p;)p=h>127?128:0,E=p|h&127,o(zs(2,E),"hex"),h=h>>>7;o(Buffer.from(await Qd(u)))}o("PACK"),o("00000002","hex"),o(zs(8,i.length),"hex");for(let c of i){let{type:u,object:d}=await X({fs:t,cache:e,gitdir:n,oid:c});await f({write:o,object:d,stype:u})}let l=a.digest();return s.push(l),s}async function I_({fs:t,cache:e,gitdir:r,oids:n,write:i}){let a=await rp({fs:t,cache:e,gitdir:r,oids:n}),s=Buffer.from(await Di(a)),f=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(O(r,`objects/pack/${f}`),s),{filename:f}):{filename:f,packfile:new Uint8Array(s)}}async function np({fs:t,dir:e,gitdir:r=O(e,".git"),oids:n,write:i=!1,cache:a={}}){try{v("fs",t),v("gitdir",r),v("oids",n);let s=new D(t),o=await j({fsp:s,dotgit:r});return await I_({fs:s,cache:a,gitdir:o,oids:n,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function ip({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:f=O(o,".git"),ref:l,url:c,remote:u,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:w=!0,fastForwardOnly:E=!1,corsProxy:g,singleBranch:m,headers:x={},author:$,committer:S,signingKey:R,cache:b={}}){try{v("fs",t),v("gitdir",f);let y=new D(t),_=await j({fsp:y,dotgit:f}),A=await Te({fs:y,gitdir:_,author:$});if(!A)throw new wt("author");let k=await Ke({fs:y,gitdir:_,author:A,committer:S});if(!k)throw new wt("committer");return await Oh({fs:y,cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:_,ref:l,url:c,remote:u,remoteRef:d,fastForward:w,fastForwardOnly:E,corsProxy:g,singleBranch:m,headers:x,author:A,committer:k,signingKey:R,prune:h,pruneTags:p})}catch(y){throw y.caller="git.pull",y}}async function P_({fs:t,cache:e,dir:r,gitdir:n=O(r,".git"),start:i,finish:a}){let s=await Ce.read({fs:t,gitdir:n}),o=new Set,f=new Set;for(let u of i)o.add(await I.resolve({fs:t,gitdir:n,ref:u}));for(let u of a)try{let d=await I.resolve({fs:t,gitdir:n,ref:u});f.add(d)}catch{}let l=new Set;async function c(u){l.add(u);let{type:d,object:h}=await X({fs:t,cache:e,gitdir:n,oid:u});if(d==="tag"){let w=Rt.from(h).headers().object;return c(w)}if(d!=="commit")throw new ut(u,d,"commit");if(!s.has(u)){let w=Tt.from(h).headers().parent;for(u of w)!f.has(u)&&!l.has(u)&&await c(u)}}for(let u of o)await c(u);return l}async function As({fs:t,cache:e,dir:r,gitdir:n=O(r,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:f,object:l}=await X({fs:t,cache:e,gitdir:n,oid:o});if(f==="tag"){let u=Rt.from(l).headers().object;await s(u)}else if(f==="commit"){let u=Tt.from(l).headers().tree;await s(u)}else if(f==="tree"){let c=Ot.from(l);for(let u of c)u.type==="blob"&&a.add(u.oid),u.type==="tree"&&await s(u.oid)}}for(let o of i)await s(o);return a}async function B_(t){let e={},r="",n=K.streamReader(t),i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+`
89
+ `),i=await n();let a=r.toString("utf8").split(`
90
+ `);if(i=a.shift(),!i.startsWith("unpack "))throw new Ye('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),f=s.slice(3),l=f.indexOf(" ");l===-1&&(l=f.length);let c=f.slice(0,l),u=f.slice(l+1);e.refs[c]={ok:o==="ok",error:u}}return e}async function D_({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(K.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
91
+ `)),n="";return r.push(K.flush()),r}async function N_({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:f,gitdir:l,ref:c,remoteRef:u,remote:d,url:h,force:p=!1,delete:w=!1,corsProxy:E,headers:g={},signal:m}){let x=c||await Pe({fs:t,gitdir:l});if(typeof x>"u")throw new At("ref");let $=await Q.get({fs:t,gitdir:l});d=d||await $.get(`branch.${x}.pushRemote`)||await $.get("remote.pushDefault")||await $.get(`branch.${x}.remote`)||"origin";let S=h||await $.get(`remote.${d}.pushurl`)||await $.get(`remote.${d}.url`);if(typeof S>"u")throw new At("remote OR url");let R=u||await $.get(`branch.${x}.merge`);if(typeof S>"u")throw new At("remoteRef");E===void 0&&(E=await $.get("http.corsProxy"));let b=await I.expand({fs:t,gitdir:l,ref:x}),y=w?"0000000000000000000000000000000000000000":await I.resolve({fs:t,gitdir:l,ref:b}),_=Dr.getRemoteHelperFor({url:S}),A=await _.discover({http:r,onAuth:Ni({config:$,onAuth:a}),onAuthSuccess:s,onAuthFailure:Ni({config:$,onAuth:o}),corsProxy:E,service:"git-receive-pack",url:S,headers:g,protocolVersion:1,signal:m}),k=A.auth,T;if(!R)T=b;else try{T=await I.expandAgainstMap({ref:R,map:A.refs})}catch(ot){if(ot instanceof H)T=R.startsWith("refs/")?R:`refs/heads/${R}`;else throw ot}let B=A.refs.get(T)||"0000000000000000000000000000000000000000";if(f&&!await f({remote:d,url:S,localRef:{ref:w?"(delete)":b,oid:y},remoteRef:{ref:T,oid:B}}))throw new Ir;let M=!A.capabilities.has("no-thin"),et=new Set;if(!w){let ot=[...A.refs.values()],Xt=new Set;if(B!=="0000000000000000000000000000000000000000"){let ct=[];try{ct=await Vs({fs:t,cache:e,gitdir:l,oids:[y,B]})}catch{ct=[]}for(let Yt of ct)ot.push(Yt);M&&(Xt=await As({fs:t,cache:e,gitdir:l,oids:ct}))}if(!ot.includes(y)){let ct=await P_({fs:t,cache:e,gitdir:l,start:[y],finish:ot});et=await As({fs:t,cache:e,gitdir:l,oids:ct})}if(M){try{let ct=await I.resolve({fs:t,gitdir:l,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Yt}=await I.resolveAgainstMap({ref:ct.replace(`refs/remotes/${d}/`,""),fullref:ct,map:A.refs}),nt=[Yt];for(let Xi of await As({fs:t,cache:e,gitdir:l,oids:nt}))Xt.add(Xi)}catch{}for(let ct of Xt)et.delete(ct)}if(y===B&&(p=!0),!p){if(b.startsWith("refs/tags")&&B!=="0000000000000000000000000000000000000000")throw new Cr("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&B!=="0000000000000000000000000000000000000000"&&!await Lh({fs:t,cache:e,gitdir:l,oid:y,ancestor:B,depth:-1}))throw new Cr("not-fast-forward")}}let gt=wh([...A.capabilities],["report-status","side-band-64k",`agent=${Li.agent}`]),yt=await D_({capabilities:gt,triplets:[{oldoid:B,oid:y,fullRef:T}]}),Pt=w?[]:await rp({fs:t,cache:e,gitdir:l,oids:[...et]}),Fr=await _.connect({http:r,onProgress:n,corsProxy:E,service:"git-receive-pack",url:S,auth:k,headers:g,body:[...yt,...Pt],signal:m}),{packfile:Vi,progress:rr}=await ji.demux(Fr.body);if(i){let ot=mh(rr);jn(ot,async Xt=>{await i(Xt)})}let vt=await B_(Vi);if(Fr.headers&&(vt.headers=Fr.headers),d&&vt.ok&&vt.refs[T].ok&&!b.startsWith("refs/tags")){let ot=`refs/remotes/${d}/${T.replace("refs/heads/","")}`;w?await I.deleteRef({fs:t,gitdir:l,ref:ot}):await I.writeRef({fs:t,gitdir:l,ref:ot,value:y})}if(vt.ok&&Object.values(vt.refs).every(ot=>ot.ok))return vt;{let ot=Object.entries(vt.refs).filter(([Xt,ct])=>!ct.ok).map(([Xt,ct])=>`
92
+ - ${Xt}: ${ct.error}`).join("");throw new kn(ot,vt)}}async function ap({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:f,gitdir:l=O(f,".git"),ref:c,remoteRef:u,remote:d="origin",url:h,force:p=!1,delete:w=!1,corsProxy:E,headers:g={},cache:m={},signal:x}){try{v("fs",t),v("http",e),v("gitdir",l);let $=new D(t),S=await j({fsp:$,dotgit:l});return await N_({fs:$,cache:m,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:S,ref:c,remoteRef:u,remote:d,url:h,force:p,delete:w,corsProxy:E,headers:g,signal:x})}catch($){throw $.caller="git.push",$}}async function sp({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await X({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Rt.from(a).parse().object,sp({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new ut(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function op({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await zi({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await sp({fs:t,cache:e,gitdir:r,oid:n})}async function cp({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,filepath:i,cache:a={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let s=new D(t),o=await j({fsp:s,dotgit:r});return await op({fs:s,cache:a,gitdir:o,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function Xs({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,cache:i={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await se({fs:a,cache:i,gitdir:s,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function j_({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await I.resolve({gitdir:r,fs:t,ref:n}),{blob:s}=await op({fs:t,cache:e,gitdir:r,oid:a,filepath:i});return s}async function fp({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{v("fs",t),v("gitdir",r),v("ref",n),v("oid",i);let s=new D(t),o=await j({fsp:s,dotgit:r});return await j_({fs:s,cache:a,gitdir:o,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function lp({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let f=new D(t),l=await j({fsp:f,dotgit:r});a!==void 0&&(n=await zi({fs:f,cache:o,gitdir:l,oid:n,filepath:a}));let u=await X({fs:f,cache:o,gitdir:l,oid:n,format:i==="parsed"?"content":i});if(u.oid=n,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Tt.from(u.object).parse();break;case"tree":u.object=Ot.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Rt.from(u.object).parse();break;default:throw new ut(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(f){throw f.caller="git.readObject",f}}async function U_({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await X({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new ut(n,i,"tag");let s=Rt.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function up({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,cache:i={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await U_({fs:a,cache:i,gitdir:s,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function dp({fs:t,dir:e,gitdir:r=O(e,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{v("fs",t),v("gitdir",r),v("oid",n);let s=new D(t),o=await j({fsp:s,dotgit:r});return await Nr({fs:s,cache:a,gitdir:o,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function hp({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n,cache:i={}}){try{v("fs",t),v("gitdir",r),v("filepath",n);let a=new D(t),s=await j({fsp:a,dotgit:r});await J.acquire({fs:a,gitdir:s,cache:i},async function(o){let f=Array.isArray(n)?n:[n];for(let l of f)o.delete({filepath:l})})}catch(a){throw a.caller="git.remove",a}}async function M_({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:f}){let l;try{l=await I.resolve({gitdir:n,fs:t,ref:i})}catch(p){if(!(p instanceof H))throw p}let u=(await Nr({fs:t,cache:e,gitdir:n,oid:l||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;u=u.filter(p=>p.path!==a);let d=await Nn({fs:t,gitdir:n,tree:u});return await Dn({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:l&&[l],message:`Note removed by 'isomorphic-git removeNote'
93
+ `,author:s,committer:o,signingKey:f})}async function pp({fs:t,onSign:e,dir:r,gitdir:n=O(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:f,cache:l={}}){try{v("fs",t),v("gitdir",n),v("oid",a);let c=new D(t),u=await j({fsp:c,dotgit:n}),d=await Te({fs:c,gitdir:u,author:s});if(!d)throw new wt("author");let h=await Ke({fs:c,gitdir:u,author:d,committer:o});if(!h)throw new wt("committer");return await M_({fs:c,cache:l,onSign:e,gitdir:u,ref:i,oid:a,author:d,committer:h,signingKey:f})}catch(c){throw c.caller="git.removeNote",c}}async function F_({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(!$r(n,!0))throw new Nt(n,kr.clean(n));if(!$r(r,!0))throw new Nt(r,kr.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await I.exists({fs:t,gitdir:e,ref:s}))throw new qt("branch",n,!1);let f=await I.resolve({fs:t,gitdir:e,ref:a,depth:1});await I.writeRef({fs:t,gitdir:e,ref:s,value:f}),await I.deleteRef({fs:t,gitdir:e,ref:a});let c=await Pe({fs:t,gitdir:e,fullname:!0})===a;(i||c)&&await I.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function wp({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,oldref:i,checkout:a=!1}){try{v("fs",t),v("gitdir",r),v("ref",n),v("oldref",i);let s=new D(t),o=await j({fsp:s,dotgit:r});return await F_({fs:s,gitdir:o,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function mp({gitdir:t,type:e,object:r}){return me(Oe.wrap({type:e,object:r}))}async function gp({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n,ref:i,cache:a={}}){try{v("fs",t),v("gitdir",r),v("filepath",n);let s=new D(t),o=await j({fsp:s,dotgit:r}),f,l;try{f=await I.resolve({fs:s,gitdir:o,ref:i||"HEAD"})}catch(d){if(i||!(d instanceof H))throw d}if(f)try{f=await zi({fs:s,cache:a,gitdir:o,oid:f,filepath:n})}catch(d){if(!(d instanceof H)&&!(d instanceof ye)&&!(d instanceof ut&&d.data.filepath))throw d;f=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(O(e,n));u&&(l=await mp({gitdir:o,type:"blob",object:u}),f===l&&(c=await s.lstat(O(e,n)))),await J.acquire({fs:s,gitdir:o,cache:a},async function(d){d.delete({filepath:n}),f&&d.insert({filepath:n,stats:c,oid:f})})}catch(s){throw s.caller="git.reset",s}}async function yp({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,depth:i}){try{v("fs",t),v("gitdir",r),v("ref",n);let a=new D(t),s=await j({fsp:a,dotgit:r});return await I.resolve({fs:a,gitdir:s,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function bp({fs:t,dir:e,gitdir:r=O(e,".git"),path:n,value:i,append:a=!1}){try{v("fs",t),v("gitdir",r),v("path",n);let s=new D(t),o=await j({fsp:s,dotgit:r}),f=await Q.get({fs:s,gitdir:o});a?await f.append(n,i):await f.set(n,i),await Q.save({fs:s,gitdir:o,config:f})}catch(s){throw s.caller="git.setConfig",s}}async function _p({fs:t,gitdir:e,commit:r}){let n=Tt.from(r).toObject();return await Ct({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var Ui=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,r,n){let i=e.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",s=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${e.email} ${s} ${o} ${n}
94
+ `}static getStashReflogEntry(e,r=!1){return e.split(`
95
+ `).filter(a=>a).reverse().map((a,s)=>r?`stash@{${s}}: ${a.split(" ")[1]}`:a)}},Je=class t{constructor({fs:e,dir:r,gitdir:n=O(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O(this.gitdir,t.refStash)}get refLogsStashPath(){return O(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Te({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new wt("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:n}){return _p({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:n,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 Nt(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?se({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return I.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=Ui.createStashReflogEntry(n,e,r),a=this.refLogsStashPath;await lt(a,async()=>{let s=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,s+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Ui.getStashReflogEntry(r,e)}};async function vp({fs:t,dir:e,gitdir:r,message:n=""}){let i=new Je({fs:t,dir:e,gitdir:r});await i.getAuthor();let a=await Pe({fs:t,gitdir:r,fullname:!1}),s=await I.resolve({fs:t,gitdir:r,ref:"HEAD"}),f=(await Xs({fs:t,dir:e,gitdir:r,oid:s})).commit.message,l=[s],c=null,u=at({ref:"HEAD"}),d=await Rd({fs:t,dir:e,gitdir:r,treePair:[at({ref:"HEAD"}),"stage"]});if(d){let E=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:d,parent:l});l.push(E),c=d,u=ge()}let h=await Rd({fs:t,dir:e,gitdir:r,treePair:[u,"workdir"]});if(h){let E=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:h,parent:[l[l.length-1]]});l.push(E),c=h}if(!c||!d&&!h)throw new H("changes, nothing to stash");let p=(n.trim()||`WIP on ${a}`)+`: ${s.substring(0,7)} ${f}`;return{stashCommit:await i.writeStashCommit({message:p,tree:c,parent:l}),stashMsg:p,branch:a,stashMgr:i}}async function z_({fs:t,dir:e,gitdir:r,message:n=""}){let{stashCommit:i,stashMsg:a,branch:s,stashMgr:o}=await vp({fs:t,dir:e,gitdir:r,message:n});return await o.writeStashRef(i),await o.writeStashReflogEntry({stashCommit:i,message:a}),await Ws({fs:t,dir:e,gitdir:r,ref:s,track:!1,force:!0}),i}async function L_({fs:t,dir:e,gitdir:r,message:n=""}){let{stashCommit:i}=await vp({fs:t,dir:e,gitdir:r,message:n});return i}async function xp({fs:t,dir:e,gitdir:r,refIdx:n=0}){let a=await new Je({fs:t,dir:e,gitdir:r}).readStashCommit(n),{parent:s=null}=a.commit?a.commit:{};if(!(!s||!Array.isArray(s)))for(let o=0;o<s.length-1;o++){let l=(await se({fs:t,cache:{},gitdir:r,oid:s[o+1]})).commit.message.startsWith("stash-Index");await dh({fs:t,dir:e,gitdir:r,stashCommit:s[o+1],parentCommit:s[o],wasStaged:l})}}async function Ep({fs:t,dir:e,gitdir:r,refIdx:n=0}){let i=new Je({fs:t,dir:e,gitdir:r});if(!(await i.readStashCommit(n)).commit)return;let s=i.refStashPath;await lt(s,async()=>{await t.exists(s)&&await t.rm(s)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(n,1);let f=i.refLogsStashPath;await lt(f,async()=>{if(o.length){await t.write(f,o.reverse().join(`
96
+ `)+`
97
+ `,"utf8");let l=o[o.length-1].split(" ")[1];await i.writeStashRef(l)}else await t.rm(f)})}async function G_({fs:t,dir:e,gitdir:r}){return new Je({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function H_({fs:t,dir:e,gitdir:r}){let n=new Je({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await lt(i,async()=>{await Promise.all(i.map(async a=>{if(await t.exists(a))return t.rm(a)}))})}async function q_({fs:t,dir:e,gitdir:r,refIdx:n=0}){await xp({fs:t,dir:e,gitdir:r,refIdx:n}),await Ep({fs:t,dir:e,gitdir:r,refIdx:n})}async function Sp({fs:t,dir:e,gitdir:r=O(e,".git"),op:n="push",message:i="",refIdx:a=0}){v("fs",t),v("dir",e),v("gitdir",r),v("op",n);let s={push:z_,apply:xp,drop:Ep,list:G_,clear:H_,pop:q_,create:L_},o=["apply","drop","pop"];try{let f=new D(t),l=await j({fsp:f,dotgit:r});["refs","logs","logs/refs"].map(d=>O(l,d)).forEach(async d=>{await f.exists(d)||await f.mkdir(d)});let u=s[n];if(u){if(o.includes(n)&&a<0)throw new Nt(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await u({fs:f,dir:e,gitdir:l,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(f){throw f.caller="git.stash",f}}async function kp({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:n,cache:i={},refresh:a=!0}){try{v("fs",t),v("gitdir",r),v("filepath",n);let s=new D(t),o=await j({fsp:s,dotgit:r}),f=await Z_({fs:s,cache:i,gitdir:o}),l=await $p({fs:s,cache:i,gitdir:o,tree:f,path:n}),c=await J.acquire({fs:s,gitdir:o,cache:i},async function(E){for(let g of E)if(g.path===n)return g;return null});if(l===null&&c===null&&await Re.isIgnored({fs:s,gitdir:o,dir:e,filepath:n}))return"ignored";let u=await s.lstat(O(e,n)),d=l!==null,h=c!==null,p=u!==null&&(d||h||await W_({fs:s,dir:e,filepath:n})),w=async()=>{if(h&&!Oi(c,u))return c.oid;{let g=await(await Q.get({fs:s,gitdir:o})).get("core.autocrlf"),m=await s.read(O(e,n),{autocrlf:g}),x=await mp({gitdir:o,type:"blob",object:m});return a&&h&&c.oid===x&&u.size!==-1&&await J.acquire({fs:s,gitdir:o,cache:i},async function($){$.insert({filepath:n,stats:u,oid:x})}),x}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await w()===c.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return l===c.oid,"*deleted";if(d&&p&&!h)return await w()===l?"*undeleted":"*undeletemodified";if(d&&p&&h){let E=await w();return E===l?E===c.oid?"unmodified":"*unmodified":E===c.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function W_({fs:t,dir:e,filepath:r}){let n=r.replace(/\\/g,"/").split("/").filter(a=>a!==""&&a!=="."),i=e;for(let a of n){let s;try{s=await t._readdir(i)}catch(o){if(o.code==="ENOENT"||o.code==="ENOTDIR")return!1;throw o}if(!s.some(o=>o.normalize()===a.normalize()))return!1;i=O(i,a)}return!0}async function $p({fs:t,cache:e,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of n)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:f}=await X({fs:t,cache:e,gitdir:r,oid:s.oid});if(o==="tree"){let l=Ot.from(f);return $p({fs:t,cache:e,gitdir:r,tree:l,path:i})}if(o==="blob")throw new ut(s.oid,o,"blob",i.join("/"))}return null}async function Z_({fs:t,cache:e,gitdir:r}){let n;try{n=await I.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof H)return[];throw a}let{tree:i}=await Nr({fs:t,cache:e,gitdir:r,oid:n});return i}async function Ap({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1,refresh:f=!0}){try{v("fs",t),v("gitdir",r),v("ref",n);let l=new D(t),c=await j({fsp:l,dotgit:r});return await Wt({fs:l,cache:s,dir:e,gitdir:c,trees:[at({ref:n}),Qe({refresh:f}),ge()],map:async function(u,[d,h,p]){if(!d&&!p&&h&&!o&&await Re.isIgnored({fs:l,dir:e,filepath:u})||!i.some(y=>Hs(u,y)))return null;if(a&&!a(u))return;let[w,E,g]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),m=[w,E,g].includes("blob");if((w==="tree"||w==="special")&&!m)return;if(w==="commit")return null;if((E==="tree"||E==="special")&&!m)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!m)return;let x=w==="blob"?await d.oid():void 0,$=g==="blob"?await p.oid():void 0,S;w!=="blob"&&E==="blob"&&g!=="blob"?S="42":E==="blob"&&(S=await h.oid());let R=[void 0,x,S,$],b=R.map(y=>R.indexOf(y));return b.shift(),[u,...b]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Op({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,object:i,force:a=!1}){try{v("fs",t),v("gitdir",r),v("ref",n);let s=new D(t);if(n===void 0)throw new At("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await j({fsp:s,dotgit:r}),f=await I.resolve({fs:s,gitdir:o,ref:i||"HEAD"});if(!a&&await I.exists({fs:s,gitdir:o,ref:n}))throw new qt("tag",n);await I.writeRef({fs:s,gitdir:o,ref:n,value:f})}catch(s){throw s.caller="git.tag",s}}async function Rp({fs:t,dir:e,gitdir:r=O(e,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:f,force:l}){try{v("fs",t),v("gitdir",r),v("filepath",i);let c=new D(t),u=await j({fsp:c,dotgit:r});if(f)return await J.acquire({fs:c,gitdir:u,cache:n},async function(h){if(!l){let p=await c.lstat(O(e,i));if(p){if(p.isDirectory())throw new ye("directory");return}}h.has({filepath:i})&&h.delete({filepath:i})});let d;if(!a){if(d=await c.lstat(O(e,i)),!d)throw new H(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new ye("directory")}return await J.acquire({fs:c,gitdir:u,cache:n},async function(h){if(!o&&!h.has({filepath:i}))throw new H(`file at "${i}" in index and "add" not set`);let p;if(a)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};else{p=d;let w=p.isSymbolicLink()?await c.readlink(O(e,i)):await c.read(O(e,i));a=await Ct({fs:c,gitdir:u,type:"blob",format:"content",object:w})}return h.insert({filepath:i,oid:a,stats:p}),a})}catch(c){throw c.caller="git.updateIndex",c}}function Tp(){try{return Li.version}catch(t){throw t.caller="git.version",t}}async function Cp({fs:t,dir:e,gitdir:r=O(e,".git"),trees:n,map:i,reduce:a,iterate:s,cache:o={}}){try{v("fs",t),v("gitdir",r),v("trees",n);let f=new D(t),l=await j({fsp:f,dotgit:r});return await Wt({fs:f,cache:o,dir:e,gitdir:l,trees:n,map:i,reduce:a,iterate:s})}catch(f){throw f.caller="git.walk",f}}async function Ip({fs:t,dir:e,gitdir:r=O(e,".git"),blob:n}){try{v("fs",t),v("gitdir",r),v("blob",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await Ct({fs:i,gitdir:a,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function Pp({fs:t,dir:e,gitdir:r=O(e,".git"),commit:n}){try{v("fs",t),v("gitdir",r),v("commit",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await _p({fs:i,gitdir:a,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function Bp({fs:t,dir:e,gitdir:r=O(e,".git"),type:n,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let f=new D(t),l=await j({fsp:f,dotgit:r});if(a==="parsed"){switch(n){case"commit":i=Tt.from(i).toObject();break;case"tree":i=Ot.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Rt.from(i).toObject();break;default:throw new ut(s||"",n,"blob|commit|tag|tree")}a="content"}return s=await Ct({fs:f,gitdir:l,type:n,object:i,oid:s,format:a}),s}catch(f){throw f.caller="git.writeObject",f}}async function Dp({fs:t,dir:e,gitdir:r=O(e,".git"),ref:n,value:i,force:a=!1,symbolic:s=!1}){try{v("fs",t),v("gitdir",r),v("ref",n),v("value",i);let o=new D(t);if(!$r(n,!0))throw new Nt(n,kr.clean(n));let f=await j({fsp:o,dotgit:r});if(!a&&await I.exists({fs:o,gitdir:f,ref:n}))throw new qt("ref",n);s?await I.writeSymbolicRef({fs:o,gitdir:f,ref:n,value:i}):(i=await I.resolve({fs:o,gitdir:f,ref:i}),await I.writeRef({fs:o,gitdir:f,ref:n,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function V_({fs:t,gitdir:e,tag:r}){let n=Rt.from(r).toObject();return await Ct({fs:t,gitdir:e,type:"tag",object:n,format:"content"})}async function Np({fs:t,dir:e,gitdir:r=O(e,".git"),tag:n}){try{v("fs",t),v("gitdir",r),v("tag",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await V_({fs:i,gitdir:a,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function jp({fs:t,dir:e,gitdir:r=O(e,".git"),tree:n}){try{v("fs",t),v("gitdir",r),v("tree",n);let i=new D(t),a=await j({fsp:i,dotgit:r});return await Nn({fs:i,gitdir:a,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var X_={Errors:Xd,STAGE:ge,TREE:at,WORKDIR:Qe,add:eh,abortMerge:Jd,addNote:sh,addRemote:ch,annotatedTag:fh,branch:lh,cherryPick:hh,checkout:Ws,clone:yh,commit:bh,getConfig:Bh,getConfigAll:Dh,setConfig:bp,currentBranch:_h,deleteBranch:vh,deleteRef:xh,deleteRemote:Eh,deleteTag:Sh,expandOid:kh,expandRef:$h,fastForward:Rh,fetch:Th,findMergeBase:Ch,findRoot:Ph,getRemoteInfo:Nh,getRemoteInfo2:Uh,hashBlob:Mh,indexPack:Fh,init:zh,isDescendent:Gh,isIgnored:Hh,listBranches:qh,listFiles:Zh,listNotes:Vh,listRefs:Xh,listRemotes:Yh,listServerRefs:Kh,listTags:Jh,log:tp,merge:ep,packObjects:np,pull:ip,push:ap,readBlob:cp,readCommit:Xs,readNote:fp,readObject:lp,readTag:up,readTree:dp,remove:hp,removeNote:pp,renameBranch:wp,resetIndex:gp,updateIndex:Rp,resolveRef:yp,status:kp,statusMatrix:Ap,tag:Op,version:Tp,walk:Cp,writeBlob:Ip,writeCommit:Pp,writeObject:Bp,writeRef:Dp,writeTag:Np,writeTree:jp,stash:Sp};P.Errors=Xd;P.STAGE=ge;P.TREE=at;P.WORKDIR=Qe;P.abortMerge=Jd;P.add=eh;P.addNote=sh;P.addRemote=ch;P.annotatedTag=fh;P.branch=lh;P.checkout=Ws;P.cherryPick=hh;P.clone=yh;P.commit=bh;P.currentBranch=_h;P.default=X_;P.deleteBranch=vh;P.deleteRef=xh;P.deleteRemote=Eh;P.deleteTag=Sh;P.expandOid=kh;P.expandRef=$h;P.fastForward=Rh;P.fetch=Th;P.findMergeBase=Ch;P.findRoot=Ph;P.getConfig=Bh;P.getConfigAll=Dh;P.getRemoteInfo=Nh;P.getRemoteInfo2=Uh;P.hashBlob=Mh;P.indexPack=Fh;P.init=zh;P.isDescendent=Gh;P.isIgnored=Hh;P.listBranches=qh;P.listFiles=Zh;P.listNotes=Vh;P.listRefs=Xh;P.listRemotes=Yh;P.listServerRefs=Kh;P.listTags=Jh;P.log=tp;P.merge=ep;P.packObjects=np;P.pull=ip;P.push=ap;P.readBlob=cp;P.readCommit=Xs;P.readNote=fp;P.readObject=lp;P.readTag=up;P.readTree=dp;P.remove=hp;P.removeNote=pp;P.renameBranch=wp;P.resetIndex=gp;P.resolveRef=yp;P.setConfig=bp;P.stash=Sp;P.status=kp;P.statusMatrix=Ap;P.tag=Op;P.updateIndex=Rp;P.version=Tp;P.walk=Cp;P.writeBlob=Ip;P.writeCommit=Pp;P.writeObject=Bp;P.writeRef=Dp;P.writeTag=Np;P.writeTree=jp});var st=kt(Be(),1);var zn=kt(Be(),1);var Y_=kt(gs(),1),Lp=kt(Sa(),1),Gp=kt(ka(),1),K_=kt($a(),1),J_=kt(Oa(),1),Q_=kt(fs(),1);import{Buffer as ce}from"buffer";var z=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){let e=this;return{code:e.code,data:e.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new t(e.message),n=r;return n.code=e.code,n.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},Gi=class t extends z{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=t.code,this.data={filepaths:e}}};Gi.code="UnmergedPathsError";var Zt=class t extends z{constructor(e){super(`An internal error caused this command to fail.
98
+
99
+ If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
100
+
101
+ If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};Zt.code="InternalError";var Hi=class t extends z{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Hi.code="UnsafeFilepathError";var Un=class{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 n=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,n}write(e,r,n){let i=this.buffer.write(e,this._start,r,n);return this._start+=r,i}copy(e,r,n){let i=e.copy(this.buffer,this._start,r,n);return this._start+=i,i}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}},Up=/[\ud800-￿]/;function Mp(t,e,r){if(r<55296||r>57343)return!1;if(r<56320){let i=e+1<t.length?t.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?t.charCodeAt(e-1):0;return n<55296||n>56319}function t1(t,e){if(!Up.test(t)&&!Up.test(e))return-(t<e)||+(t>e);let r=Math.min(t.length,e.length);for(let n=0;n<r;n++){let i=t.charCodeAt(n),a=e.charCodeAt(n);if(i!==a){if(Mp(t,n,i)&&(i=65533),Mp(e,n,a)&&(a=65533),i===a)continue;return i>=55296&&a>=55296&&(i+=i>=57344?-2048:8192,a+=a>=57344?-2048:8192),i<a?-1:1}}return t.length<e.length?-1:t.length>e.length?1:0}function e1(t,e){return t1(t.path,e.path)}function r1(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}var oe=2**32;function Fp(t,e,r,n){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=n.valueOf());let i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function jr(t){let[e,r]=Fp(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[n,i]=Fp(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%oe,ctimeNanoseconds:r%oe,mtimeSeconds:n%oe,mtimeNanoseconds:i%oe,dev:t.dev%oe,ino:t.ino%oe,mode:r1(t.mode%oe),uid:t.uid%oe,gid:t.gid%oe,size:t.size>-1?t.size%oe:0}}function n1(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var Ys=null;async function zp(t){return Ys===null&&(Ys=await a1()),Ys?Hp(t):i1(t)}function i1(t){return new Lp.default().update(t).digest("hex")}async function Hp(t){let e=await crypto.subtle.digest("SHA-1",t);return n1(e)}async function a1(){try{return await Hp(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}function s1(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function o1(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(ce.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Qs=class t{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(ce.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new Zt("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new Zt("Index file is empty (.git/index)");let r=new t,n=new Un(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new Zt(`Invalid dircache magic file number: ${i}`);let a=await zp(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new Zt(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=n.readUInt32BE();if(o!==2)throw new Zt(`Unsupported dircache version: ${o}`);let f=n.readUInt32BE(),l=0;for(;!n.eof()&&l<f;){let c={};c.ctimeSeconds=n.readUInt32BE(),c.ctimeNanoseconds=n.readUInt32BE(),c.mtimeSeconds=n.readUInt32BE(),c.mtimeNanoseconds=n.readUInt32BE(),c.dev=n.readUInt32BE(),c.ino=n.readUInt32BE(),c.mode=n.readUInt32BE(),c.uid=n.readUInt32BE(),c.gid=n.readUInt32BE(),c.size=n.readUInt32BE(),c.oid=n.slice(20).toString("hex");let u=n.readUInt16BE();c.flags=s1(u);let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new Zt(`Got a path length of: ${d}`);if(c.path=n.toString("utf8",d),c.path.includes("..\\")||c.path.includes("../"))throw new Hi(c.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new Zt(`Expected 1-8 null characters but got '${p}' after ${c.path}`);if(n.eof())throw new Zt("Unexpected end of file")}c.stages=[],r._addEntry(c),l++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(e1)}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:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=jr(r);let a=ce.from(e),s={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:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),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(`
102
+ `)}static async _entryToBuffer(e){let r=ce.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=ce.alloc(n),a=new Un(i),s=jr(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(o1(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=ce.alloc(12),r=new Un(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let f of o.stages)f&&f!==o&&n.push(t._entryToBuffer(f));n=await Promise.all(n);let i=ce.concat(n),a=ce.concat([e,i]),s=await zp(a);return ce.concat([a,ce.from(s,"hex")])}};function c1(t,e,r=!0,n=!0){let i=jr(t),a=jr(e);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size||i.mtimeNanoseconds!==a.mtimeNanoseconds||i.ctimeNanoseconds!==a.ctimeNanoseconds||a.mtimeSeconds>=Math.floor(Date.now()/1e3)-1}var Ks;function f1(){return Ks===void 0&&(Ks=new Gp.default({maxPending:1/0})),Ks}function l1(t,e){return f1().acquire(t,e)}var Js=Symbol("IndexCache");function u1(){return{map:new Map,stats:new Map}}async function d1(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await Qs.from(i);r.map.set(e,a),r.stats.set(e,n)}async function h1(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);if(i===null)return!1;if(c1(n,i))return!0;let a=jr(n),s=jr(i);return a.mtimeNanoseconds!==s.mtimeNanoseconds||a.ctimeNanoseconds!==s.ctimeNanoseconds}var qi=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[Js]||(n[Js]=u1());let s=`${r}/index`,o,f=[];return await l1(s,async()=>{let l=n[Js];await h1(e,s,l)&&await d1(e,s,l);let c=l.map.get(s);if(f=c.unmergedPaths,f.length&&!i)throw new Gi(f);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),l.stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}},to=class t extends z{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};to.code="InvalidOidError";var eo=class t extends z{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};eo.code="InvalidRefNameError";var ro=class t extends z{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
103
+ [remote "${e}"]
104
+ fetch = +refs/heads/*:refs/remotes/origin/*
105
+ `),this.code=this.name=t.code,this.data={remote:e}}};ro.code="NoRefspecError";var no=class t extends z{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};no.code="NotFoundError";var io=class t extends z{constructor(e,r,n){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:n}}};io.code="HttpError";var ao=class t extends z{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=t.code,this.data={preview:e,response:r}}};ao.code="SmartHttpError";var so=class t extends z{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};so.code="UserCanceledError";var oo=class t extends z{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};oo.code="EmptyServerResponseError";var co=class t extends z{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};co.code="ParseError";var fo=class t extends z{constructor(e,r,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:n}}};fo.code="UnknownTransportError";var lo=class t extends z{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};lo.code="UrlParseError";var uo=class t extends z{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};uo.code="ObjectTypeError";var ho=class t extends z{constructor(e){super(`Invalid compressed buffer: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ho.code="DecompressionError";var po=class t extends z{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};po.code="MissingNameError";var wo=class t extends z{constructor(e,r,n=!0){super(`Failed to create ${e} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:n}}};wo.code="AlreadyExistsError";var mo=class t extends z{constructor(e,r,n){super(`Found multiple ${e} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:n}}};mo.code="AmbiguousError";var go=class t extends z{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};go.code="CheckoutConflictError";var yo=class t extends z{constructor(e){super(`Your local changes to the following files would be overwritten by cherry-pick: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};yo.code="CherryPickLocalChangesError";var bo=class t extends z{constructor(e,r){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${r} parents and require specifying which parent to use as the base.`),this.code=this.name=t.code,this.data={oid:e,parentCount:r}}};bo.code="CherryPickMergeCommitError";var _o=class t extends z{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=t.code,this.data={oid:e}}};_o.code="CherryPickRootCommitError";var vo=class t extends z{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=t.code,this.data={ref:e,oid:r}}};vo.code="CommitNotFetchedError";var xo=class t extends z{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=t.code,this.data={}}};xo.code="EmptyCommitError";var Eo=class t extends z{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Eo.code="FastForwardError";var So=class t extends z{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};So.code="GitPushError";var ko=class t extends z{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=t.code,this.data={reason:e}}};ko.code="InvalidFilepathError";var $o=class t extends z{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};$o.code="MaxDepthError";var Ao=class t extends z{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Ao.code="MergeNotSupportedError";var Oo=class t extends z{constructor(e,r,n,i){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=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:n,deleteByTheirs:i}}};Oo.code="MergeConflictError";var Ro=class t extends z{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Ro.code="MissingParameterError";var To=class t extends z{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=t.code,this.data={errors:e},this.errors=e}};To.code="MultipleGitError";var Co=class t extends z{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=t.code,this.data={reason:e}}};Co.code="PushRejectedError";var Io=class t extends z{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};Io.code="RemoteCapabilityError";var Po=class t extends z{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=t.code,this.data={filepath:e}}};Po.code="IndexResetError";var Bo=class t extends z{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=t.code,this.data={ref:e}}};Bo.code="NoCommitError";var Dx=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat();var Fn=kt(ls(),1);import{Buffer as Do}from"buffer";var qp=/[\ud800-￿]/;function Wp(t,e,r){if(r<55296||r>57343)return!1;if(r<56320){let i=e+1<t.length?t.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?t.charCodeAt(e-1):0;return n<55296||n>56319}function p1(t,e){if(!qp.test(t)&&!qp.test(e))return-(t<e)||+(t>e);let r=Math.min(t.length,e.length);for(let n=0;n<r;n++){let i=t.charCodeAt(n),a=e.charCodeAt(n);if(i!==a){if(Wp(t,n,i)&&(i=65533),Wp(e,n,a)&&(a=65533),i===a)continue;return i>=55296&&a>=55296&&(i+=i>=57344?-2048:8192,a+=a>=57344?-2048:8192),i<a?-1:1}}return t.length<e.length?-1:t.length>e.length?1:0}function Kp(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}async function Jp(t,e,r=10){try{await t(e)}catch(n){if(n===null||n.code==="EEXIST")return;if(n.code!=="ENOENT")throw n;let i=Kp(e);if(i==="."||i==="/"||i===e)throw n;await Jp(t,i,r);for(let a=0;;a++)try{await t(e);return}catch(s){if(s===null||s.code==="EEXIST")return;if(s.code==="ENOENT"&&a<r){await new Promise(o=>setTimeout(o,0));continue}throw s}}}function w1(t,e){let r="",n=0,i=-1,a=0,s="\0";for(let o=0;o<=t.length;++o){if(o<t.length)s=t[o];else{if(s==="/")break;s="/"}if(s==="/"){if(!(i===o-1||a===1))if(a===2){if(r.length<2||n!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let f=r.lastIndexOf("/");f===-1?(r="",n=0):(r=r.slice(0,f),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}else if(r.length!==0){r="",n=0,i=o,a=0;continue}}e&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s==="."&&a!==-1?++a:a=-1}return r}function m1(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function g1(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=m1(t),r=t[0]==="/"||e!==null&&t[2]==="/",n=t.at(-1)==="/",i=e?t.slice(2):t,a=w1(i,!r);if(!a.length){let s=e?r?e+"/":e:r?"/":".";return n&&!r?s+"/":s}return n&&(a+="/"),e?r?`${e}/${a}`:`${e}${a}`:r?`/${a}`:a}function y1(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let n=t[r].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":g1(e)}async function No(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(n=>{let i=y1(e,n);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?No(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function b1(t){return _1(t)&&Zp(t.then)&&Zp(t.catch)}function _1(t){return t&&typeof t=="object"}function Zp(t){return typeof t=="function"}function Mn(t){let e=t.code;return typeof e!="string"?!1:e==="ENOENT"||e==="ENOTDIR"||e.includes("ENS")}function Vp(t){return b1((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(t))}var Xp=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Yp(t,e){if(Vp(e))for(let r of Xp)t[`_${r}`]=e[r].bind(e);else for(let r of Xp)t[`_${r}`]=(0,Fn.default)(e[r].bind(e));Vp(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=No.bind(null,t)):(e.cp&&(t._cp=(0,Fn.default)(e.cp.bind(e))),e.rm?t._rm=(0,Fn.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Fn.default)(e.rmdir.bind(e)):t._rm=No.bind(null,t))}var tr=class{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?Yp(this,e.promises):Yp(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(n){if(Mn(n))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,r={}){let n;try{n=await this._readFile(e,r)}catch(i){if(Mn(i)||i.code==="EISDIR")return null;throw i}if(n==null)return null;if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
106
+ `),n=new TextEncoder().encode(n)}catch{}return typeof n!="string"&&(n=Do.from(n)),n}async write(e,r,n={}){try{await this._writeFile(e,r,n)}catch{await this.mkdir(Kp(e)),await this._writeFile(e,r,n)}}async mkdir(e){await Jp(this._mkdir,e)}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(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let r;try{r=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(Mn(n))return[];throw n}return r.sort(p1),r}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(Mn(r))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let n=await this._readlink(e,r);return Do.isBuffer(n)?n:Do.from(n)}catch(n){if(Mn(n))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};async function Wi(t){let e=new Map;return await qi.acquire({fs:new tr(t.fs),gitdir:`${t.dir}/.git`,cache:{}},r=>{for(let n of r.entries)v1(e,n)}),e}function v1(t,e){if(!e||typeof e!="object"||!("path"in e)||!("stages"in e))throw new Error("Invalid upstream index entry");if(typeof e.path!="string"||!Array.isArray(e.stages))throw new Error("Invalid upstream index stages");let r=e.stages;if(r[0])return;let n=(r[1]?1:0)|(r[2]?2:0)|(r[3]?4:0),i=["","DD","AU","UD","UA","DU","AA","UU"][n];if(!i)throw new Error("Invalid upstream conflict stages");t.set(e.path,i)}var N=class extends Error{constructor(r,n=128){super(r);this.status=n}status};function mt(t,e,r=[]){let n=new Set,i=new Map,a=[],s=!1;for(let o=0;o<t.length;o++){let f=t[o];if(s||!f.startsWith("-")||f==="-"){a.push(f);continue}if(f==="--"){s=!0;continue}if(e.includes(f)){n.add(f);continue}o=x1(t,o,i,r)}return{flags:n,named:i,paths:a}}function x1(t,e,r,n){let i=t[e],a=i.indexOf("="),s=a<0?i:i.slice(0,a);if(!n.includes(s))throw new N(`unsupported option '${i}'`,129);let o=a<0?t[e+1]:i.slice(a+1);if(o===void 0)throw new N(`option '${s}' needs a value`,129);return r.set(s,o),a<0?e+1:e}function bt(t,e,r=e){if(t.length<e||t.length>r)throw new N("unexpected arguments",129)}function er(t,e){let r=(e.startsWith("/")?e:`${t}/${e}`).split("/"),n=[];for(let i of r)!i||i==="."||(i===".."?n.pop():n.push(i));return`/${n.join("/")}`}function Ln(t,e){let r=er(t.invocation.cwd,e);if(r===t.dir)return".";let n=t.dir==="/"?"/":`${t.dir}/`;if(!r.startsWith(n))throw new N(`'${e}' is outside the repository`);let i=r.slice(n.length);if(i===".git"||i.startsWith(".git/"))throw new N("cannot add Git metadata");if(/[*?[\]:]/.test(i))throw new N("wildcard and magic pathspecs are unsupported",129);return i}function Ur(t,e){return e.length===0||e.some(r=>r==="."||t===r||t.startsWith(`${r}/`))}async function Gn(t,e){let r=await t.promises.readFile(e,"utf8");return typeof r=="string"?r:new TextDecoder().decode(r)}async function St(t,e){try{return await t.promises.stat(e),!0}catch(r){if(r&&typeof r=="object"&&"code"in r&&r.code==="ENOENT")return!1;throw r}}async function _t(t,e){e&&await t.invocation.stdout(new TextEncoder().encode(e))}async function fe(t,e){let r=t.invocation.env??{},n=r[`GIT_${e}_NAME`]??await zn.getConfig({...t,path:"user.name"}),i=r[`GIT_${e}_EMAIL`]??await zn.getConfig({...t,path:"user.email"});if(!n||!i)throw new N("identity unknown; set GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL or repository user config");let a=r[`GIT_${e}_DATE`];if(!a)return{name:n,email:i};let s=/^@?(\d+) ([+-])(\d{2})(\d{2})$/.exec(a);if(s)return{name:n,email:i,timestamp:Number(s[1]),timezoneOffset:Qp(s[2],Number(s[3]),Number(s[4]))};let o=Date.parse(a),f=/([+-])(\d{2}):?(\d{2})$/.exec(a);if(!Number.isFinite(o)||!f)throw new N(`invalid date '${a}'`);return{name:n,email:i,timestamp:Math.floor(o/1e3),timezoneOffset:Qp(f[1],Number(f[2]),Number(f[3]))}}function Qp(t,e,r){let n=(t==="+"?-1:1)*(e*60+r);return Object.is(n,-0)?0:n}async function Mr(t){if((await Wi(t)).size)throw new N("unresolved merge conflicts",1);if((await zn.statusMatrix(t)).some(([,r,n,i])=>(r!==0||i!==0)&&(r!==n||r!==i)))throw new N("local changes would be overwritten",1)}function E1([t,e,r,n]){if(e===0&&n===0)return r===0?"":`?? ${jo(t)}
107
+ `;let i=n===e?" ":n===0?"D":e===0?"A":"M",a=r===n?" ":r===0?"D":"M";return i===" "&&a===" "?"":`${i}${a} ${jo(t)}
108
+ `}function tw(t,e=new Map){let r=t.filter(([,i,,a])=>i!==0||a!==0),n=t.filter(([,i,,a])=>i===0&&a===0);return r.concat(n).map(i=>e.has(i[0])?`${e.get(i[0])} ${jo(i[0])}
109
+ `:E1(i)).join("")}function jo(t){return/[\s"\\]/.test(t)?JSON.stringify(t):t}var It=kt(Be(),1);async function Uo(t){for(let e of["MERGE_HEAD","MERGE_MSG"]){let r=`${t.dir}/.git/${e}`;await St(t.fs,r)&&await t.fs.promises.unlink(r)}}async function ew(t,e){let r=mt(e,["--ff-only","--no-ff","--abort"],["-m","--message"]),n=await St(t.fs,`${t.dir}/.git/MERGE_HEAD`);if(r.flags.has("--abort")){if(bt(e,1),!n)throw new N("no merge to abort");return await It.abortMerge(t),Uo(t)}if(bt(r.paths,1),n)throw new N("finish or abort the current merge first",1);if(r.flags.has("--ff-only")&&r.flags.has("--no-ff"))throw new N("incompatible merge flags",129);await Mr(t);let i=r.paths[0],a=await It.currentBranch(t);if(!a)throw new N("merging in detached HEAD is unsupported",129);let s=await fe(t,"AUTHOR"),o=await fe(t,"COMMITTER"),f=r.named.get("-m")??r.named.get("--message"),l={...t,theirs:i,author:s,committer:o,fastForward:!r.flags.has("--no-ff"),fastForwardOnly:r.flags.has("--ff-only"),message:f};await It.checkout({...t,ref:i,dryRun:!0,noUpdateHead:!0});let c=await It.resolveRef({...t,ref:"HEAD"}),u=await It.resolveRef({...t,ref:i});try{await It.merge({...l,abortOnConflict:!1}),await It.checkout({...t,ref:a})}catch(d){throw d instanceof It.Errors.MergeConflictError?(await t.fs.promises.writeFile(`${t.dir}/.git/ORIG_HEAD`,`${c}
110
+ `),await t.fs.promises.writeFile(`${t.dir}/.git/MERGE_HEAD`,`${u}
111
+ `),await t.fs.promises.writeFile(`${t.dir}/.git/MERGE_MSG`,`${f??`Merge branch '${i}'`}
112
+ `),new N(d.message,1)):d}}var Z=kt(Be(),1);async function rw(t,e){let r=mt(e,["--allow-empty","-q","--quiet"],["-m","--message"]);bt(r.paths,0);let n=r.named.get("-m")??r.named.get("--message");if(!n)throw new N("commit requires a nonempty -m message; editors and hooks are unsupported",129);let i=`${t.dir}/.git/MERGE_HEAD`,a=await St(t.fs,i)?[await Z.resolveRef({...t,ref:"HEAD"}),(await Gn(t.fs,i)).trim()]:void 0,s=await fe(t,"AUTHOR"),o=await fe(t,"COMMITTER");try{await Z.commit({...t,message:n,author:s,committer:o,disallowEmpty:a===void 0&&!r.flags.has("--allow-empty"),parent:a}),a&&await Uo(t)}catch(f){throw f&&typeof f=="object"&&"code"in f&&f.code==="EmptyCommitError"?new N("nothing to commit",1):f}}async function nw(t,e){let r=mt(e,["--oneline","--first-parent"],["--format","--pretty","-n","--max-count"]);bt(r.paths,0,1);let n=r.named.get("--format")??r.named.get("--pretty")?.replace(/^format:/,"")??(r.flags.has("--oneline")?"%h %s":"medium");if(!new Set(["medium","%s","%H","%h %s","%H %s"]).has(n))throw new N("unsupported log format",129);let i=Number(r.named.get("-n")??r.named.get("--max-count")??Number.MAX_SAFE_INTEGER);if(!Number.isSafeInteger(i)||i<0)throw new N("invalid log count",129);let a=r.paths[0]??"HEAD";if(i===0)return;let s=r.flags.has("--first-parent")?await O1(t,a,i):await Z.log({...t,ref:a,depth:i});if(n==="medium")return _t(t,s.map(S1).join(`
113
+ `));await _t(t,s.map(({oid:o,commit:f})=>`${n.replace("%H",o).replace("%h",o.slice(0,7)).replace("%s",f.message.split(`
114
+ `)[0])}
115
+ `).join(""))}function S1({oid:t,commit:e}){let{name:r,email:n,timestamp:i,timezoneOffset:a}=e.author,s=e.parent.length>1?`Merge: ${e.parent.map(f=>f.slice(0,7)).join(" ")}
116
+ `:"",o=e.message.replace(/\n+$/,"").split(`
117
+ `).map(f=>` ${f}`).join(`
118
+ `);return`commit ${t}
119
+ ${s}Author: ${r} <${n}>
120
+ Date: ${A1(i,a)}
121
+
122
+ ${o}
123
+ `}var k1=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A1(t,e){let r=-e,n=new Date((t+r*60)*1e3),i=o=>String(o).padStart(2,"0"),a=`${r<0?"-":"+"}${i(Math.floor(Math.abs(r)/60))}${i(Math.abs(r)%60)}`,s=`${i(n.getUTCHours())}:${i(n.getUTCMinutes())}:${i(n.getUTCSeconds())}`;return`${k1[n.getUTCDay()]} ${$1[n.getUTCMonth()]} ${n.getUTCDate()} ${s} ${n.getUTCFullYear()} ${a}`}async function O1(t,e,r){let n=[],i=await Z.resolveRef({...t,ref:e});for(;i&&n.length<r;){let a=await Z.readCommit({...t,oid:i});n.push(a),i=a.commit.parent[0]}return n}async function iw(t,e){let r=mt(e,["--list","--show-current","-d","-D"]),n=await Z.currentBranch(t);if(r.flags.has("--show-current"))return bt(r.paths,0),_t(t,n?`${n}
124
+ `:"");if(!r.paths.length){let a=await Z.listBranches(t);return _t(t,a.map(s=>`${s===n?"*":" "} ${s}
125
+ `).join(""))}if(bt(r.paths,1,r.flags.has("-d")||r.flags.has("-D")?1:2),r.flags.has("--list"))throw new N("branch list patterns are unsupported",129);let i=r.paths[0];if(!r.flags.has("-d")&&!r.flags.has("-D"))return Z.branch({...t,ref:i,object:r.paths[1]});if(i===n)throw new N("cannot delete the checked out branch",1);r.flags.has("-D")||await R1(t,i),await Z.deleteBranch({...t,ref:i})}async function R1(t,e){let r=await Z.resolveRef({...t,ref:"HEAD"}),n=await Z.resolveRef({...t,ref:e});if(!(r===n||await Z.isDescendent({...t,oid:r,ancestor:n})))throw new N(`branch '${e}' is not fully merged`,1)}async function Zi(t,e){let r=mt(e,[],["-b"]);if(await St(t.fs,`${t.dir}/.git/MERGE_HEAD`))throw new N("finish or abort the current merge first",1);bt(r.paths,r.named.has("-b")?0:1,1),await Mr(t);let n=r.named.get("-b");if(n!==void 0)return T1(t,n,r.paths[0]??"HEAD");let i=r.paths[0];await sw(t,i);let a=(await Z.listBranches(t)).includes(i);await Z.checkout({...t,ref:a?`refs/heads/${i}`:i})}async function T1(t,e,r){await sw(t,r);let n=await Z.resolveRef({...t,ref:r});await Z.checkout({...t,ref:n,dryRun:!0}),await Z.branch({...t,ref:e,object:n}),await Z.checkout({...t,ref:`refs/heads/${e}`})}async function aw(t,e){let r=mt(e,[],["-c","--create"]),n=r.named.get("-c")??r.named.get("--create");if(n!==void 0)return Zi(t,["-b",n].concat(r.paths));if(bt(r.paths,1,1),!(await Z.listBranches(t)).includes(r.paths[0]))throw new N(`invalid reference: ${r.paths[0]}`,128);return Zi(t,r.paths)}async function sw(t,e){try{await Z.resolveRef({...t,ref:e})}catch{throw new N(`pathspec '${e}' did not match a local revision`,1)}}var Vt=kt(Be(),1);var Hn=class{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let a=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(a,n)),f=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,f,n,i)}diffWithOptionsObj(e,r,n,i){var a;let s=m=>{if(m=this.postProcess(m,n),i){setTimeout(function(){i(m)},0);return}else return m},o=r.length,f=e.length,l=1,c=o+f;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let u=(a=n.timeout)!==null&&a!==void 0?a:1/0,d=Date.now()+u,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,n);if(h[0].oldPos+1>=f&&p+1>=o)return s(this.buildValues(h[0].lastComponent,r,e));let w=-1/0,E=1/0,g=()=>{for(let m=Math.max(w,-l);m<=Math.min(E,l);m+=2){let x,$=h[m-1],S=h[m+1];$&&(h[m-1]=void 0);let R=!1;if(S){let y=S.oldPos-m;R=S&&0<=y&&y<o}let b=$&&$.oldPos+1<f;if(!R&&!b){h[m]=void 0;continue}if(!b||R&&$.oldPos<S.oldPos?x=this.addToPath(S,!0,!1,0,n):x=this.addToPath($,!1,!0,1,n),p=this.extractCommon(x,r,e,m,n),x.oldPos+1>=f&&p+1>=o)return s(this.buildValues(x.lastComponent,r,e))||!0;h[m]=x,x.oldPos+1>=f&&(E=Math.min(E,m-1)),p+1>=o&&(w=Math.max(w,m+1))}l++};if(i)(function m(){setTimeout(function(){if(l>c||Date.now()>d)return i(void 0);g()||m()},0)})();else for(;l<=c&&Date.now()<=d;){let m=g();if(m)return m}}addToPath(e,r,n,i,a){let s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,i,a){let s=r.length,o=n.length,f=e.oldPos,l=f-i,c=0;for(;l+1<s&&f+1<o&&this.equals(n[f+1],r[l+1],a);)l++,f++,c++,a.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!a.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=f,l}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){let i=[],a;for(;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();let s=i.length,o=0,f=0,l=0;for(;o<s;o++){let c=i[o];if(c.removed)c.value=this.join(n.slice(l,l+c.count)),l+=c.count;else{if(!c.added&&this.useLongestToken){let u=r.slice(f,f+c.count);u=u.map(function(d,h){let p=n[l+h];return p.length>d.length?p:d}),c.value=this.join(u)}else c.value=this.join(r.slice(f,f+c.count));f+=c.count,c.added||(l+=c.count)}}return i}};var Mo=class extends Hn{constructor(){super(...arguments),this.tokenize=I1}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
126
+ `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
127
+ `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
128
+ `)&&(e=e.slice(0,-1)),r.endsWith(`
129
+ `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}},C1=new Mo;function Fo(t,e,r){return C1.diff(t,e,r)}function I1(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
130
+ `));let r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let a=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r}function zo(t,e,r,n,i,a,s){let o;s?typeof s=="function"?o={callback:s}:o=s:o={},typeof o.context>"u"&&(o.context=4);let f=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:c}=o;Fo(r,n,Object.assign(Object.assign({},o),{callback:u=>{let d=l(u);c(d)}}))}else return l(Fo(r,n,o));function l(c){if(!c)return;c.push({value:"",lines:[]});function u(m){return m.map(function(x){return" "+x})}let d=[],h=0,p=0,w=[],E=1,g=1;for(let m=0;m<c.length;m++){let x=c[m],$=x.lines||P1(x.value);if(x.lines=$,x.added||x.removed){if(!h){let S=c[m-1];h=E,p=g,S&&(w=f>0?u(S.lines.slice(-f)):[],h-=w.length,p-=w.length)}for(let S of $)w.push((x.added?"+":"-")+S);x.added?g+=$.length:E+=$.length}else{if(h)if($.length<=f*2&&m<c.length-2)for(let S of u($))w.push(S);else{let S=Math.min($.length,f);for(let b of u($.slice(0,S)))w.push(b);let R={oldStart:h,oldLines:E-h+S,newStart:p,newLines:g-p+S,lines:w};d.push(R),h=0,p=0,w=[]}E+=$.length,g+=$.length}}for(let m of d)for(let x=0;x<m.lines.length;x++)m.lines[x].endsWith(`
131
+ `)?m.lines[x]=m.lines[x].slice(0,-1):(m.lines.splice(x+1,0,"\"),x++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:a,hunks:d}}}function P1(t){let e=t.endsWith(`
132
+ `),r=t.split(`
133
+ `).map(n=>n+`
134
+ `);return e?r.pop():r.push(r.pop().slice(0,-1)),r}async function lw(t,e){let r=mt(e,["--cached","--staged","--name-only","--no-prefix","--no-color","--no-ext-diff","--exit-code","--quiet"]),n=r.paths.map(s=>Ln(t,s)),i=r.flags.has("--cached")||r.flags.has("--staged"),a=[];return await Vt.walk({...t,trees:i?[Vt.TREE({ref:"HEAD"}),Vt.STAGE()]:[Vt.STAGE(),Vt.WORKDIR()],async map(s,o){let[f,l]=o;if(s==="."||!Ur(s,n)||await f?.type()==="tree"||await l?.type()==="tree"||!i&&!f)return;let c=await f?.oid(),u=await l?.oid();if(c===u)return;let d=r.flags.has("--name-only")?`${s}
135
+ `:await B1(t,s,f,l,r.flags.has("--no-prefix"));a.push({path:s,text:d})}}),a.sort((s,o)=>s.path<o.path?-1:s.path>o.path?1:0),r.flags.has("--quiet")||await _t(t,a.map(s=>s.text).join("")),a.length&&(r.flags.has("--exit-code")||r.flags.has("--quiet"))?1:0}async function B1(t,e,r,n,i){let a=await ow(t,r),s=await ow(t,n),o=(await r?.oid()??"0000000").slice(0,7),f=(await n?.oid()??"0000000").slice(0,7),l=`${i?"":"a/"}${e}`,c=`${i?"":"b/"}${e}`,u=[`diff --git ${l} ${c}`];if(r||u.push("new file mode 100644"),n||u.push("deleted file mode 100644"),u.push(`index ${o}..${f}${r&&n?" 100644":""}`),a.includes(0)||s.includes(0))return u.concat([`Binary files ${r?l:"/dev/null"} and ${n?c:"/dev/null"} differ`,""]).join(`
136
+ `);let d=new TextDecoder("utf-8",{fatal:!0}),h=zo(l,c,d.decode(a),d.decode(s),void 0,void 0,{context:3});return u.push(`--- ${r?cw(l):"/dev/null"}`,`+++ ${n?cw(c):"/dev/null"}`),u.concat(h.hunks.flatMap(p=>[`@@ -${fw(p.oldStart,p.oldLines)} +${fw(p.newStart,p.newLines)} @@`].concat(p.lines)),[""]).join(`
137
+ `)}async function ow(t,e){if(!e)return new Uint8Array;let r=await e.content();if(r)return r;let n=await e.oid();return n?(await Vt.readBlob({...t,oid:n})).blob:new Uint8Array}function cw(t){return t.includes(" ")?`${t} `:t}function fw(t,e){return e===0?`${t-1},0`:e===1?String(t):`${t},${e}`}var L=kt(Be(),1);async function uw(t,e){let r=mt(e,["--index","-u","--include-untracked"],["-m","--message","--format"]),n=r.paths[0]??"push";if(r.flags.has("--index")&&n!=="apply"&&n!=="pop")throw new N("--index requires stash apply or pop",129);if(r.named.has("--format")&&n!=="list")throw new N("--format requires stash list",129);if((r.named.has("-m")||r.named.has("--message")||r.flags.has("-u")||r.flags.has("--include-untracked"))&&n!=="push")throw new N("message and untracked options require stash push",129);if(n==="list")return N1(t,r);if(!["push","apply","pop","drop","clear"].includes(n))throw new N(`unsupported stash operation '${n}'`,129);bt(r.paths,0,n==="push"||n==="clear"?1:2);let i=await Lo(t),a=D1(r.paths[1]);if(n!=="push"&&n!=="clear"&&a>=i.length)throw new N("no stash entry found",1);if(n==="push")return j1(t,r);if(n==="clear"||n==="drop"){await L.stash({...t,op:n,refIdx:a});return}await L1(t,i[a].oid,r.flags.has("--index")),n==="pop"&&await L.stash({...t,op:"drop",refIdx:a})}function D1(t){if(t===void 0)return 0;let e=/^(?:stash@\{(\d+)\}|(\d+))$/.exec(t),r=e?Number(e[1]??e[2]):NaN;if(!Number.isSafeInteger(r))throw new N("invalid stash reference",129);return r}async function N1(t,e){bt(e.paths,1);let r=e.named.get("--format");if(r&&r!=="%gs")throw new N("only stash --format=%gs is supported",129);let n=await Lo(t);await _t(t,n.map(({message:i},a)=>`${r?"":`stash@{${a}}: `}${i}
138
+ `).join(""))}async function Lo(t){let e=`${t.dir}/.git/logs/refs/stash`;return await St(t.fs,e)?(await Gn(t.fs,e)).trimEnd().split(`
139
+ `).reverse().filter(Boolean).map(r=>{let n=r.split(" ")[1];if(!/^[a-f0-9]{40}$/.test(n)||!r.includes(" "))throw new N("invalid stash reflog");return{oid:n,message:r.slice(r.indexOf(" ")+1)}}):[]}async function j1(t,e){if(await St(t.fs,`${t.dir}/.git/MERGE_HEAD`))throw new N("finish or abort the current merge first",1);let r=await L.statusMatrix(t),n=e.flags.has("-u")||e.flags.has("--include-untracked")?r.filter(([,u,,d])=>u===0&&d===0).map(([u])=>u):[],i=r.filter(([,u,,d])=>u!==0||d!==0);if(!n.length&&!i.some(([,u,d,h])=>u!==d||u!==h))return;let a=await L.resolveRef({...t,ref:"HEAD"}),s=await L.currentBranch(t)??"(no branch)",o=e.named.get("-m")??e.named.get("--message"),f=(await L.readCommit({...t,oid:a})).commit.message.split(`
140
+ `)[0],l=o?`On ${s}: ${o}`:`WIP on ${s}: ${a.slice(0,7)} ${f}`,c=await U1(t,a,i,n,l);await z1(t,c,l),await L.checkout({...t,ref:a,noUpdateHead:!0,force:!0});for(let u of n)await t.fs.promises.unlink(`${t.dir}/${u}`)}async function U1(t,e,r,n,i){let a=`${t.dir}/.git/index`,s=await St(t.fs,a)?await t.fs.promises.readFile(a):void 0,o=await fe(t,"AUTHOR"),f=await fe(t,"COMMITTER"),l=(c,u)=>L.commit({...t,parent:c,message:u,author:o,committer:f,noUpdateBranch:!0});try{let c=await l([e],"index on stash base");await M1(t,r);let u=await l([e],i),d=(await L.readCommit({...t,oid:u})).commit.tree,h=[e,c];return n.length&&h.push(await F1(t,n,l)),await L.commit({...t,parent:h,tree:d,message:i,author:o,committer:f,noUpdateBranch:!0})}finally{s!==void 0?await t.fs.promises.writeFile(a,s):await St(t.fs,a)&&await t.fs.promises.unlink(a)}}async function M1(t,e){for(let[r,,n]of e)n===0?await L.remove({...t,filepath:r}):await L.add({...t,filepath:r,force:!0})}async function F1(t,e,r){await L.remove({...t,filepath:await L.listFiles(t)});for(let n of e)await L.add({...t,filepath:n});return r([],"untracked files on stash base")}async function z1(t,e,r){let n=await fe(t,"AUTHOR"),i=n.timestamp??Math.floor(Date.now()/1e3),a=n.timezoneOffset??new Date().getTimezoneOffset(),s=`${a>0?"-":"+"}${String(Math.floor(Math.abs(a)/60)).padStart(2,"0")}${String(Math.abs(a)%60).padStart(2,"0")}`,o=(await Lo(t))[0]?.oid??"0".repeat(40),f=`${t.dir}/.git/logs/refs/stash`,l=await St(t.fs,f)?await Gn(t.fs,f):"";await new tr(t.fs).mkdir(`${t.dir}/.git/logs/refs`),await t.fs.promises.writeFile(f,`${l}${o} ${e} ${n.name} <${n.email}> ${i} ${s} ${r}
141
+ `),await L.writeRef({...t,ref:"refs/stash",value:e,force:!0})}async function L1(t,e,r){await Mr(t);let{commit:n}=await L.readCommit({...t,oid:e}),[i,a,s]=n.parent;if(!i||!a||n.parent.length>3)throw new N("invalid stash commit");if(await L.resolveRef({...t,ref:"HEAD"})!==i)throw new N("stash apply currently requires its original HEAD",1);let o=s?await L.listFiles({...t,ref:s}):[];for(let c of o)if(await St(t.fs,`${t.dir}/${c}`))throw new N(`untracked file '${c}' would be overwritten`,1);await L.checkout({...t,ref:e,noUpdateHead:!0,dryRun:!0}),await L.checkout({...t,ref:e,noUpdateHead:!0});let f=r?a:i,l=new Set((await L.listFiles(t)).concat(await L.listFiles({...t,ref:f})));for(let c of l)await L.resetIndex({...t,filepath:c,ref:f});for(let c of o){let{blob:u}=await L.readBlob({...t,oid:s,filepath:c});await new tr(t.fs).write(`${t.dir}/${c}`,u)}}var dt=kt(Be(),1);async function dw(t,e,r){let n=er("/",e.cwd),i=await G1(t,n);if(i===null)return qn(e,"not a git repository (or any of the parent directories): .git");let a={fs:t,dir:i,invocation:e},s=H1(r),o=er(i,".git"),l=!(n===o||n.startsWith(`${o}/`))&&await dt.getConfig({...a,path:"core.bare"})!==!0;for(let u of s.locations){if(u==="--show-toplevel"&&!l)return qn(e,"this operation must be run in a work tree");await _t(a,V1(u,i,n,l))}if(s.verify&&s.refs.length!==1)return qn(e,"Needed a single revision");let c=s.short==="default"?await W1(a):s.short;for(let u of s.refs){let d=await X1(a,u);if(d===null)return J1(a,s,u);let h=c===null?d:await Y1(a,d,c);await _t(a,`${h}
142
+ `)}return 0}async function G1(t,e){try{return await dt.findRoot({fs:t,filepath:e})}catch(r){if(r instanceof dt.Errors.NotFoundError)return null;throw r}}function H1(t){let e=[],r=[],n=!1,i=null;for(let a of t){if(!a.startsWith("-")){Z1(a),r.push(a);continue}if(r.length)throw new N("rev-parse options must precede revisions",129);if(a==="--show-toplevel"||a==="--show-prefix"||a==="--is-inside-work-tree"){e.push(a);continue}if(a==="--verify"){n=!0;continue}if(a==="--short"||a.startsWith("--short=")){i=q1(a),n=!0;continue}throw new N(`unsupported rev-parse option '${a}'`,129)}return{locations:e,refs:r,verify:n,short:i}}function q1(t){if(t==="--short")return"default";let e=t.slice(8);if(!/^\d+$/.test(e))throw new N("--short needs a nonnegative integer",129);return Math.max(4,Math.min(40,Number(e)))}async function W1(t){let e=await dt.getConfig({...t,path:"core.abbrev"});if(e===void 0)return 7;if(e==="no")return 40;if(typeof e=="string"&&/^\d+$/.test(e)&&Number(e)>=4&&Number(e)<=40)return Number(e);throw new N("rev-parse supports only numeric core.abbrev (4..40) or no",129)}function Z1(t){if(!t||t==="@"||/[~^:?*[\\]/.test(t)||Array.from(t).some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127)||t.includes("..")||t.includes("@{")||t.split("/").some(e=>!e||e.startsWith(".")||e.endsWith(".lock"))||t.endsWith("."))throw new N(`unsupported revision syntax '${t}'`,129)}function V1(t,e,r,n){return t==="--show-toplevel"?`${e}
143
+ `:t==="--is-inside-work-tree"?`${n}
144
+ `:!n||r===e?`
145
+ `:`${r.slice(e==="/"?1:e.length+1)}/
146
+ `}async function X1(t,e){if(/^[0-9a-fA-F]{40}$/.test(e))return e.toLowerCase();let r=new Set((await dt.listRefs({...t,filepath:"refs"})).map(i=>`refs/${i}`));r.add("HEAD");let n=[e,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`].filter(i=>r.has(i));if(n.length>1)throw new N(`ambiguous ref '${e}'; use its full ref name`,129);try{return n.length?await dt.resolveRef({...t,ref:n[0]}):/^[0-9a-fA-F]{4,39}$/.test(e)?await dt.expandOid({...t,oid:e.toLowerCase()}):null}catch(i){if(i instanceof dt.Errors.NotFoundError)return null;throw i instanceof dt.Errors.AmbiguousError?new N(`ambiguous object prefix '${e}'; use a longer object ID`,128):i}}async function Y1(t,e,r){for(let n=r;n<40;n++){let i=e.slice(0,n);if(await K1(t,e,i))return i}return e}async function K1(t,e,r){try{return await dt.expandOid({...t,oid:r})===e}catch(n){if(n instanceof dt.Errors.NotFoundError)return!0;if(n instanceof dt.Errors.AmbiguousError)return!1;throw n}}async function J1(t,e,r){if(e.verify)return qn(t.invocation,"Needed a single revision");if(await St(t.fs,er(t.invocation.cwd,r)))throw new N("rev-parse path operands are unsupported",129);return await _t(t,`${r}
147
+ `),qn(t.invocation,`ambiguous argument '${r}': unknown revision or path not in the working tree.
148
+ Use '--' to separate paths from revisions, like this:
149
+ 'git <command> [<revision>...] -- [<file>...]'`)}async function qn(t,e){return await t.stderr(new TextEncoder().encode(`fatal: ${e}
150
+ `)),128}async function hw(t,e){try{if(!e.cwd.startsWith("/"))throw new N("cwd must be absolute",129);let[r,...n]=e.argv;if(r==="--version")return await e.stdout(new TextEncoder().encode(`git version isomorphic-git ${st.version()}
151
+ `)),0;if(r==="init")return await tv(t,e,n);if(r==="rev-parse")return await dw(t,e,n);if(!["add","commit","status","log","diff","branch","checkout","switch","merge","stash","config"].includes(r))throw new N(`unsupported local command '${r??""}'`,129);let i=await st.findRoot({fs:t,filepath:e.cwd}),s=await Q1({fs:t,dir:i,invocation:e},r,n);return typeof s=="number"?s:0}catch(r){let n=r instanceof Error?r.message:String(r);return await e.stderr(new TextEncoder().encode(`git: ${n}
152
+ `)),r instanceof N?r.status:128}}async function Q1(t,e,r){switch(e){case"add":return ev(t,r);case"commit":return rw(t,r);case"status":return nv(t,r);case"log":return nw(t,r);case"diff":return lw(t,r);case"branch":return iw(t,r);case"checkout":return Zi(t,r);case"switch":return aw(t,r);case"merge":return ew(t,r);case"stash":return uw(t,r);case"config":return iv(t,r)}}async function tv(t,e,r){let n=mt(r,["-q","--quiet"],["-b","--initial-branch","--object-format","--template"]);if(bt(n.paths,0,1),(n.named.get("--object-format")??"sha1")!=="sha1")throw new N("only SHA-1 repositories are supported",129);if(n.named.get("--template"))throw new N("templates are unsupported",129);let i=er(e.cwd,n.paths[0]??".");return await st.init({fs:t,dir:i,defaultBranch:n.named.get("-b")??n.named.get("--initial-branch")??"main"}),0}async function ev(t,e){let{flags:r,paths:n}=mt(e,["-A","--all","-u","--update","-f","--force"]),i=r.has("-u")||r.has("--update");if(!n.length&&!i&&!r.has("-A")&&!r.has("--all"))throw new N("nothing specified to add",129);let a=n.map(f=>Ln(t,f)),s=r.has("-f")||r.has("--force"),o=await st.statusMatrix({...t,ignored:s});for(let f of a)await rv(t,f,o);for(let[f,l,c,u]of o)!Ur(f,a)||i&&l===0&&u===0||(c===0?await st.remove({...t,filepath:f}):await st.add({...t,filepath:f,force:s}))}async function rv(t,e,r){if(!(e==="."||r.some(([n])=>Ur(n,[e]))))throw await st.isIgnored({...t,filepath:e})?new N(`'${e}' is ignored`,1):new N(`pathspec '${e}' did not match any files`)}async function nv(t,e){let r=mt(e,["--porcelain","--short","-s"],["--porcelain","--untracked-files"]);if(r.named.has("--porcelain")&&r.named.get("--porcelain")!=="v1")throw new N("only porcelain v1 is supported",129);if(r.named.has("--untracked-files")&&r.named.get("--untracked-files")!=="all")throw new N("only --untracked-files=all is supported",129);let n=r.paths.map(a=>Ln(t,a)),i=await st.statusMatrix(t);await _t(t,tw(i.filter(([a])=>Ur(a,n)),await Wi(t)))}async function iv(t,e){let{paths:r}=mt(e,["--local"]);if(bt(r,1,2),!["user.name","user.email"].includes(r[0]))throw new N("only repository user.name and user.email config are supported",129);if(r.length===2)return st.setConfig({...t,path:r[0],value:r[1]});let n=await st.getConfig({...t,path:r[0]});if(n===void 0)throw new N("config entry not found",1);await _t(t,`${n}
153
+ `)}import*as rt from"node:fs/promises";var pw={promises:{async readFile(t,e){let r=await rt.readFile(t);return(typeof e=="string"?e:e?.encoding)?r.toString("utf8"):r},writeFile:rt.writeFile,unlink:rt.unlink,readdir:rt.readdir,async mkdir(t){await rt.mkdir(t)},rmdir:rt.rmdir,stat:rt.stat,lstat:rt.lstat,readlink:rt.readlink,symlink:rt.symlink}};var ww=t=>e=>new Promise((r,n)=>t.write(e,i=>i?n(i):r())),mw={};for(let[t,e]of Object.entries(process.env))e!==void 0&&(mw[t]=e);process.exitCode=await hw(pw,{argv:process.argv.slice(2),cwd:process.cwd(),env:mw,stdout:ww(process.stdout),stderr:ww(process.stderr)});
154
+ /*! Bundled license information:
155
+
156
+ safe-buffer/index.js:
157
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
158
+
159
+ crc-32/crc32.js:
160
+ (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
161
+
162
+ isomorphic-git/index.cjs:
163
+ isomorphic-git/managers/index.js:
164
+ isomorphic-git/models/index.js:
165
+ (*!
166
+ * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
167
+ * SPDX-License-Identifier: LGPL-3.0-or-later
168
+ * Copyright (c) James Prevett and other ZenFS contributors.
169
+ *
170
+ * Windows support added:
171
+ * - Backslashes are normalised to forward slashes before processing.
172
+ * - Drive-letter prefixes (e.g. "C:") are detected and preserved through
173
+ * normalisation, so absolute Windows paths are handled correctly.
174
+ * - An absolute argument passed to join() resets the accumulated path,
175
+ * matching Node behaviour and handling worktree gitdir paths properly.
176
+ *
177
+ * Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
178
+ * backslashes are normalised to forward slashes and then collapsed by
179
+ * normalizeString, losing the UNC root. Git on Windows works with
180
+ * drive-letter paths, so this is not expected to be a practical issue.
181
+ *)
182
+ */