@kumori/kdsl 0.0.54 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +9 -3
- package/dist/build/helpers/deployment.d.ts +13 -13
- package/dist/build/main.js +32 -13
- package/dist/build/main.js.map +1 -1
- package/dist/deployment/gen/deployment-template.kumori +1 -1
- package/dist/deployment/gen/main.d.ts +1 -2
- package/dist/deployment/gen/main.js +7 -14
- package/dist/deployment/gen/main.js.map +1 -1
- package/dist/index/create/main.d.ts +1 -0
- package/dist/index/create/main.js +35 -15
- package/dist/index/create/main.js.map +1 -1
- package/dist/index/create/types.d.ts +1 -1
- package/dist/index/main.js +2 -0
- package/dist/index/main.js.map +1 -1
- package/dist/index/remove/main.d.ts +11 -0
- package/dist/index/remove/main.js +136 -0
- package/dist/index/remove/main.js.map +1 -0
- package/dist/lib/build.js +29 -42
- package/dist/lib/check.js +15 -45
- package/dist/lib/clean.js +1 -39
- package/dist/lib/deployment.d.ts +0 -3
- package/dist/lib/deployment.js +1 -5
- package/dist/lib/deployment.js.map +1 -1
- package/dist/lib/index-cmd.js +151 -60
- package/dist/lib/index.js +260 -54
- package/dist/lib/mod.js +78 -144
- package/dist/lib/registry.js +1 -67
- package/dist/mod/dependency/main.js +3 -4
- package/dist/mod/dependency/main.js.map +1 -1
- package/dist/mod/jsonschema/gen/main.js +3 -5
- package/dist/mod/jsonschema/gen/main.js.map +1 -1
- package/dist/mod/update/main.js +2 -2
- package/dist/mod/update/main.js.map +1 -1
- package/dist/util/git-or-fs-client.d.ts +13 -0
- package/dist/util/git-or-fs-client.js +86 -0
- package/dist/util/git-or-fs-client.js.map +1 -0
- package/out/deployment/gen/deployment-template.kumori +1 -1
- package/package.json +25 -15
- package/dist/lib/io/lib.kumori +0 -3
- package/dist/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/dist/lib/kumori/builtin.kumori +0 -16
- package/dist/lib/kumori/component.kumori +0 -120
- package/dist/lib/kumori/deployment.kumori +0 -14
- package/dist/lib/kumori/resource.kumori +0 -23
- package/dist/lib/kumori/service.kumori +0 -51
- package/dist/lib/kumori/shared.kumori +0 -18
- package/dist/lib/kumori/sized.kumori +0 -25
- package/dist/lib/sized.kumori +0 -8
- package/dist/lib/std.kumori +0 -8
- package/dist/lib/strconv/lib.kumori +0 -9
- package/out/deployment-template.kumori +0 -33
- package/out/lib/io/lib.kumori +0 -3
- package/out/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/out/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/out/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/out/lib/kumori/builtin.kumori +0 -16
- package/out/lib/kumori/component.kumori +0 -120
- package/out/lib/kumori/deployment.kumori +0 -14
- package/out/lib/kumori/resource.kumori +0 -23
- package/out/lib/kumori/service.kumori +0 -51
- package/out/lib/kumori/shared.kumori +0 -18
- package/out/lib/kumori/sized.kumori +0 -25
- package/out/lib/sized.kumori +0 -8
- package/out/lib/std.kumori +0 -8
- package/out/lib/strconv/lib.kumori +0 -9
- package/out/main.cjs +0 -820
package/dist/lib/index-cmd.js
CHANGED
|
@@ -1,60 +1,151 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* ```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
// Import the action and run it
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
1
|
+
import{createRequire as zU}from"node:module";var qU=Object.create;var{getPrototypeOf:KU,defineProperty:W7,getOwnPropertyNames:ZU}=Object;var $U=Object.prototype.hasOwnProperty;var F8=(Q,J,W)=>{W=Q!=null?qU(KU(Q)):{};let V=J||!Q||!Q.__esModule?W7(W,"default",{value:Q,enumerable:!0}):W;for(let Y of ZU(Q))if(!$U.call(V,Y))W7(V,Y,{get:()=>Q[Y],enumerable:!0});return V};var k=(Q,J)=>()=>(J||Q((J={exports:{}}).exports,J),J.exports);var C5=(Q,J)=>{for(var W in J)W7(Q,W,{get:J[W],enumerable:!0,configurable:!0,set:(V)=>J[W]=()=>V})};var $1=(Q,J)=>()=>(Q&&(J=Q(Q=0)),J);var e1=zU(import.meta.url),UU=Symbol.dispose||Symbol.for("Symbol.dispose"),HU=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),VW=(Q,J,W)=>{if(J!=null){if(typeof J!=="object"&&typeof J!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var V;if(W)V=J[HU];if(V===void 0)V=J[UU];if(typeof V!=="function")throw TypeError("Object not disposable");Q.push([W,V,J])}else if(W)Q.push([W]);return J},YW=(Q,J,W)=>{var V=typeof SuppressedError==="function"?SuppressedError:function(q,K,z,$){return $=Error(z),$.name="SuppressedError",$.error=q,$.suppressed=K,$},Y=(q)=>J=W?new V(q,J,"An error was suppressed during disposal"):(W=!0,q),X=(q)=>{while(q=Q.pop())try{var K=q[1]&&q[1].call(q[2]);if(q[0])return Promise.resolve(K).then(X,(z)=>(Y(z),X()))}catch(z){Y(z)}if(W)throw J};return X()};import{Result as DU}from"@kumori/kdsl-lsp/util/result.js";function R6(Q,J){if(DU.isErr(J)){for(let W of J.err)Q.error(W);process.exit(1)}return J.value}var T5=()=>{};import{ParseQuery as NW}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as S5,None as NU,Some as IU}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as z1,Ok as V7,Result as b1}from"@kumori/kdsl-lsp/util/result.js";import{Version as jW}from"@kumori/kdsl-lsp/module/version.js";import{ListDependencies as GU}from"@kumori/kdsl-lsp/module/dependency/list.js";import Y7 from"assert";import{LocateDependency as IW}from"@kumori/kdsl-lsp/module/dependency/locate.js";import{ModuleContext as wU}from"@kumori/kdsl-lsp/module/context.js";import{MkdirTemp as LU}from"@kumori/kdsl-lsp/util/tmp.js";import{ValidateChecksum as MU}from"@kumori/kdsl-lsp/module/integrity/validate.js";import{URI as PU,UriUtils as AU}from"langium";import{cp as OU,mkdir as CU,rm as FW}from"fs/promises";import{ForURL as RU}from"@kumori/kdsl-lsp/module/remote/factory.js";import{SemVer as DW}from"@kumori/kdsl-lsp/util/semver.js";import{URL as TU}from"@kumori/kdsl-lsp/util/url.js";import{DependencyId as GW}from"@kumori/kdsl-lsp/module/dependency/id.js";async function wW(Q){let J=new Map;return await MW(Q,J),J}async function LW(Q,J){let W=new Map;console.log(J);for(let V of J){let Y=NW(V,Q.Locations.Config());if(S5.isNone(Y)){let z=`invalid download query '${V}': failed to parse`;W.set(V,{...z1(z),required:!0});continue}let X=jW(Y.value.Version);if(S5.isNone(X)){let z=`invalid download query '${V}': invalid version specifier '${Y.value.Version}': failed to parse`;W.set(V,{...z1(z),required:!0});continue}if(!jW.isSemVer(X.value)){let z=`invalid download query '${V}': invalid version specifier '${Y.value.Version}': invalid semver`;W.set(V,{...z1(z),required:!0});continue}let q=`${Y.value.Scheme}://${Y.value.Location}`,K=Y.value.Version;await PW(Q,q,K,W)}return W}async function MW(Q,J){let W=GU(Q.Current);for(let V of W.keys()){let Y=W.get(V);if(Y.length<1)continue;let{target:X,version:q}=Y[0];await PW(Q,X,q,J);let K=Y.reduce(($,Z)=>$||Z.interface===void 0,!1),z=GW(X,q);Y7(J.has(z)),J.get(z).required||=K}}async function PW(Q,J,W,V){let Y=GW(J,W);if(V.has(Y))return;let X=await SU(Q,J,W);if(V.set(Y,{...X,required:!1}),b1.isErr(X))return;let q=await IW(Q,J,W);Y7(S5.isSome(q));let K=await wU.Move(Q,Q.FS,q.value.Root);Y7(b1.isOk(K)),Q={...Q,...K.value},await MW(Q,V)}async function SU(Q,J,W){let $=[];try{let V=await IW(Q,J,W);if(b1.isOk(V))return V7(NU);const Y=VW($,await LU(),1);let X=await X7(Q,J,W,Y.Path);if(b1.isErr(X))return z1(`failed to fetch ${J}@${W}: ${X.err}`);let q=await MU(Q.SumDB,PU.file(Y.Path),Q,J,X.value);if(b1.isErr(q))return q;let K=`${J}@${W}`;let z=AU.joinPath(Q.Locations.Cache(),K);await CU(z.fsPath,{recursive:!0});await FW(z.fsPath,{recursive:!0,force:!0});await OU(Y.Path,z.fsPath,{recursive:!0});await FW(Y.Path,{recursive:!0,force:!0});return V7(IU(K))}catch(Z){var U=Z,H=1}finally{var B=YW($,U,H);B&&await B}}async function X7(Q,J,W,V){let Y=`${J}@${W}`,X=NW(Y,Q.Locations.Config());if(S5.isNone(X))return z1(`failed to resolve ${Y}: invalid download query`);let q=DW(X.value.Version),K=new TU(`${X.value.Scheme}://${X.value.Location}`),z=RU(Q.Remotes,K);if(b1.isErr(z))return z1(`failed to resolve ${Y}': invalid remote ${K}: ${z.err}`);let $=await z.value.Versions(K);if(b1.isErr($))return z1(`failed to read ${K}: ${$.err}`);let Z=q,U=$.value.filter((j)=>DW.Compare(j,Z)===0);if(U.length===0)return z1(`no remote matches for ${K}@v${q}`);if(U.length>1){let j=`[${U.map(String).join(", ")}]`;return z1(`ambiguous match for ${K}@v${q}: found ${j}`)}let H=U[0],B=await z.value.Get(K,H.toString(),V);if(b1.isErr(B))return z1(`failed to fetch ${K}@${q.toString()}: ${B.err}`);return V7(H)}var q7=()=>{};var uU={};C5(uU,{default:()=>gU,Register:()=>CW,Download:()=>E5,Description:()=>RW,Action:()=>TW});import{ModuleContext as EU}from"@kumori/kdsl-lsp/module/context.js";import{SumDB as vU}from"@kumori/kdsl-lsp/module/integrity/sumdb.js";import{RemoteFetcherFactory as AW}from"@kumori/kdsl-lsp/module/remote/factory.js";import{Maybe as kU}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as OW,Ok as xU,Result as N8}from"@kumori/kdsl-lsp/util/result.js";import{URI as bU}from"langium";import{NodeFileSystem as _U}from"langium/node";import{createKumoriServices as yU}from"@kumori/kdsl-lsp/language/kumori.js";import{RegistryManager as hU}from"@kumori/kdsl-lsp/module/registry/manager.js";function CW(Q,J){return Q.command("download").alias("dl").summary(pU).argument("[module...]").option("-q, --quiet","do not log warnings").description(RW).helpOption(!0).action(TW(J))}function TW(Q){let J=(W)=>R6(Q,W);return async(W,V,Y)=>{let X=Y?.optsWithGlobals()?.config,q=yU(_U,X).Kumori;await new hU(X).ensureIndexes(),J(await E5(Q,q,process.cwd(),W,V,X))}}var gU,pU="download modules to local cache",RW,E5=async(Q,J,W,V,Y,X)=>{let q=J.shared.workspace.FileSystemProvider,K=await EU(q,bU.file(W),X);if(N8.isErr(K))return OW([K.err]);let z=await vU.Open(K.value.Locations.Checksum());if(N8.isErr(z))return N8.mapErr(z,(H)=>[H]);let $;if(!V.length)$=await wW({...K.value,FS:q,Remotes:AW(),SumDB:z.value});else $=await LW({...K.value,FS:q,Remotes:AW(),SumDB:z.value},V);let Z=[];for(let[H,B]of $){if(N8.isOk(B)){if(kU.isSome(B.value))Q.info(`Downloaded dependency ${H}`);continue}if(B.required)Z.push(`${H}: ${B.err}`);else if(!Y.quiet)Q.warn(`${H}: ${B.err}`),Q.warn(`${H}: not required - continuing`)}if(Array.from($.entries()).filter(([,H])=>N8.isErr(H)&&H.required).length>0)return OW(Z);return xU(void 0)};var SW=$1(()=>{T5();q7();gU={Register:CW};RW=`
|
|
2
|
+
Downloads the specified modules, which can be module patterns selecting depen-
|
|
3
|
+
dencies of the current module or module queries of the form path@version.
|
|
4
|
+
|
|
5
|
+
With no arguments, download applies to the modules needed to build the packages
|
|
6
|
+
in the current module.
|
|
7
|
+
|
|
8
|
+
The kdsl command will automatically download modules as needed during ordinary
|
|
9
|
+
execution. The "kdsl mod download" command is useful mainly for pre-filling the
|
|
10
|
+
local cache.
|
|
11
|
+
|
|
12
|
+
By default, download writes nothing to standard output. It may print progress
|
|
13
|
+
messages and errors to standard error.
|
|
14
|
+
`.trim()});var rU={};C5(rU,{default:()=>sU,Summary:()=>xW,Register:()=>kW,RawCheck:()=>yW,Description:()=>bW,Check:()=>T6,Action:()=>_W});import{createKumoriServices as mU}from"@kumori/kdsl-lsp/language/kumori.js";import{URI as fU,UriUtils as Z7}from"langium";import{NodeFileSystem as cU}from"langium/node";import{DiagnosticSeverity as EW}from"vscode-languageserver";import{Err as K7,Ok as vW,Result as I8}from"@kumori/kdsl-lsp/util/result.js";import{ModuleContext as dU}from"@kumori/kdsl-lsp/module/context.js";import lU from"node:path";import{RegistryManager as nU}from"@kumori/kdsl-lsp/module/registry/manager.js";function kW(Q,J){return Q.command("check").argument("[directory]","directory containing a Kumori module").description(bW).summary(xW).action(_W(J))}function _W(Q){return async(J,W,V)=>{await new nU(V?.optsWithGlobals()?.config).ensureIndexes();let X=mU(cU).Kumori,q=X.shared.workspace.FileSystemProvider,K=(Z)=>R6(Q,Z),z=V?.optsWithGlobals()?.config,$=K(I8.mapErr(await dU(q,fU.file(lU.resolve(J??".")),z),(Z)=>[Z]));K(await T6(Q,X,$))}}function oU(Q,J){return`lexer error: ${Z7.relative(process.cwd(),Q.uri.fsPath)}:${J.line||1}:${J.column||1}: ${J.message}`}function aU(Q,J){return`parser error: ${Z7.relative(process.cwd(),Q.uri.fsPath)}:${J.token.startLine||1}:${J.token.startColumn||1}: ${J.message}`}function iU(Q,J){return`diagnostic error: ${Z7.relative(process.cwd(),Q.uri.fsPath)}:${J.range.start.line+1}:${J.range.start.character+1}: ${J.message}`}var xW="typecheck and validate a module",bW,T6=async(Q,J,W)=>{let V=W.Current.Root,Y=await E5(Q,J,V.fsPath,[],{quiet:!0},W.Locations.Config());if(I8.isErr(Y))return Y;let X=await yW(J,W);if(I8.isErr(X)){let q=X.err.warnings.concat(X.err.errors);return K7(q)}return vW(void 0)},yW=async(Q,J)=>{let W={errors:[],warnings:[]},V=Q.shared.workspace.FileSystemProvider,Y=J.Current.Root,X=await I8.tryCatchAsync(()=>V.readDirectory(Y));if(I8.isErr(X)){let $=""+X.err;if(X.err instanceof Error)$=X.err.message;return W.errors.push(`failed to read directory '${Y.fsPath}': ${$}`),K7(W)}await Q.shared.workspace.WorkspaceManager.initializeWorkspace([{name:"root",uri:Y.toString()}]);let K=Q.shared.workspace.LangiumDocuments;await Q.shared.workspace.DocumentBuilder.build(K.all.toArray(),{validation:!0});for(let $ of Q.shared.workspace.LangiumDocuments.all){for(let Z of $.parseResult.lexerErrors)W.errors.push(oU($,Z));for(let Z of $.parseResult.parserErrors)W.errors.push(aU($,Z));for(let Z of $.diagnostics||[]){let U=iU($,Z);if(Z.severity===EW.Error)W.errors.push(U);if(Z.severity===EW.Warning)W.warnings.push(U)}}if(W.errors.length>0)return K7(W);return vW(void 0)},sU;var $7=$1(()=>{SW();T5();bW=`
|
|
15
|
+
`.trim();sU={Register:kW}});import{AstUtils as tU,UriUtils as eU}from"langium";function hW(Q){let J=Q.node.$cstNode?.range??{start:{line:-1,character:-1},end:{line:-1,character:-1}},W=tU.getDocument(Q.node);return`${eU.relative(process.cwd(),W.uri.fsPath)}:${J.start.line+1}:${J.start.character+1}: ${Q.message}`}var gW=()=>{};var TH={};C5(TH,{default:()=>OH,ToJSONSchemaInternal:()=>U1,ToJSONSchema:()=>aW,Register:()=>dW,LocateModule:()=>oW,GetSchema:()=>v5,Description:()=>lW,Action:()=>nW});import{createKumoriServices as QH}from"@kumori/kdsl-lsp/language/kumori.js";import{ModuleContext as JH}from"@kumori/kdsl-lsp/module/context.js";import{ParseQuery as WH}from"@kumori/kdsl-lsp/module/query.js";import{Maybe as mW,None as VH,Some as YH}from"@kumori/kdsl-lsp/util/maybe.js";import{Err as J1,Ok as u0,Result as A0}from"@kumori/kdsl-lsp/util/result.js";import{TempCache as XH}from"@kumori/kdsl-lsp/util/tmp.js";import{NodeFileSystem as fW}from"langium/node";import Q6 from"path";import{AstUtils as z7,URI as qH,UriUtils as cW}from"langium";import G8 from"assert";import{TAny as pW,TBoolean as KH,TEither as ZH,TFunction as $H,TList as zH,TNumber as UH,TOptional as uW,TString as HH,TStruct as BH,TTypeDefAlias as jH,TTypeDefNamed as FH,TypeSystemError as DH,TypeToString as NH}from"@kumori/kdsl-lsp/language/type-system/type.js";import{ModuleDescriptor as IH}from"@kumori/kdsl-lsp/module/descriptor.js";import{isBuiltinArtifact as GH,isComponentArtifact as wH,isServiceArtifact as LH}from"@kumori/kdsl-lsp/language/generated/ast.js";import{Scheme as MH}from"@kumori/kdsl-lsp/language/builtin/util.js";import{GatherModuleDocuments as PH}from"@kumori/kdsl-lsp/module/documents.js";import{RemoteFetcherFactory as AH}from"@kumori/kdsl-lsp/module/remote/factory.js";function dW(Q,J){return Q.command("get").summary(CH).argument("<target>",'Unique path of the kmodule where the artifact is defined. Accepts remote targets (e.g., "github.com/MyOrg/component@v1.2.3") or local paths (e.g. "/abs/path/to/module", "../rel/path/to/module").').argument("<package-path>",`Relative path to the package that contains the artifact (e.g., "internal/service"). For artifacts in the module's root package, use ".".`).argument("<artifact-name>",'Name of the target artifact (e.g., "ExampleService").').description(lW).helpOption(!0).action(nW(J))}function nW(Q){return async(J,W,V,Y,X)=>{let q=X?.optsWithGlobals()?.config,K=QH(fW,q).Kumori,z=(B)=>R6(Q,B),$=z(await oW(J,q)),Z=K.shared.workspace.FileSystemProvider,U=z(A0.mapErr(await JH(Z,qH.file($.fsPath),q),(B)=>[B]));z(await T6(Q,K,U));let H=z(await v5(K,U,W,V));console.log(JSON.stringify(H,null,4))}}async function oW(Q,J){let W=await XH(),V=fW.fileSystemProvider(),Y=Q;if(Q[0]==="."||Q6.isAbsolute(Q)){let U=Q6.isAbsolute(Q)?Q:Q6.resolve(process.cwd(),Q);return u0({$type:"local",fsPath:U})}let q=WH(Q,J);if(mW.isNone(q))return J1([`invalid remote target '${Q}': invalid syntax`]);let K=q.value.Version,z=`${q.value.Location}@${K}`,$=cW.joinPath(W,z),Z=await IH(V,$);if(A0.isErr(Z)){let U=await X7({Remotes:AH(),Locations:{Config:()=>J}},q.value.Location,K,$.fsPath);if(A0.isErr(U))return J1([`failed to fetch ${Y}: ${U.err}`])}return u0({$type:"remote",fsPath:$.fsPath,query:q.value})}async function v5(Q,J,W,V){let Y=cW.joinPath(J.Current.Root,Q6.normalize(W)),X=Q.references.KumoriPackages.GetPackage(Y);if(A0.isErr(X))return J1([`error: failed to retrieve package: ${Y.toString()}`]);let q=new Set(X.value.docs.map((F)=>F.uri.toString())),K=Q.shared.workspace.IndexManager.allElements(void 0,q).toArray().filter((F)=>F.name===V);if(K.length<1)return J1([`error: no artifact named defined in ${Y.toString()}`]);if(K.length>2)return J1([`error: too many matches in ${Y.toString()}`]);let z=K[0].node;if(!(wH(z)||LH(z)||GH(z)))return J1([`invalid reference to node of type: ${z.$type}`]);if(!z7.getDocument(z).uri.fsPath.endsWith(".h.kumori")){if(!z.name.value.ref)return J1(["no headers found for component"]);z=z.name.value.ref}let Z=Q.validation.KumoriTypeSystem,U=Q.validation.KumoriValidations.ctx(),[H,B]=Z.Infer(U,z);if(B.length>0){let F=[];return B.map((I)=>F.concat(I.message)),J1([`type inference failed with errors: ${F}`])}let j=await aW(Q,J,H,Q6.join(J.Current.Manifest.module,W+"@"+V));return A0.mapErr(j,(F)=>F.map(hW))}async function aW(Q,J,W,V){return A0.map(await U1({svcs:Q,mod:J},W),(Y)=>({$schema:"https://json-schema.org/draft/2020-12/schema",$spec:"kumori/schema/v1",$id:V,...Y}))}async function U1(Q,J){if(pW.is(J))return u0({});if($H.is(J))return U1(Q,J.returns);if(uW.is(J))return U1(Q,J.inner);if(jH.is(J))return U1(Q,J.spec);if(UH.is(J))if(J.literal===void 0)return u0({type:"number"});else return u0({const:J.literal});if(HH.is(J))if(J.literal===void 0)return u0({type:"string"});else return u0({const:J.literal});if(KH.is(J))if(J.literal===void 0)return u0({type:"boolean"});else return u0({const:J.literal});if(zH.is(J)){let W=await U1(Q,J.restriction);if(A0.isErr(W))return W;return u0({type:"array",items:W.value})}if(ZH.is(J)){let W=await Promise.all(J.variations.map((X)=>U1(Q,X))),V=W.filter(A0.isErr).map((X)=>X.err).flat();if(V.length>0)return J1(V);let Y=W.filter(A0.isOk).map((X)=>X.value);return G8(Y.length===W.length),u0({oneOf:Y})}if(BH.is(J)){let W=await Promise.all(Object.entries(J.parameters).map(async(q)=>({key:q[0],value:q[1],schema:await U1(Q,q[1].value)}))),V=W.map((q)=>q.schema).filter((q)=>A0.isErr(q)).map((q)=>q.err).flat(),Y=VH;if(J.restriction!==void 0&&!pW.is(J.restriction)){let q=await U1(Q,J.restriction);if(A0.isOk(q))Y=YH(q.value);else V=V.concat(q.err)}if(V.length>0)return J1(V);let X={type:"object",properties:Object.fromEntries(W.map((q)=>{return G8(A0.isOk(q.schema)),[q.key,q.schema.value]})),required:W.filter((q)=>q.value.optional===!1&&!uW.is(q.value.value)).map((q)=>q.key)};if(mW.isSome(Y))X={...X,additionalProperties:Y.value};return u0(X)}if(FH.is(J)){let W=await U1(Q,J.spec);if(A0.isErr(W))return W;return u0({type:"object",properties:{$kdsl:{const:{NamedType:await RH(Q,J)}},inner:W.value},required:["$kdsl","inner"]})}return J1([DH.create({node:J,message:`cannot convert definition to JSONSchema: ${NH(J)}`})])}var OH,CH="extracts jsonschema for a specified module and artifact",lW,RH=async(Q,J)=>{let W=J.node;G8(W);let V=Q.svcs.shared.references.KumoriModules,Y=z7.getDocument(W).uri,X=Q.svcs.references.KumoriPackages.GetPackage(W),q=Q.mod.Current;if(G8(A0.isOk(X)),Y.scheme===MH)return{Import:X.value.uri.path.slice(1),Name:J.meta.name};if(!(await PH(Q.svcs.shared,Q.mod.Root.Root)).map((H)=>H.fsPath).includes(Y.fsPath)){let H=V.getModule(Y);G8(A0.isOk(H)),q=H.value}let Z=q.Root,U=X.value.uri.fsPath.slice(Z.fsPath.length);return{Import:Q6.join(q.Manifest.module,U),Name:J.meta.name}};var iW=$1(()=>{$7();T5();gW();q7();OH={Register:dW};lW=`
|
|
16
|
+
Generates and outputs the JSON Schema that describes a particular Kumori DSL
|
|
17
|
+
artifact. This schema defines the artifact's configurable properties, resource
|
|
18
|
+
requirements, and overall structure, making it valuable for programmatic
|
|
19
|
+
interaction, validation, or documentation purposes.
|
|
20
|
+
|
|
21
|
+
The command allows you to specify artifacts from both remote/external modules
|
|
22
|
+
and local modules.
|
|
23
|
+
`.trim()});import{isComponentArtifact as j7,isServiceArtifact as x5,ServiceArtifact as k5,ComponentArtifact as SH}from"@kumori/kdsl-lsp/language/generated/ast.js";import{VStruct as m0,VNumber as EH,VString as vH,VList as kH}from"@kumori/kdsl-lsp/language/type-system/value.js";import{VAccessor as W1}from"@kumori/kdsl-lsp/language/type-system/eval.js";import{Maybe as V1}from"@kumori/kdsl-lsp/util/maybe.js";import{Multipliers as sW}from"@kumori/kdsl-lsp/util/sized.js";import{AstUtils as xH}from"langium";import U7 from"node:assert";import i0 from"node:path";function rW(Q,J=new WeakSet){if(J.has(Q))return[];J.add(Q);let W=Q.parameters;if(!W||!W.role)return[];let Y=W.role.value?.parameters;if(!Y)return[];let X=[];for(let[q,K]of Object.entries(Y)){let $=K?.value?.parameters;if(!$)continue;let Z=$.artifact?.value,U=x5(Z.node)?"service":j7(Z.node)?"component":"builtin";if(U==="builtin")continue;else if(U==="component"){X.push({name:q,type:U,roles:[]});continue}let H=Z.parameters;if(!H)return[];let F=H.role?.value?.parameters;if(!Y)return[];if(F)X.push({name:q,type:U,roles:rW(Z,J)})}return X}function tW(Q,J){let Y=Q.shared.workspace.IndexManager.allElements(k5.$type).toArray().filter((z)=>z.documentUri.path===J&&!z.documentUri.path.endsWith(".h.kumori"))[0];if(!Y)return[];let X=Y.node;if(!x5(X))return[];U7(X);let[{Value:q}]=Q.validation.KumoriTypeSystem.Eval(Q.validation.KumoriValidations.ctx(),X);if(U7(q.$type==="struct"),U7(q.parameters.role&&q.parameters.role.value.$type==="struct"),!q.parameters.role.value.parameters)return[];return rW(q)}function eW(Q,J,W){if(W.type!=="service")return null;let V=J.Current.Root.path,Y=J.Current.Root.fsPath,X=i0.join(Y,i0.normalize(W.location)),q=X.endsWith(i0.sep)?X:X+i0.sep;return Q.shared.workspace.IndexManager.allElements(k5.$type).toArray().find(($)=>{if($.name!==W.name)return!1;if(!$.documentUri.path.startsWith(V))return!1;if($.documentUri.path.endsWith(".h.kumori"))return!1;let Z=$.documentUri.fsPath;if(Z)return i0.dirname(Z)===X||Z.startsWith(q);return!0})?.documentUri?.path??null}function H7(Q){if(!Q.parameters)return null;let J=W1(Q,"size"),W=W1(Q,"unit");if(V1.isNone(J)||V1.isNone(W)||!EH.is(J.value)||!vH.is(W.value))return null;return{size:J.value.literal,unit:W.value.literal}}function B7(Q){let J=sW.G,W=Q.unit==="m"?"M":Q.unit,V=sW[W];if(!V)return 0;return Q.size*V/J}function QV(Q,J,W,V,Y){let X=J.Current.Root.fsPath,q=i0.join(X,i0.normalize(V)),K=q.endsWith(i0.sep)?q:q+i0.sep,z=Y?SH.$type:k5.$type,Z=Q.shared.workspace.IndexManager.allElements(z).toArray().find((B)=>{if(B.name!==W)return!1;let j=B.documentUri.fsPath;if(!j)return!1;if(Y&&B.documentUri.path.endsWith(".h.kumori"))return!1;if(!Y&&B.documentUri.path.endsWith(".h.kumori"))return!1;return i0.dirname(j)===q||j.startsWith(K)});if(!Z)return null;let U=Z.node;if(!(Y&&j7(U)||!Y&&x5(U)))return null;let[{Value:H}]=Q.validation.KumoriTypeSystem.Eval(Q.validation.KumoriValidations.ctx(),U);if(!m0.is(H))return null;return H}function F7(Q,J,W,V){let Y=QV(Q,J,W,V,!0);if(!Y)return null;let X=W1(Y,"size");if(V1.isNone(X)||!m0.is(X.value))return null;let q=W1(X.value,"mincpu");if(V1.isNone(q)||!m0.is(q.value))return null;let K=H7(q.value);if(!K)return null;let z=B7(K),$=0,Z=W1(Y,"code");if(!V1.isNone(Z)&&m0.is(Z.value))for(let H of Object.values(Z.value.parameters)){if(!H||!m0.is(H.value))continue;let B=W1(H.value,"size");if(!V1.isNone(B)&&m0.is(B.value)){let j=W1(B.value,"memory");if(!V1.isNone(j)&&m0.is(j.value)){let F=H7(j.value);if(F)$+=B7(F)}}}let U=W1(Y,"init");if(!V1.isNone(U)&&kH.is(U.value))for(let H of U.value.items){if(!m0.is(H.value))continue;let B=W1(H.value,"size");if(!V1.isNone(B)&&m0.is(B.value)){let j=W1(B.value,"memory");if(!V1.isNone(j)&&m0.is(j.value)){let F=H7(j.value);if(F)$+=B7(F)}}}return{cpu:z,memory:$}}function D7(Q,J,W,V,Y=new Set){let X=`${W}@${V}`;if(Y.has(X))return{cpu:0,memory:0};Y.add(X);let q=QV(Q,J,W,V,!1);if(!q)return null;let K=0,z=0,$=W1(q,"role");if(V1.isNone($)||!m0.is($.value))return{cpu:K,memory:z};let Z=$.value.parameters;if(!Z)return{cpu:K,memory:z};for(let U of Object.values(Z)){if(!U||!m0.is(U.value))continue;let H=U.value.parameters;if(!H)continue;let B=H.artifact;if(!B||!m0.is(B.value))continue;let F=B.value.node;if(!F)continue;let I=j7(F),L=x5(F);if(!I&&!L)continue;let N=F.name?.value?.$refText||"",O=J.Current.Root.fsPath,A=F.name?.value?.ref,P=A?i0.dirname(xH.getDocument(A).uri.fsPath):"";if(!N||!P.startsWith(O))continue;let T=i0.relative(O,P);if(I){let D=F7(Q,J,N,T);if(D)K+=D.cpu,z+=D.memory}else if(L){let D=D7(Q,J,N,T,Y);if(D)K+=D.cpu,z+=D.memory}}return{cpu:K,memory:z}}var JV=()=>{};var VV=k((DC,WV)=>{var f0=function(Q){if(Q=Q||{},this.Promise=Q.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=Q.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw 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)}if(this.timeout=Q.timeout||f0.DEFAULT_TIMEOUT,this.maxOccupationTime=Q.maxOccupationTime||f0.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=Q.maxExecutionTime||f0.DEFAULT_MAX_EXECUTION_TIME,Q.maxPending===1/0||Number.isInteger(Q.maxPending)&&Q.maxPending>=0)this.maxPending=Q.maxPending;else this.maxPending=f0.DEFAULT_MAX_PENDING};f0.DEFAULT_TIMEOUT=0;f0.DEFAULT_MAX_OCCUPATION_TIME=0;f0.DEFAULT_MAX_EXECUTION_TIME=0;f0.DEFAULT_MAX_PENDING=1000;f0.prototype.acquire=function(Q,J,W,V){if(Array.isArray(Q))return this._acquireBatch(Q,J,W,V);if(typeof J!=="function")throw Error("You must pass a function to execute");var Y=null,X=null,q=null;if(typeof W!=="function")V=W,W=null,q=new this.Promise(function(N,O){Y=N,X=O});V=V||{};var K=!1,z=null,$=null,Z=null,U=this,H=function(N,O,A){if($)clearTimeout($),$=null;if(Z)clearTimeout(Z),Z=null;if(N){if(!!U.queues[Q]&&U.queues[Q].length===0)delete U.queues[Q];if(U.domainReentrant)delete U.domains[Q]}if(!K){if(!q){if(typeof W==="function")W(O,A)}else if(O)X(O);else Y(A);K=!0}if(N){if(!!U.queues[Q]&&U.queues[Q].length>0)U.queues[Q].shift()()}},B=function(N){if(K)return H(N);if(z)clearTimeout(z),z=null;if(U.domainReentrant&&N)U.domains[Q]=process.domain;var O=V.maxExecutionTime||U.maxExecutionTime;if(O)Z=setTimeout(function(){if(U.queues[Q])H(N,Error("Maximum execution time is exceeded "+Q))},O);if(J.length===1){var A=!1;try{J(function(P,T){if(!A)A=!0,H(N,P,T)})}catch(P){if(!A)A=!0,H(N,P)}}else U._promiseTry(function(){return J()}).then(function(P){H(N,void 0,P)},function(P){H(N,P)})};if(U.domainReentrant&&!!process.domain)B=process.domain.bind(B);var j=V.maxPending||U.maxPending;if(!U.queues[Q])U.queues[Q]=[],B(!0);else if(U.domainReentrant&&!!process.domain&&process.domain===U.domains[Q])B(!1);else if(U.queues[Q].length>=j)H(!1,Error("Too many pending tasks in queue "+Q));else{var F=function(){B(!0)};if(V.skipQueue)U.queues[Q].unshift(F);else U.queues[Q].push(F);var I=V.timeout||U.timeout;if(I)z=setTimeout(function(){z=null,H(!1,Error("async-lock timed out in queue "+Q))},I)}var L=V.maxOccupationTime||U.maxOccupationTime;if(L)$=setTimeout(function(){if(U.queues[Q])H(!1,Error("Maximum occupation time is exceeded in queue "+Q))},L);if(q)return q};f0.prototype._acquireBatch=function(Q,J,W,V){if(typeof W!=="function")V=W,W=null;var Y=this,X=function(K,z){return function($){Y.acquire(K,z,$,V)}},q=Q.reduceRight(function(K,z){return X(z,K)},J);if(typeof W==="function")q(W);else return new this.Promise(function(K,z){if(q.length===1)q(function($,Z){if($)z($);else K(Z)});else K(q())})};f0.prototype.isBusy=function(Q){if(!Q)return Object.keys(this.queues).length>0;else return!!this.queues[Q]};f0.prototype._promiseTry=function(Q){try{return this.Promise.resolve(Q())}catch(J){return this.Promise.reject(J)}};WV.exports=f0});var YV=k((NC,N7)=>{if(typeof Object.create==="function")N7.exports=function(J,W){if(W)J.super_=W,J.prototype=Object.create(W.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}})};else N7.exports=function(J,W){if(W){J.super_=W;var V=function(){};V.prototype=W.prototype,J.prototype=new V,J.prototype.constructor=J}}});var XV=k((IC,I7)=>{try{if(b5=e1("util"),typeof b5.inherits!=="function")throw"";I7.exports=b5.inherits}catch(Q){I7.exports=YV()}var b5});var y5=k((G7,KV)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var _5=e1("buffer"),H1=_5.Buffer;function qV(Q,J){for(var W in Q)J[W]=Q[W]}if(H1.from&&H1.alloc&&H1.allocUnsafe&&H1.allocUnsafeSlow)KV.exports=_5;else qV(_5,G7),G7.Buffer=J6;function J6(Q,J,W){return H1(Q,J,W)}J6.prototype=Object.create(H1.prototype);qV(H1,J6);J6.from=function(Q,J,W){if(typeof Q==="number")throw TypeError("Argument must not be a number");return H1(Q,J,W)};J6.alloc=function(Q,J,W){if(typeof Q!=="number")throw TypeError("Argument must be a number");var V=H1(Q);if(J!==void 0)if(typeof W==="string")V.fill(J,W);else V.fill(J);else V.fill(0);return V};J6.allocUnsafe=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return H1(Q)};J6.allocUnsafeSlow=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return _5.SlowBuffer(Q)}});var $V=k((GC,ZV)=>{var bH={}.toString;ZV.exports=Array.isArray||function(Q){return bH.call(Q)=="[object Array]"}});var S6=k((wC,zV)=>{zV.exports=TypeError});var w7=k((LC,UV)=>{UV.exports=Object});var BV=k((MC,HV)=>{HV.exports=Error});var FV=k((PC,jV)=>{jV.exports=EvalError});var NV=k((AC,DV)=>{DV.exports=RangeError});var GV=k((OC,IV)=>{IV.exports=ReferenceError});var L7=k((CC,wV)=>{wV.exports=SyntaxError});var MV=k((RC,LV)=>{LV.exports=URIError});var AV=k((TC,PV)=>{PV.exports=Math.abs});var CV=k((SC,OV)=>{OV.exports=Math.floor});var TV=k((EC,RV)=>{RV.exports=Math.max});var EV=k((vC,SV)=>{SV.exports=Math.min});var kV=k((kC,vV)=>{vV.exports=Math.pow});var bV=k((xC,xV)=>{xV.exports=Math.round});var yV=k((bC,_V)=>{_V.exports=Number.isNaN||function(J){return J!==J}});var gV=k((_C,hV)=>{var _H=yV();hV.exports=function(J){if(_H(J)||J===0)return J;return J<0?-1:1}});var uV=k((yC,pV)=>{pV.exports=Object.getOwnPropertyDescriptor});var E6=k((hC,mV)=>{var h5=uV();if(h5)try{h5([],"length")}catch(Q){h5=null}mV.exports=h5});var w8=k((gC,fV)=>{var g5=Object.defineProperty||!1;if(g5)try{g5({},"a",{value:1})}catch(Q){g5=!1}fV.exports=g5});var M7=k((pC,cV)=>{cV.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var J={},W=Symbol("test"),V=Object(W);if(typeof W==="string")return!1;if(Object.prototype.toString.call(W)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(V)!=="[object Symbol]")return!1;var Y=42;J[W]=Y;for(var X in J)return!1;if(typeof Object.keys==="function"&&Object.keys(J).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(J).length!==0)return!1;var q=Object.getOwnPropertySymbols(J);if(q.length!==1||q[0]!==W)return!1;if(!Object.prototype.propertyIsEnumerable.call(J,W))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var K=Object.getOwnPropertyDescriptor(J,W);if(K.value!==Y||K.enumerable!==!0)return!1}return!0}});var nV=k((uC,lV)=>{var dV=typeof Symbol<"u"&&Symbol,yH=M7();lV.exports=function(){if(typeof dV!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof dV("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return yH()}});var P7=k((mC,oV)=>{oV.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var A7=k((fC,aV)=>{var hH=w7();aV.exports=hH.getPrototypeOf||null});var rV=k((cC,sV)=>{var gH="Function.prototype.bind called on incompatible ",pH=Object.prototype.toString,uH=Math.max,mH="[object Function]",iV=function(J,W){var V=[];for(var Y=0;Y<J.length;Y+=1)V[Y]=J[Y];for(var X=0;X<W.length;X+=1)V[X+J.length]=W[X];return V},fH=function(J,W){var V=[];for(var Y=W||0,X=0;Y<J.length;Y+=1,X+=1)V[X]=J[Y];return V},cH=function(Q,J){var W="";for(var V=0;V<Q.length;V+=1)if(W+=Q[V],V+1<Q.length)W+=J;return W};sV.exports=function(J){var W=this;if(typeof W!=="function"||pH.apply(W)!==mH)throw TypeError(gH+W);var V=fH(arguments,1),Y,X=function(){if(this instanceof Y){var Z=W.apply(this,iV(V,arguments));if(Object(Z)===Z)return Z;return this}return W.apply(J,iV(V,arguments))},q=uH(0,W.length-V.length),K=[];for(var z=0;z<q;z++)K[z]="$"+z;if(Y=Function("binder","return function ("+cH(K,",")+"){ return binder.apply(this,arguments); }")(X),W.prototype){var $=function(){};$.prototype=W.prototype,Y.prototype=new $,$.prototype=null}return Y}});var v6=k((dC,tV)=>{var dH=rV();tV.exports=Function.prototype.bind||dH});var p5=k((lC,eV)=>{eV.exports=Function.prototype.call});var u5=k((nC,QY)=>{QY.exports=Function.prototype.apply});var WY=k((oC,JY)=>{JY.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var O7=k((aC,VY)=>{var lH=v6(),nH=u5(),oH=p5(),aH=WY();VY.exports=aH||lH.call(oH,nH)});var m5=k((iC,YY)=>{var iH=v6(),sH=S6(),rH=p5(),tH=O7();YY.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new sH("a function is required");return tH(iH,rH,J)}});var zY=k((sC,$Y)=>{var eH=m5(),XY=E6(),KY;try{KY=[].__proto__===Array.prototype}catch(Q){if(!Q||typeof Q!=="object"||!("code"in Q)||Q.code!=="ERR_PROTO_ACCESS")throw Q}var C7=!!KY&&XY&&XY(Object.prototype,"__proto__"),ZY=Object,qY=ZY.getPrototypeOf;$Y.exports=C7&&typeof C7.get==="function"?eH([C7.get]):typeof qY==="function"?function(J){return qY(J==null?J:ZY(J))}:!1});var R7=k((rC,jY)=>{var UY=P7(),HY=A7(),BY=zY();jY.exports=UY?function(J){return UY(J)}:HY?function(J){if(!J||typeof J!=="object"&&typeof J!=="function")throw TypeError("getProto: not an object");return HY(J)}:BY?function(J){return BY(J)}:null});var DY=k((tC,FY)=>{var Q3=Function.prototype.call,J3=Object.prototype.hasOwnProperty,W3=v6();FY.exports=W3.call(Q3,J3)});var v7=k((eC,LY)=>{var n,V3=w7(),Y3=BV(),X3=FV(),q3=NV(),K3=GV(),_6=L7(),b6=S6(),Z3=MV(),$3=AV(),z3=CV(),U3=TV(),H3=EV(),B3=kV(),j3=bV(),F3=gV(),GY=Function,T7=function(Q){try{return GY('"use strict"; return ('+Q+").constructor;")()}catch(J){}},L8=E6(),D3=w8(),S7=function(){throw new b6},N3=L8?function(){try{return arguments.callee,S7}catch(Q){try{return L8(arguments,"callee").get}catch(J){return S7}}}():S7,k6=nV()(),D0=R7(),I3=A7(),G3=P7(),wY=u5(),M8=p5(),x6={},w3=typeof Uint8Array>"u"||!D0?n:D0(Uint8Array),W6={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":k6&&D0?D0([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":x6,"%AsyncGenerator%":x6,"%AsyncGeneratorFunction%":x6,"%AsyncIteratorPrototype%":x6,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Y3,"%eval%":eval,"%EvalError%":X3,"%Float16Array%":typeof Float16Array>"u"?n:Float16Array,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":GY,"%GeneratorFunction%":x6,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k6&&D0?D0(D0([][Symbol.iterator]())):n,"%JSON%":typeof JSON==="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!k6||!D0?n:D0(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":V3,"%Object.getOwnPropertyDescriptor%":L8,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":q3,"%ReferenceError%":K3,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!k6||!D0?n:D0(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k6&&D0?D0(""[Symbol.iterator]()):n,"%Symbol%":k6?Symbol:n,"%SyntaxError%":_6,"%ThrowTypeError%":N3,"%TypedArray%":w3,"%TypeError%":b6,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":Z3,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":M8,"%Function.prototype.apply%":wY,"%Object.defineProperty%":D3,"%Object.getPrototypeOf%":I3,"%Math.abs%":$3,"%Math.floor%":z3,"%Math.max%":U3,"%Math.min%":H3,"%Math.pow%":B3,"%Math.round%":j3,"%Math.sign%":F3,"%Reflect.getPrototypeOf%":G3};if(D0)try{null.error}catch(Q){E7=D0(D0(Q)),W6["%Error.prototype%"]=E7}var E7,L3=function Q(J){var W;if(J==="%AsyncFunction%")W=T7("async function () {}");else if(J==="%GeneratorFunction%")W=T7("function* () {}");else if(J==="%AsyncGeneratorFunction%")W=T7("async function* () {}");else if(J==="%AsyncGenerator%"){var V=Q("%AsyncGeneratorFunction%");if(V)W=V.prototype}else if(J==="%AsyncIteratorPrototype%"){var Y=Q("%AsyncGenerator%");if(Y&&D0)W=D0(Y.prototype)}return W6[J]=W,W},NY={__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"]},P8=v6(),f5=DY(),M3=P8.call(M8,Array.prototype.concat),P3=P8.call(wY,Array.prototype.splice),IY=P8.call(M8,String.prototype.replace),c5=P8.call(M8,String.prototype.slice),A3=P8.call(M8,RegExp.prototype.exec),O3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C3=/\\(\\)?/g,R3=function(J){var W=c5(J,0,1),V=c5(J,-1);if(W==="%"&&V!=="%")throw new _6("invalid intrinsic syntax, expected closing `%`");else if(V==="%"&&W!=="%")throw new _6("invalid intrinsic syntax, expected opening `%`");var Y=[];return IY(J,O3,function(X,q,K,z){Y[Y.length]=K?IY(z,C3,"$1"):q||X}),Y},T3=function(J,W){var V=J,Y;if(f5(NY,V))Y=NY[V],V="%"+Y[0]+"%";if(f5(W6,V)){var X=W6[V];if(X===x6)X=L3(V);if(typeof X>"u"&&!W)throw new b6("intrinsic "+J+" exists, but is not available. Please file an issue!");return{alias:Y,name:V,value:X}}throw new _6("intrinsic "+J+" does not exist!")};LY.exports=function(J,W){if(typeof J!=="string"||J.length===0)throw new b6("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof W!=="boolean")throw new b6('"allowMissing" argument must be a boolean');if(A3(/^%?[^%]*%?$/,J)===null)throw new _6("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var V=R3(J),Y=V.length>0?V[0]:"",X=T3("%"+Y+"%",W),q=X.name,K=X.value,z=!1,$=X.alias;if($)Y=$[0],P3(V,M3([0,1],$));for(var Z=1,U=!0;Z<V.length;Z+=1){var H=V[Z],B=c5(H,0,1),j=c5(H,-1);if((B==='"'||B==="'"||B==="`"||(j==='"'||j==="'"||j==="`"))&&B!==j)throw new _6("property names with quotes must have matching quotes");if(H==="constructor"||!U)z=!0;if(Y+="."+H,q="%"+Y+"%",f5(W6,q))K=W6[q];else if(K!=null){if(!(H in K)){if(!W)throw new b6("base intrinsic for "+J+" exists, but the property is not available.");return}if(L8&&Z+1>=V.length){var F=L8(K,H);if(U=!!F,U&&"get"in F&&!("originalValue"in F.get))K=F.get;else K=K[H]}else U=f5(K,H),K=K[H];if(U&&!z)W6[q]=K}}return K}});var k7=k((QR,AY)=>{var MY=v7(),PY=m5(),S3=PY([MY("%String.prototype.indexOf%")]);AY.exports=function(J,W){var V=MY(J,!!W);if(typeof V==="function"&&S3(J,".prototype.")>-1)return PY([V]);return V}});var RY=k((JR,CY)=>{var OY=Function.prototype.toString,y6=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,b7,d5;if(typeof y6==="function"&&typeof Object.defineProperty==="function")try{b7=Object.defineProperty({},"length",{get:function(){throw d5}}),d5={},y6(function(){throw 42},null,b7)}catch(Q){if(Q!==d5)y6=null}else y6=null;var E3=/^\s*class\b/,_7=function(J){try{var W=OY.call(J);return E3.test(W)}catch(V){return!1}},x7=function(J){try{if(_7(J))return!1;return OY.call(J),!0}catch(W){return!1}},l5=Object.prototype.toString,v3="[object Object]",k3="[object Function]",x3="[object GeneratorFunction]",b3="[object HTMLAllCollection]",_3="[object HTML document.all class]",y3="[object HTMLCollection]",h3=typeof Symbol==="function"&&!!Symbol.toStringTag,g3=!(0 in[,]),y7=function(){return!1};if(typeof document==="object"){if(h7=document.all,l5.call(h7)===l5.call(document.all))y7=function(J){if((g3||!J)&&(typeof J>"u"||typeof J==="object"))try{var W=l5.call(J);return(W===b3||W===_3||W===y3||W===v3)&&J("")==null}catch(V){}return!1}}var h7;CY.exports=y6?function(J){if(y7(J))return!0;if(!J)return!1;if(typeof J!=="function"&&typeof J!=="object")return!1;try{y6(J,null,b7)}catch(W){if(W!==d5)return!1}return!_7(J)&&x7(J)}:function(J){if(y7(J))return!0;if(!J)return!1;if(typeof J!=="function"&&typeof J!=="object")return!1;if(h3)return x7(J);if(_7(J))return!1;var W=l5.call(J);if(W!==k3&&W!==x3&&!/^\[object HTML/.test(W))return!1;return x7(J)}});var EY=k((WR,SY)=>{var p3=RY(),u3=Object.prototype.toString,TY=Object.prototype.hasOwnProperty,m3=function(J,W,V){for(var Y=0,X=J.length;Y<X;Y++)if(TY.call(J,Y))if(V==null)W(J[Y],Y,J);else W.call(V,J[Y],Y,J)},f3=function(J,W,V){for(var Y=0,X=J.length;Y<X;Y++)if(V==null)W(J.charAt(Y),Y,J);else W.call(V,J.charAt(Y),Y,J)},c3=function(J,W,V){for(var Y in J)if(TY.call(J,Y))if(V==null)W(J[Y],Y,J);else W.call(V,J[Y],Y,J)};function d3(Q){return u3.call(Q)==="[object Array]"}SY.exports=function(J,W,V){if(!p3(W))throw TypeError("iterator must be a function");var Y;if(arguments.length>=3)Y=V;if(d3(J))m3(J,W,Y);else if(typeof J==="string")f3(J,W,Y);else c3(J,W,Y)}});var kY=k((VR,vY)=>{vY.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var bY=k((YR,xY)=>{var g7=kY(),l3=typeof globalThis>"u"?global:globalThis;xY.exports=function(){var J=[];for(var W=0;W<g7.length;W++)if(typeof l3[g7[W]]==="function")J[J.length]=g7[W];return J}});var gY=k((XR,hY)=>{var _Y=w8(),n3=L7(),h6=S6(),yY=E6();hY.exports=function(J,W,V){if(!J||typeof J!=="object"&&typeof J!=="function")throw new h6("`obj` must be an object or a function`");if(typeof W!=="string"&&typeof W!=="symbol")throw new h6("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new h6("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new h6("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new h6("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new h6("`loose`, if provided, must be a boolean");var Y=arguments.length>3?arguments[3]:null,X=arguments.length>4?arguments[4]:null,q=arguments.length>5?arguments[5]:null,K=arguments.length>6?arguments[6]:!1,z=!!yY&&yY(J,W);if(_Y)_Y(J,W,{configurable:q===null&&z?z.configurable:!q,enumerable:Y===null&&z?z.enumerable:!Y,value:V,writable:X===null&&z?z.writable:!X});else if(K||!Y&&!X&&!q)J[W]=V;else throw new n3("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var mY=k((qR,uY)=>{var p7=w8(),pY=function(){return!!p7};pY.hasArrayLengthDefineBug=function(){if(!p7)return null;try{return p7([],"length",{value:1}).length!==1}catch(J){return!0}};uY.exports=pY});var nY=k((KR,lY)=>{var o3=v7(),fY=gY(),a3=mY()(),cY=E6(),dY=S6(),i3=o3("%Math.floor%");lY.exports=function(J,W){if(typeof J!=="function")throw new dY("`fn` is not a function");if(typeof W!=="number"||W<0||W>4294967295||i3(W)!==W)throw new dY("`length` must be a positive 32-bit integer");var V=arguments.length>2&&!!arguments[2],Y=!0,X=!0;if("length"in J&&cY){var q=cY(J,"length");if(q&&!q.configurable)Y=!1;if(q&&!q.writable)X=!1}if(Y||X||!V)if(a3)fY(J,"length",W,!0,!0);else fY(J,"length",W);return J}});var aY=k((ZR,oY)=>{var s3=v6(),r3=u5(),t3=O7();oY.exports=function(){return t3(s3,r3,arguments)}});var rY=k(($R,n5)=>{var e3=nY(),iY=w8(),QB=m5(),sY=aY();n5.exports=function(J){var W=QB(arguments),V=J.length-(arguments.length-1);return e3(W,1+(V>0?V:0),!0)};if(iY)iY(n5.exports,"apply",{value:sY});else n5.exports.apply=sY});var eY=k((zR,tY)=>{var JB=M7();tY.exports=function(){return JB()&&!!Symbol.toStringTag}});var Y4=k((UR,V4)=>{var i5=EY(),WB=bY(),Q4=rY(),m7=k7(),a5=E6(),o5=R7(),VB=m7("Object.prototype.toString"),W4=eY()(),J4=typeof globalThis>"u"?global:globalThis,u7=WB(),f7=m7("String.prototype.slice"),YB=m7("Array.prototype.indexOf",!0)||function(J,W){for(var V=0;V<J.length;V+=1)if(J[V]===W)return V;return-1},s5={__proto__:null};if(W4&&a5&&o5)i5(u7,function(Q){var J=new J4[Q];if(Symbol.toStringTag in J&&o5){var W=o5(J),V=a5(W,Symbol.toStringTag);if(!V&&W){var Y=o5(W);V=a5(Y,Symbol.toStringTag)}if(V&&V.get){var X=Q4(V.get);s5["$"+Q]=X}}});else i5(u7,function(Q){var J=new J4[Q],W=J.slice||J.set;if(W){var V=Q4(W);s5["$"+Q]=V}});var XB=function(J){var W=!1;return i5(s5,function(V,Y){if(!W)try{if("$"+V(J)===Y)W=f7(Y,1)}catch(X){}}),W},qB=function(J){var W=!1;return i5(s5,function(V,Y){if(!W)try{V(J),W=f7(Y,1)}catch(X){}}),W};V4.exports=function(J){if(!J||typeof J!=="object")return!1;if(!W4){var W=f7(VB(J),8,-1);if(YB(u7,W)>-1)return W;if(W!=="Object")return!1;return qB(J)}if(!a5)return null;return XB(J)}});var q4=k((HR,X4)=>{var KB=Y4();X4.exports=function(J){return!!KB(J)}});var Z4=k((BR,K4)=>{var ZB=S6(),$B=k7(),zB=$B("TypedArray.prototype.buffer",!0),UB=q4();K4.exports=zB||function(J){if(!UB(J))throw new ZB("Not a Typed Array");return J.buffer}});var U4=k((jR,z4)=>{var Y1=y5().Buffer,HB=$V(),BB=Z4(),jB=ArrayBuffer.isView||function(J){try{return BB(J),!0}catch(W){return!1}},FB=typeof Uint8Array<"u",$4=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",DB=$4&&(Y1.prototype instanceof Uint8Array||Y1.TYPED_ARRAY_SUPPORT);z4.exports=function(J,W){if(Y1.isBuffer(J)){if(J.constructor&&!("isBuffer"in J))return Y1.from(J);return J}if(typeof J==="string")return Y1.from(J,W);if($4&&jB(J)){if(J.byteLength===0)return Y1.alloc(0);if(DB){var V=Y1.from(J.buffer,J.byteOffset,J.byteLength);if(V.byteLength===J.byteLength)return V}var Y=J instanceof Uint8Array?J:new Uint8Array(J.buffer,J.byteOffset,J.byteLength),X=Y1.from(Y);if(X.length===J.byteLength)return X}if(FB&&J instanceof Uint8Array)return Y1.from(J);var q=HB(J);if(q)for(var K=0;K<J.length;K+=1){var z=J[K];if(typeof z!=="number"||z<0||z>255||~~z!==z)throw RangeError("Array items must be numbers in the range 0-255.")}if(q||Y1.isBuffer(J)&&J.constructor&&typeof J.constructor.isBuffer==="function"&&J.constructor.isBuffer(J))return Y1.from(J);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var B4=k((FR,H4)=>{var NB=y5().Buffer,IB=U4();function r5(Q,J){this._block=NB.alloc(Q),this._finalSize=J,this._blockSize=Q,this._len=0}r5.prototype.update=function(Q,J){Q=IB(Q,J||"utf8");var W=this._block,V=this._blockSize,Y=Q.length,X=this._len;for(var q=0;q<Y;){var K=X%V,z=Math.min(Y-q,V-K);for(var $=0;$<z;$++)W[K+$]=Q[q+$];if(X+=z,q+=z,X%V===0)this._update(W)}return this._len+=Y,this};r5.prototype.digest=function(Q){var J=this._len%this._blockSize;if(this._block[J]=128,this._block.fill(0,J+1),J>=this._finalSize)this._update(this._block),this._block.fill(0);var W=this._len*8;if(W<=4294967295)this._block.writeUInt32BE(W,this._blockSize-4);else{var V=(W&4294967295)>>>0,Y=(W-V)/4294967296;this._block.writeUInt32BE(Y,this._blockSize-8),this._block.writeUInt32BE(V,this._blockSize-4)}this._update(this._block);var X=this._hash();return Q?X.toString(Q):X};r5.prototype._update=function(){throw Error("_update must be implemented by subclass")};H4.exports=r5});var D4=k((DR,F4)=>{var GB=XV(),j4=B4(),wB=y5().Buffer,LB=[1518500249,1859775393,-1894007588,-899497514],MB=Array(80);function A8(){this.init(),this._w=MB,j4.call(this,64,56)}GB(A8,j4);A8.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function PB(Q){return Q<<1|Q>>>31}function AB(Q){return Q<<5|Q>>>27}function OB(Q){return Q<<30|Q>>>2}function CB(Q,J,W,V){if(Q===0)return J&W|~J&V;if(Q===2)return J&W|J&V|W&V;return J^W^V}A8.prototype._update=function(Q){var J=this._w,W=this._a|0,V=this._b|0,Y=this._c|0,X=this._d|0,q=this._e|0;for(var K=0;K<16;++K)J[K]=Q.readInt32BE(K*4);for(;K<80;++K)J[K]=PB(J[K-3]^J[K-8]^J[K-14]^J[K-16]);for(var z=0;z<80;++z){var $=~~(z/20),Z=AB(W)+CB($,V,Y,X)+q+J[z]+LB[$]|0;q=X,X=Y,Y=OB(V),V=W,W=Z}this._a=W+this._a|0,this._b=V+this._b|0,this._c=Y+this._c|0,this._d=X+this._d|0,this._e=q+this._e|0};A8.prototype._hash=function(){var Q=wB.allocUnsafe(20);return Q.writeInt32BE(this._a|0,0),Q.writeInt32BE(this._b|0,4),Q.writeInt32BE(this._c|0,8),Q.writeInt32BE(this._d|0,12),Q.writeInt32BE(this._e|0,16),Q};F4.exports=A8});var I4=k((c7)=>{/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var N4;(function(Q){if(typeof DO_NOT_EXPORT_CRC>"u")if(typeof c7==="object")Q(c7);else if(typeof define==="function"&&define.amd)define(function(){var J={};return Q(J),J});else Q(N4={});else Q(N4={})})(function(Q){Q.version="1.2.2";function J(){var D=0,M=Array(256);for(var G=0;G!=256;++G)D=G,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,D=D&1?-306674912^D>>>1:D>>>1,M[G]=D;return typeof Int32Array<"u"?new Int32Array(M):M}var W=J();function V(D){var M=0,G=0,R=0,C=typeof Int32Array<"u"?new Int32Array(4096):Array(4096);for(R=0;R!=256;++R)C[R]=D[R];for(R=0;R!=256;++R){G=D[R];for(M=256+R;M<4096;M+=256)G=C[M]=G>>>8^D[G&255]}var x=[];for(R=1;R!=16;++R)x[R-1]=typeof Int32Array<"u"?C.subarray(R*256,R*256+256):C.slice(R*256,R*256+256);return x}var Y=V(W),X=Y[0],q=Y[1],K=Y[2],z=Y[3],$=Y[4],Z=Y[5],U=Y[6],H=Y[7],B=Y[8],j=Y[9],F=Y[10],I=Y[11],L=Y[12],N=Y[13],O=Y[14];function A(D,M){var G=M^-1;for(var R=0,C=D.length;R<C;)G=G>>>8^W[(G^D.charCodeAt(R++))&255];return~G}function P(D,M){var G=M^-1,R=D.length-15,C=0;for(;C<R;)G=O[D[C++]^G&255]^N[D[C++]^G>>8&255]^L[D[C++]^G>>16&255]^I[D[C++]^G>>>24]^F[D[C++]]^j[D[C++]]^B[D[C++]]^H[D[C++]]^U[D[C++]]^Z[D[C++]]^$[D[C++]]^z[D[C++]]^K[D[C++]]^q[D[C++]]^X[D[C++]]^W[D[C++]];R+=15;while(C<R)G=G>>>8^W[(G^D[C++])&255];return~G}function T(D,M){var G=M^-1;for(var R=0,C=D.length,x=0,g=0;R<C;)if(x=D.charCodeAt(R++),x<128)G=G>>>8^W[(G^x)&255];else if(x<2048)G=G>>>8^W[(G^(192|x>>6&31))&255],G=G>>>8^W[(G^(128|x&63))&255];else if(x>=55296&&x<57344)x=(x&1023)+64,g=D.charCodeAt(R++)&1023,G=G>>>8^W[(G^(240|x>>8&7))&255],G=G>>>8^W[(G^(128|x>>2&63))&255],G=G>>>8^W[(G^(128|g>>6&15|(x&3)<<4))&255],G=G>>>8^W[(G^(128|g&63))&255];else G=G>>>8^W[(G^(224|x>>12&15))&255],G=G>>>8^W[(G^(128|x>>6&63))&255],G=G>>>8^W[(G^(128|x&63))&255];return~G}Q.table=W,Q.bstr=A,Q.buf=P,Q.str=T})});var C1=k((d7)=>{var EB=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function vB(Q,J){return Object.prototype.hasOwnProperty.call(Q,J)}d7.assign=function(Q){var J=Array.prototype.slice.call(arguments,1);while(J.length){var W=J.shift();if(!W)continue;if(typeof W!=="object")throw TypeError(W+"must be non-object");for(var V in W)if(vB(W,V))Q[V]=W[V]}return Q};d7.shrinkBuf=function(Q,J){if(Q.length===J)return Q;if(Q.subarray)return Q.subarray(0,J);return Q.length=J,Q};var kB={arraySet:function(Q,J,W,V,Y){if(J.subarray&&Q.subarray){Q.set(J.subarray(W,W+V),Y);return}for(var X=0;X<V;X++)Q[Y+X]=J[W+X]},flattenChunks:function(Q){var J,W,V,Y,X,q;V=0;for(J=0,W=Q.length;J<W;J++)V+=Q[J].length;q=new Uint8Array(V),Y=0;for(J=0,W=Q.length;J<W;J++)X=Q[J],q.set(X,Y),Y+=X.length;return q}},xB={arraySet:function(Q,J,W,V,Y){for(var X=0;X<V;X++)Q[Y+X]=J[W+X]},flattenChunks:function(Q){return[].concat.apply([],Q)}};d7.setTyped=function(Q){if(Q)d7.Buf8=Uint8Array,d7.Buf16=Uint16Array,d7.Buf32=Int32Array,d7.assign(d7,kB);else d7.Buf8=Array,d7.Buf16=Array,d7.Buf32=Array,d7.assign(d7,xB)};d7.setTyped(EB)});var f4=k((Wj)=>{var _B=C1(),yB=4,w4=0,L4=1,hB=2;function p6(Q){var J=Q.length;while(--J>=0)Q[J]=0}var gB=0,R4=1,pB=2,uB=3,mB=258,t7=29,E8=256,C8=E8+1+t7,g6=30,e7=19,T4=2*C8+1,V6=15,n7=16,fB=7,QQ=256,S4=16,E4=17,v4=18,s7=[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],t5=[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],cB=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k4=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],dB=512,R1=Array((C8+2)*2);p6(R1);var O8=Array(g6*2);p6(O8);var R8=Array(dB);p6(R8);var T8=Array(mB-uB+1);p6(T8);var JQ=Array(t7);p6(JQ);var e5=Array(g6);p6(e5);function o7(Q,J,W,V,Y){this.static_tree=Q,this.extra_bits=J,this.extra_base=W,this.elems=V,this.max_length=Y,this.has_stree=Q&&Q.length}var x4,b4,_4;function a7(Q,J){this.dyn_tree=Q,this.max_code=0,this.stat_desc=J}function y4(Q){return Q<256?R8[Q]:R8[256+(Q>>>7)]}function S8(Q,J){Q.pending_buf[Q.pending++]=J&255,Q.pending_buf[Q.pending++]=J>>>8&255}function k0(Q,J,W){if(Q.bi_valid>n7-W)Q.bi_buf|=J<<Q.bi_valid&65535,S8(Q,Q.bi_buf),Q.bi_buf=J>>n7-Q.bi_valid,Q.bi_valid+=W-n7;else Q.bi_buf|=J<<Q.bi_valid&65535,Q.bi_valid+=W}function B1(Q,J,W){k0(Q,W[J*2],W[J*2+1])}function h4(Q,J){var W=0;do W|=Q&1,Q>>>=1,W<<=1;while(--J>0);return W>>>1}function lB(Q){if(Q.bi_valid===16)S8(Q,Q.bi_buf),Q.bi_buf=0,Q.bi_valid=0;else if(Q.bi_valid>=8)Q.pending_buf[Q.pending++]=Q.bi_buf&255,Q.bi_buf>>=8,Q.bi_valid-=8}function nB(Q,J){var{dyn_tree:W,max_code:V}=J,Y=J.stat_desc.static_tree,X=J.stat_desc.has_stree,q=J.stat_desc.extra_bits,K=J.stat_desc.extra_base,z=J.stat_desc.max_length,$,Z,U,H,B,j,F=0;for(H=0;H<=V6;H++)Q.bl_count[H]=0;W[Q.heap[Q.heap_max]*2+1]=0;for($=Q.heap_max+1;$<T4;$++){if(Z=Q.heap[$],H=W[W[Z*2+1]*2+1]+1,H>z)H=z,F++;if(W[Z*2+1]=H,Z>V)continue;if(Q.bl_count[H]++,B=0,Z>=K)B=q[Z-K];if(j=W[Z*2],Q.opt_len+=j*(H+B),X)Q.static_len+=j*(Y[Z*2+1]+B)}if(F===0)return;do{H=z-1;while(Q.bl_count[H]===0)H--;Q.bl_count[H]--,Q.bl_count[H+1]+=2,Q.bl_count[z]--,F-=2}while(F>0);for(H=z;H!==0;H--){Z=Q.bl_count[H];while(Z!==0){if(U=Q.heap[--$],U>V)continue;if(W[U*2+1]!==H)Q.opt_len+=(H-W[U*2+1])*W[U*2],W[U*2+1]=H;Z--}}}function g4(Q,J,W){var V=Array(V6+1),Y=0,X,q;for(X=1;X<=V6;X++)V[X]=Y=Y+W[X-1]<<1;for(q=0;q<=J;q++){var K=Q[q*2+1];if(K===0)continue;Q[q*2]=h4(V[K]++,K)}}function oB(){var Q,J,W,V,Y,X=Array(V6+1);W=0;for(V=0;V<t7-1;V++){JQ[V]=W;for(Q=0;Q<1<<s7[V];Q++)T8[W++]=V}T8[W-1]=V,Y=0;for(V=0;V<16;V++){e5[V]=Y;for(Q=0;Q<1<<t5[V];Q++)R8[Y++]=V}Y>>=7;for(;V<g6;V++){e5[V]=Y<<7;for(Q=0;Q<1<<t5[V]-7;Q++)R8[256+Y++]=V}for(J=0;J<=V6;J++)X[J]=0;Q=0;while(Q<=143)R1[Q*2+1]=8,Q++,X[8]++;while(Q<=255)R1[Q*2+1]=9,Q++,X[9]++;while(Q<=279)R1[Q*2+1]=7,Q++,X[7]++;while(Q<=287)R1[Q*2+1]=8,Q++,X[8]++;g4(R1,C8+1,X);for(Q=0;Q<g6;Q++)O8[Q*2+1]=5,O8[Q*2]=h4(Q,5);x4=new o7(R1,s7,E8+1,C8,V6),b4=new o7(O8,t5,0,g6,V6),_4=new o7([],cB,0,e7,fB)}function p4(Q){var J;for(J=0;J<C8;J++)Q.dyn_ltree[J*2]=0;for(J=0;J<g6;J++)Q.dyn_dtree[J*2]=0;for(J=0;J<e7;J++)Q.bl_tree[J*2]=0;Q.dyn_ltree[QQ*2]=1,Q.opt_len=Q.static_len=0,Q.last_lit=Q.matches=0}function u4(Q){if(Q.bi_valid>8)S8(Q,Q.bi_buf);else if(Q.bi_valid>0)Q.pending_buf[Q.pending++]=Q.bi_buf;Q.bi_buf=0,Q.bi_valid=0}function aB(Q,J,W,V){if(u4(Q),V)S8(Q,W),S8(Q,~W);_B.arraySet(Q.pending_buf,Q.window,J,W,Q.pending),Q.pending+=W}function M4(Q,J,W,V){var Y=J*2,X=W*2;return Q[Y]<Q[X]||Q[Y]===Q[X]&&V[J]<=V[W]}function i7(Q,J,W){var V=Q.heap[W],Y=W<<1;while(Y<=Q.heap_len){if(Y<Q.heap_len&&M4(J,Q.heap[Y+1],Q.heap[Y],Q.depth))Y++;if(M4(J,V,Q.heap[Y],Q.depth))break;Q.heap[W]=Q.heap[Y],W=Y,Y<<=1}Q.heap[W]=V}function P4(Q,J,W){var V,Y,X=0,q,K;if(Q.last_lit!==0)do if(V=Q.pending_buf[Q.d_buf+X*2]<<8|Q.pending_buf[Q.d_buf+X*2+1],Y=Q.pending_buf[Q.l_buf+X],X++,V===0)B1(Q,Y,J);else{if(q=T8[Y],B1(Q,q+E8+1,J),K=s7[q],K!==0)Y-=JQ[q],k0(Q,Y,K);if(V--,q=y4(V),B1(Q,q,W),K=t5[q],K!==0)V-=e5[q],k0(Q,V,K)}while(X<Q.last_lit);B1(Q,QQ,J)}function r7(Q,J){var W=J.dyn_tree,V=J.stat_desc.static_tree,Y=J.stat_desc.has_stree,X=J.stat_desc.elems,q,K,z=-1,$;Q.heap_len=0,Q.heap_max=T4;for(q=0;q<X;q++)if(W[q*2]!==0)Q.heap[++Q.heap_len]=z=q,Q.depth[q]=0;else W[q*2+1]=0;while(Q.heap_len<2)if($=Q.heap[++Q.heap_len]=z<2?++z:0,W[$*2]=1,Q.depth[$]=0,Q.opt_len--,Y)Q.static_len-=V[$*2+1];J.max_code=z;for(q=Q.heap_len>>1;q>=1;q--)i7(Q,W,q);$=X;do q=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],i7(Q,W,1),K=Q.heap[1],Q.heap[--Q.heap_max]=q,Q.heap[--Q.heap_max]=K,W[$*2]=W[q*2]+W[K*2],Q.depth[$]=(Q.depth[q]>=Q.depth[K]?Q.depth[q]:Q.depth[K])+1,W[q*2+1]=W[K*2+1]=$,Q.heap[1]=$++,i7(Q,W,1);while(Q.heap_len>=2);Q.heap[--Q.heap_max]=Q.heap[1],nB(Q,J),g4(W,z,Q.bl_count)}function A4(Q,J,W){var V,Y=-1,X,q=J[1],K=0,z=7,$=4;if(q===0)z=138,$=3;J[(W+1)*2+1]=65535;for(V=0;V<=W;V++){if(X=q,q=J[(V+1)*2+1],++K<z&&X===q)continue;else if(K<$)Q.bl_tree[X*2]+=K;else if(X!==0){if(X!==Y)Q.bl_tree[X*2]++;Q.bl_tree[S4*2]++}else if(K<=10)Q.bl_tree[E4*2]++;else Q.bl_tree[v4*2]++;if(K=0,Y=X,q===0)z=138,$=3;else if(X===q)z=6,$=3;else z=7,$=4}}function O4(Q,J,W){var V,Y=-1,X,q=J[1],K=0,z=7,$=4;if(q===0)z=138,$=3;for(V=0;V<=W;V++){if(X=q,q=J[(V+1)*2+1],++K<z&&X===q)continue;else if(K<$)do B1(Q,X,Q.bl_tree);while(--K!==0);else if(X!==0){if(X!==Y)B1(Q,X,Q.bl_tree),K--;B1(Q,S4,Q.bl_tree),k0(Q,K-3,2)}else if(K<=10)B1(Q,E4,Q.bl_tree),k0(Q,K-3,3);else B1(Q,v4,Q.bl_tree),k0(Q,K-11,7);if(K=0,Y=X,q===0)z=138,$=3;else if(X===q)z=6,$=3;else z=7,$=4}}function iB(Q){var J;A4(Q,Q.dyn_ltree,Q.l_desc.max_code),A4(Q,Q.dyn_dtree,Q.d_desc.max_code),r7(Q,Q.bl_desc);for(J=e7-1;J>=3;J--)if(Q.bl_tree[k4[J]*2+1]!==0)break;return Q.opt_len+=3*(J+1)+5+5+4,J}function sB(Q,J,W,V){var Y;k0(Q,J-257,5),k0(Q,W-1,5),k0(Q,V-4,4);for(Y=0;Y<V;Y++)k0(Q,Q.bl_tree[k4[Y]*2+1],3);O4(Q,Q.dyn_ltree,J-1),O4(Q,Q.dyn_dtree,W-1)}function rB(Q){var J=4093624447,W;for(W=0;W<=31;W++,J>>>=1)if(J&1&&Q.dyn_ltree[W*2]!==0)return w4;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return L4;for(W=32;W<E8;W++)if(Q.dyn_ltree[W*2]!==0)return L4;return w4}var C4=!1;function tB(Q){if(!C4)oB(),C4=!0;Q.l_desc=new a7(Q.dyn_ltree,x4),Q.d_desc=new a7(Q.dyn_dtree,b4),Q.bl_desc=new a7(Q.bl_tree,_4),Q.bi_buf=0,Q.bi_valid=0,p4(Q)}function m4(Q,J,W,V){k0(Q,(gB<<1)+(V?1:0),3),aB(Q,J,W,!0)}function eB(Q){k0(Q,R4<<1,3),B1(Q,QQ,R1),lB(Q)}function Qj(Q,J,W,V){var Y,X,q=0;if(Q.level>0){if(Q.strm.data_type===hB)Q.strm.data_type=rB(Q);if(r7(Q,Q.l_desc),r7(Q,Q.d_desc),q=iB(Q),Y=Q.opt_len+3+7>>>3,X=Q.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=W+5;if(W+4<=Y&&J!==-1)m4(Q,J,W,V);else if(Q.strategy===yB||X===Y)k0(Q,(R4<<1)+(V?1:0),3),P4(Q,R1,O8);else k0(Q,(pB<<1)+(V?1:0),3),sB(Q,Q.l_desc.max_code+1,Q.d_desc.max_code+1,q+1),P4(Q,Q.dyn_ltree,Q.dyn_dtree);if(p4(Q),V)u4(Q)}function Jj(Q,J,W){if(Q.pending_buf[Q.d_buf+Q.last_lit*2]=J>>>8&255,Q.pending_buf[Q.d_buf+Q.last_lit*2+1]=J&255,Q.pending_buf[Q.l_buf+Q.last_lit]=W&255,Q.last_lit++,J===0)Q.dyn_ltree[W*2]++;else Q.matches++,J--,Q.dyn_ltree[(T8[W]+E8+1)*2]++,Q.dyn_dtree[y4(J)*2]++;return Q.last_lit===Q.lit_bufsize-1}Wj._tr_init=tB;Wj._tr_stored_block=m4;Wj._tr_flush_block=Qj;Wj._tr_tally=Jj;Wj._tr_align=eB});var WQ=k((wR,c4)=>{function Zj(Q,J,W,V){var Y=Q&65535|0,X=Q>>>16&65535|0,q=0;while(W!==0){q=W>2000?2000:W,W-=q;do Y=Y+J[V++]|0,X=X+Y|0;while(--q);Y%=65521,X%=65521}return Y|X<<16|0}c4.exports=Zj});var VQ=k((LR,d4)=>{function $j(){var Q,J=[];for(var W=0;W<256;W++){Q=W;for(var V=0;V<8;V++)Q=Q&1?3988292384^Q>>>1:Q>>>1;J[W]=Q}return J}var zj=$j();function Uj(Q,J,W,V){var Y=zj,X=V+W;Q^=-1;for(var q=V;q<X;q++)Q=Q>>>8^Y[(Q^J[q])&255];return Q^-1}d4.exports=Uj});var Q9=k((MR,l4)=>{l4.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 QX=k((dj)=>{var O0=C1(),s0=f4(),i4=WQ(),_1=VQ(),Hj=Q9(),K6=0,Bj=1,jj=3,u1=4,n4=5,F1=0,o4=1,r0=-2,Fj=-3,YQ=-5,Dj=-1,Nj=1,J9=2,Ij=3,Gj=4,wj=0,Lj=2,X9=8,Mj=9,Pj=15,Aj=8,Oj=29,Cj=256,qQ=Cj+1+Oj,Rj=30,Tj=19,Sj=2*qQ+1,Ej=15,a=3,g1=258,X1=g1+a+1,vj=32,q9=42,KQ=69,W9=73,V9=91,Y9=103,Y6=113,k8=666,j0=1,x8=2,X6=3,f6=4,kj=3;function p1(Q,J){return Q.msg=Hj[J],J}function a4(Q){return(Q<<1)-(Q>4?9:0)}function h1(Q){var J=Q.length;while(--J>=0)Q[J]=0}function y1(Q){var J=Q.state,W=J.pending;if(W>Q.avail_out)W=Q.avail_out;if(W===0)return;if(O0.arraySet(Q.output,J.pending_buf,J.pending_out,W,Q.next_out),Q.next_out+=W,J.pending_out+=W,Q.total_out+=W,Q.avail_out-=W,J.pending-=W,J.pending===0)J.pending_out=0}function I0(Q,J){s0._tr_flush_block(Q,Q.block_start>=0?Q.block_start:-1,Q.strstart-Q.block_start,J),Q.block_start=Q.strstart,y1(Q.strm)}function i(Q,J){Q.pending_buf[Q.pending++]=J}function v8(Q,J){Q.pending_buf[Q.pending++]=J>>>8&255,Q.pending_buf[Q.pending++]=J&255}function xj(Q,J,W,V){var Y=Q.avail_in;if(Y>V)Y=V;if(Y===0)return 0;if(Q.avail_in-=Y,O0.arraySet(J,Q.input,Q.next_in,Y,W),Q.state.wrap===1)Q.adler=i4(Q.adler,J,Y,W);else if(Q.state.wrap===2)Q.adler=_1(Q.adler,J,Y,W);return Q.next_in+=Y,Q.total_in+=Y,Y}function s4(Q,J){var{max_chain_length:W,strstart:V}=Q,Y,X,q=Q.prev_length,K=Q.nice_match,z=Q.strstart>Q.w_size-X1?Q.strstart-(Q.w_size-X1):0,$=Q.window,Z=Q.w_mask,U=Q.prev,H=Q.strstart+g1,B=$[V+q-1],j=$[V+q];if(Q.prev_length>=Q.good_match)W>>=2;if(K>Q.lookahead)K=Q.lookahead;do{if(Y=J,$[Y+q]!==j||$[Y+q-1]!==B||$[Y]!==$[V]||$[++Y]!==$[V+1])continue;V+=2,Y++;do;while($[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&$[++V]===$[++Y]&&V<H);if(X=g1-(H-V),V=H-g1,X>q){if(Q.match_start=J,q=X,X>=K)break;B=$[V+q-1],j=$[V+q]}}while((J=U[J&Z])>z&&--W!==0);if(q<=Q.lookahead)return q;return Q.lookahead}function q6(Q){var J=Q.w_size,W,V,Y,X,q;do{if(X=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=J+(J-X1)){O0.arraySet(Q.window,Q.window,J,J,0),Q.match_start-=J,Q.strstart-=J,Q.block_start-=J,V=Q.hash_size,W=V;do Y=Q.head[--W],Q.head[W]=Y>=J?Y-J:0;while(--V);V=J,W=V;do Y=Q.prev[--W],Q.prev[W]=Y>=J?Y-J:0;while(--V);X+=J}if(Q.strm.avail_in===0)break;if(V=xj(Q.strm,Q.window,Q.strstart+Q.lookahead,X),Q.lookahead+=V,Q.lookahead+Q.insert>=a){q=Q.strstart-Q.insert,Q.ins_h=Q.window[q],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[q+1])&Q.hash_mask;while(Q.insert)if(Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[q+a-1])&Q.hash_mask,Q.prev[q&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=q,q++,Q.insert--,Q.lookahead+Q.insert<a)break}}while(Q.lookahead<X1&&Q.strm.avail_in!==0)}function bj(Q,J){var W=65535;if(W>Q.pending_buf_size-5)W=Q.pending_buf_size-5;for(;;){if(Q.lookahead<=1){if(q6(Q),Q.lookahead===0&&J===K6)return j0;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var V=Q.block_start+W;if(Q.strstart===0||Q.strstart>=V){if(Q.lookahead=Q.strstart-V,Q.strstart=V,I0(Q,!1),Q.strm.avail_out===0)return j0}if(Q.strstart-Q.block_start>=Q.w_size-X1){if(I0(Q,!1),Q.strm.avail_out===0)return j0}}if(Q.insert=0,J===u1){if(I0(Q,!0),Q.strm.avail_out===0)return X6;return f6}if(Q.strstart>Q.block_start){if(I0(Q,!1),Q.strm.avail_out===0)return j0}return j0}function XQ(Q,J){var W,V;for(;;){if(Q.lookahead<X1){if(q6(Q),Q.lookahead<X1&&J===K6)return j0;if(Q.lookahead===0)break}if(W=0,Q.lookahead>=a)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+a-1])&Q.hash_mask,W=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(W!==0&&Q.strstart-W<=Q.w_size-X1)Q.match_length=s4(Q,W);if(Q.match_length>=a)if(V=s0._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-a),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=a){Q.match_length--;do Q.strstart++,Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+a-1])&Q.hash_mask,W=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.match_length!==0);Q.strstart++}else Q.strstart+=Q.match_length,Q.match_length=0,Q.ins_h=Q.window[Q.strstart],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+1])&Q.hash_mask;else V=s0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(V){if(I0(Q,!1),Q.strm.avail_out===0)return j0}}if(Q.insert=Q.strstart<a-1?Q.strstart:a-1,J===u1){if(I0(Q,!0),Q.strm.avail_out===0)return X6;return f6}if(Q.last_lit){if(I0(Q,!1),Q.strm.avail_out===0)return j0}return x8}function u6(Q,J){var W,V,Y;for(;;){if(Q.lookahead<X1){if(q6(Q),Q.lookahead<X1&&J===K6)return j0;if(Q.lookahead===0)break}if(W=0,Q.lookahead>=a)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+a-1])&Q.hash_mask,W=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(Q.prev_length=Q.match_length,Q.prev_match=Q.match_start,Q.match_length=a-1,W!==0&&Q.prev_length<Q.max_lazy_match&&Q.strstart-W<=Q.w_size-X1){if(Q.match_length=s4(Q,W),Q.match_length<=5&&(Q.strategy===Nj||Q.match_length===a&&Q.strstart-Q.match_start>4096))Q.match_length=a-1}if(Q.prev_length>=a&&Q.match_length<=Q.prev_length){Y=Q.strstart+Q.lookahead-a,V=s0._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-a),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;do if(++Q.strstart<=Y)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+a-1])&Q.hash_mask,W=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.prev_length!==0);if(Q.match_available=0,Q.match_length=a-1,Q.strstart++,V){if(I0(Q,!1),Q.strm.avail_out===0)return j0}}else if(Q.match_available){if(V=s0._tr_tally(Q,0,Q.window[Q.strstart-1]),V)I0(Q,!1);if(Q.strstart++,Q.lookahead--,Q.strm.avail_out===0)return j0}else Q.match_available=1,Q.strstart++,Q.lookahead--}if(Q.match_available)V=s0._tr_tally(Q,0,Q.window[Q.strstart-1]),Q.match_available=0;if(Q.insert=Q.strstart<a-1?Q.strstart:a-1,J===u1){if(I0(Q,!0),Q.strm.avail_out===0)return X6;return f6}if(Q.last_lit){if(I0(Q,!1),Q.strm.avail_out===0)return j0}return x8}function _j(Q,J){var W,V,Y,X,q=Q.window;for(;;){if(Q.lookahead<=g1){if(q6(Q),Q.lookahead<=g1&&J===K6)return j0;if(Q.lookahead===0)break}if(Q.match_length=0,Q.lookahead>=a&&Q.strstart>0){if(Y=Q.strstart-1,V=q[Y],V===q[++Y]&&V===q[++Y]&&V===q[++Y]){X=Q.strstart+g1;do;while(V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&V===q[++Y]&&Y<X);if(Q.match_length=g1-(X-Y),Q.match_length>Q.lookahead)Q.match_length=Q.lookahead}}if(Q.match_length>=a)W=s0._tr_tally(Q,1,Q.match_length-a),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0;else W=s0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(W){if(I0(Q,!1),Q.strm.avail_out===0)return j0}}if(Q.insert=0,J===u1){if(I0(Q,!0),Q.strm.avail_out===0)return X6;return f6}if(Q.last_lit){if(I0(Q,!1),Q.strm.avail_out===0)return j0}return x8}function yj(Q,J){var W;for(;;){if(Q.lookahead===0){if(q6(Q),Q.lookahead===0){if(J===K6)return j0;break}}if(Q.match_length=0,W=s0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,W){if(I0(Q,!1),Q.strm.avail_out===0)return j0}}if(Q.insert=0,J===u1){if(I0(Q,!0),Q.strm.avail_out===0)return X6;return f6}if(Q.last_lit){if(I0(Q,!1),Q.strm.avail_out===0)return j0}return x8}function j1(Q,J,W,V,Y){this.good_length=Q,this.max_lazy=J,this.nice_length=W,this.max_chain=V,this.func=Y}var m6;m6=[new j1(0,0,0,0,bj),new j1(4,4,8,4,XQ),new j1(4,5,16,8,XQ),new j1(4,6,32,32,XQ),new j1(4,4,16,16,u6),new j1(8,16,32,32,u6),new j1(8,16,128,128,u6),new j1(8,32,128,256,u6),new j1(32,128,258,1024,u6),new j1(32,258,258,4096,u6)];function hj(Q){Q.window_size=2*Q.w_size,h1(Q.head),Q.max_lazy_match=m6[Q.level].max_lazy,Q.good_match=m6[Q.level].good_length,Q.nice_match=m6[Q.level].nice_length,Q.max_chain_length=m6[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=a-1,Q.match_available=0,Q.ins_h=0}function gj(){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=X9,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 O0.Buf16(Sj*2),this.dyn_dtree=new O0.Buf16((2*Rj+1)*2),this.bl_tree=new O0.Buf16((2*Tj+1)*2),h1(this.dyn_ltree),h1(this.dyn_dtree),h1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new O0.Buf16(Ej+1),this.heap=new O0.Buf16(2*qQ+1),h1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new O0.Buf16(2*qQ+1),h1(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 r4(Q){var J;if(!Q||!Q.state)return p1(Q,r0);if(Q.total_in=Q.total_out=0,Q.data_type=Lj,J=Q.state,J.pending=0,J.pending_out=0,J.wrap<0)J.wrap=-J.wrap;return J.status=J.wrap?q9:Y6,Q.adler=J.wrap===2?0:1,J.last_flush=K6,s0._tr_init(J),F1}function t4(Q){var J=r4(Q);if(J===F1)hj(Q.state);return J}function pj(Q,J){if(!Q||!Q.state)return r0;if(Q.state.wrap!==2)return r0;return Q.state.gzhead=J,F1}function e4(Q,J,W,V,Y,X){if(!Q)return r0;var q=1;if(J===Dj)J=6;if(V<0)q=0,V=-V;else if(V>15)q=2,V-=16;if(Y<1||Y>Mj||W!==X9||V<8||V>15||J<0||J>9||X<0||X>Gj)return p1(Q,r0);if(V===8)V=9;var K=new gj;return Q.state=K,K.strm=Q,K.wrap=q,K.gzhead=null,K.w_bits=V,K.w_size=1<<K.w_bits,K.w_mask=K.w_size-1,K.hash_bits=Y+7,K.hash_size=1<<K.hash_bits,K.hash_mask=K.hash_size-1,K.hash_shift=~~((K.hash_bits+a-1)/a),K.window=new O0.Buf8(K.w_size*2),K.head=new O0.Buf16(K.hash_size),K.prev=new O0.Buf16(K.w_size),K.lit_bufsize=1<<Y+6,K.pending_buf_size=K.lit_bufsize*4,K.pending_buf=new O0.Buf8(K.pending_buf_size),K.d_buf=1*K.lit_bufsize,K.l_buf=3*K.lit_bufsize,K.level=J,K.strategy=X,K.method=W,t4(Q)}function uj(Q,J){return e4(Q,J,X9,Pj,Aj,wj)}function mj(Q,J){var W,V,Y,X;if(!Q||!Q.state||J>n4||J<0)return Q?p1(Q,r0):r0;if(V=Q.state,!Q.output||!Q.input&&Q.avail_in!==0||V.status===k8&&J!==u1)return p1(Q,Q.avail_out===0?YQ:r0);if(V.strm=Q,W=V.last_flush,V.last_flush=J,V.status===q9)if(V.wrap===2)if(Q.adler=0,i(V,31),i(V,139),i(V,8),!V.gzhead)i(V,0),i(V,0),i(V,0),i(V,0),i(V,0),i(V,V.level===9?2:V.strategy>=J9||V.level<2?4:0),i(V,kj),V.status=Y6;else{if(i(V,(V.gzhead.text?1:0)+(V.gzhead.hcrc?2:0)+(!V.gzhead.extra?0:4)+(!V.gzhead.name?0:8)+(!V.gzhead.comment?0:16)),i(V,V.gzhead.time&255),i(V,V.gzhead.time>>8&255),i(V,V.gzhead.time>>16&255),i(V,V.gzhead.time>>24&255),i(V,V.level===9?2:V.strategy>=J9||V.level<2?4:0),i(V,V.gzhead.os&255),V.gzhead.extra&&V.gzhead.extra.length)i(V,V.gzhead.extra.length&255),i(V,V.gzhead.extra.length>>8&255);if(V.gzhead.hcrc)Q.adler=_1(Q.adler,V.pending_buf,V.pending,0);V.gzindex=0,V.status=KQ}else{var q=X9+(V.w_bits-8<<4)<<8,K=-1;if(V.strategy>=J9||V.level<2)K=0;else if(V.level<6)K=1;else if(V.level===6)K=2;else K=3;if(q|=K<<6,V.strstart!==0)q|=vj;if(q+=31-q%31,V.status=Y6,v8(V,q),V.strstart!==0)v8(V,Q.adler>>>16),v8(V,Q.adler&65535);Q.adler=1}if(V.status===KQ)if(V.gzhead.extra){Y=V.pending;while(V.gzindex<(V.gzhead.extra.length&65535)){if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(y1(Q),Y=V.pending,V.pending===V.pending_buf_size)break}i(V,V.gzhead.extra[V.gzindex]&255),V.gzindex++}if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(V.gzindex===V.gzhead.extra.length)V.gzindex=0,V.status=W9}else V.status=W9;if(V.status===W9)if(V.gzhead.name){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(y1(Q),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.name.length)X=V.gzhead.name.charCodeAt(V.gzindex++)&255;else X=0;i(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.gzindex=0,V.status=V9}else V.status=V9;if(V.status===V9)if(V.gzhead.comment){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(y1(Q),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.comment.length)X=V.gzhead.comment.charCodeAt(V.gzindex++)&255;else X=0;i(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)Q.adler=_1(Q.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.status=Y9}else V.status=Y9;if(V.status===Y9)if(V.gzhead.hcrc){if(V.pending+2>V.pending_buf_size)y1(Q);if(V.pending+2<=V.pending_buf_size)i(V,Q.adler&255),i(V,Q.adler>>8&255),Q.adler=0,V.status=Y6}else V.status=Y6;if(V.pending!==0){if(y1(Q),Q.avail_out===0)return V.last_flush=-1,F1}else if(Q.avail_in===0&&a4(J)<=a4(W)&&J!==u1)return p1(Q,YQ);if(V.status===k8&&Q.avail_in!==0)return p1(Q,YQ);if(Q.avail_in!==0||V.lookahead!==0||J!==K6&&V.status!==k8){var z=V.strategy===J9?yj(V,J):V.strategy===Ij?_j(V,J):m6[V.level].func(V,J);if(z===X6||z===f6)V.status=k8;if(z===j0||z===X6){if(Q.avail_out===0)V.last_flush=-1;return F1}if(z===x8){if(J===Bj)s0._tr_align(V);else if(J!==n4){if(s0._tr_stored_block(V,0,0,!1),J===jj){if(h1(V.head),V.lookahead===0)V.strstart=0,V.block_start=0,V.insert=0}}if(y1(Q),Q.avail_out===0)return V.last_flush=-1,F1}}if(J!==u1)return F1;if(V.wrap<=0)return o4;if(V.wrap===2)i(V,Q.adler&255),i(V,Q.adler>>8&255),i(V,Q.adler>>16&255),i(V,Q.adler>>24&255),i(V,Q.total_in&255),i(V,Q.total_in>>8&255),i(V,Q.total_in>>16&255),i(V,Q.total_in>>24&255);else v8(V,Q.adler>>>16),v8(V,Q.adler&65535);if(y1(Q),V.wrap>0)V.wrap=-V.wrap;return V.pending!==0?F1:o4}function fj(Q){var J;if(!Q||!Q.state)return r0;if(J=Q.state.status,J!==q9&&J!==KQ&&J!==W9&&J!==V9&&J!==Y9&&J!==Y6&&J!==k8)return p1(Q,r0);return Q.state=null,J===Y6?p1(Q,Fj):F1}function cj(Q,J){var W=J.length,V,Y,X,q,K,z,$,Z;if(!Q||!Q.state)return r0;if(V=Q.state,q=V.wrap,q===2||q===1&&V.status!==q9||V.lookahead)return r0;if(q===1)Q.adler=i4(Q.adler,J,W,0);if(V.wrap=0,W>=V.w_size){if(q===0)h1(V.head),V.strstart=0,V.block_start=0,V.insert=0;Z=new O0.Buf8(V.w_size),O0.arraySet(Z,J,W-V.w_size,V.w_size,0),J=Z,W=V.w_size}K=Q.avail_in,z=Q.next_in,$=Q.input,Q.avail_in=W,Q.next_in=0,Q.input=J,q6(V);while(V.lookahead>=a){Y=V.strstart,X=V.lookahead-(a-1);do V.ins_h=(V.ins_h<<V.hash_shift^V.window[Y+a-1])&V.hash_mask,V.prev[Y&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=Y,Y++;while(--X);V.strstart=Y,V.lookahead=a-1,q6(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=a-1,V.match_available=0,Q.next_in=z,Q.input=$,Q.avail_in=K,V.wrap=q,F1}dj.deflateInit=uj;dj.deflateInit2=e4;dj.deflateReset=t4;dj.deflateResetKeep=r4;dj.deflateSetHeader=pj;dj.deflate=mj;dj.deflateEnd=fj;dj.deflateSetDictionary=cj;dj.deflateInfo="pako deflate (from Nodeca project)"});var ZQ=k((QF)=>{var K9=C1(),JX=!0,WX=!0;try{String.fromCharCode.apply(null,[0])}catch(Q){JX=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(Q){WX=!1}var b8=new K9.Buf8(256);for(D1=0;D1<256;D1++)b8[D1]=D1>=252?6:D1>=248?5:D1>=240?4:D1>=224?3:D1>=192?2:1;var D1;b8[254]=b8[254]=1;QF.string2buf=function(Q){var J,W,V,Y,X,q=Q.length,K=0;for(Y=0;Y<q;Y++){if(W=Q.charCodeAt(Y),(W&64512)===55296&&Y+1<q){if(V=Q.charCodeAt(Y+1),(V&64512)===56320)W=65536+(W-55296<<10)+(V-56320),Y++}K+=W<128?1:W<2048?2:W<65536?3:4}J=new K9.Buf8(K);for(X=0,Y=0;X<K;Y++){if(W=Q.charCodeAt(Y),(W&64512)===55296&&Y+1<q){if(V=Q.charCodeAt(Y+1),(V&64512)===56320)W=65536+(W-55296<<10)+(V-56320),Y++}if(W<128)J[X++]=W;else if(W<2048)J[X++]=192|W>>>6,J[X++]=128|W&63;else if(W<65536)J[X++]=224|W>>>12,J[X++]=128|W>>>6&63,J[X++]=128|W&63;else J[X++]=240|W>>>18,J[X++]=128|W>>>12&63,J[X++]=128|W>>>6&63,J[X++]=128|W&63}return J};function VX(Q,J){if(J<65534){if(Q.subarray&&WX||!Q.subarray&&JX)return String.fromCharCode.apply(null,K9.shrinkBuf(Q,J))}var W="";for(var V=0;V<J;V++)W+=String.fromCharCode(Q[V]);return W}QF.buf2binstring=function(Q){return VX(Q,Q.length)};QF.binstring2buf=function(Q){var J=new K9.Buf8(Q.length);for(var W=0,V=J.length;W<V;W++)J[W]=Q.charCodeAt(W);return J};QF.buf2string=function(Q,J){var W,V,Y,X,q=J||Q.length,K=Array(q*2);for(V=0,W=0;W<q;){if(Y=Q[W++],Y<128){K[V++]=Y;continue}if(X=b8[Y],X>4){K[V++]=65533,W+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&W<q)Y=Y<<6|Q[W++]&63,X--;if(X>1){K[V++]=65533;continue}if(Y<65536)K[V++]=Y;else Y-=65536,K[V++]=55296|Y>>10&1023,K[V++]=56320|Y&1023}return VX(K,V)};QF.utf8border=function(Q,J){var W;if(J=J||Q.length,J>Q.length)J=Q.length;W=J-1;while(W>=0&&(Q[W]&192)===128)W--;if(W<0)return J;if(W===0)return J;return W+b8[Q[W]]>J?W:J}});var $Q=k((OR,YX)=>{function qF(){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}YX.exports=qF});var ZX=k((jF)=>{var _8=QX(),y8=C1(),UQ=ZQ(),HQ=Q9(),KF=$Q(),KX=Object.prototype.toString,ZF=0,zQ=4,c6=0,XX=1,qX=2,$F=-1,zF=0,UF=8;function Z6(Q){if(!(this instanceof Z6))return new Z6(Q);this.options=y8.assign({level:$F,method:UF,chunkSize:16384,windowBits:15,memLevel:8,strategy:zF,to:""},Q||{});var J=this.options;if(J.raw&&J.windowBits>0)J.windowBits=-J.windowBits;else if(J.gzip&&J.windowBits>0&&J.windowBits<16)J.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KF,this.strm.avail_out=0;var W=_8.deflateInit2(this.strm,J.level,J.method,J.windowBits,J.memLevel,J.strategy);if(W!==c6)throw Error(HQ[W]);if(J.header)_8.deflateSetHeader(this.strm,J.header);if(J.dictionary){var V;if(typeof J.dictionary==="string")V=UQ.string2buf(J.dictionary);else if(KX.call(J.dictionary)==="[object ArrayBuffer]")V=new Uint8Array(J.dictionary);else V=J.dictionary;if(W=_8.deflateSetDictionary(this.strm,V),W!==c6)throw Error(HQ[W]);this._dict_set=!0}}Z6.prototype.push=function(Q,J){var W=this.strm,V=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=J===~~J?J:J===!0?zQ:ZF,typeof Q==="string")W.input=UQ.string2buf(Q);else if(KX.call(Q)==="[object ArrayBuffer]")W.input=new Uint8Array(Q);else W.input=Q;W.next_in=0,W.avail_in=W.input.length;do{if(W.avail_out===0)W.output=new y8.Buf8(V),W.next_out=0,W.avail_out=V;if(Y=_8.deflate(W,X),Y!==XX&&Y!==c6)return this.onEnd(Y),this.ended=!0,!1;if(W.avail_out===0||W.avail_in===0&&(X===zQ||X===qX))if(this.options.to==="string")this.onData(UQ.buf2binstring(y8.shrinkBuf(W.output,W.next_out)));else this.onData(y8.shrinkBuf(W.output,W.next_out))}while((W.avail_in>0||W.avail_out===0)&&Y!==XX);if(X===zQ)return Y=_8.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===c6;if(X===qX)return this.onEnd(c6),W.avail_out=0,!0;return!0};Z6.prototype.onData=function(Q){this.chunks.push(Q)};Z6.prototype.onEnd=function(Q){if(Q===c6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=y8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function BQ(Q,J){var W=new Z6(J);if(W.push(Q,!0),W.err)throw W.msg||HQ[W.err];return W.result}function HF(Q,J){return J=J||{},J.raw=!0,BQ(Q,J)}function BF(Q,J){return J=J||{},J.gzip=!0,BQ(Q,J)}jF.Deflate=Z6;jF.deflate=BQ;jF.deflateRaw=HF;jF.gzip=BF});var zX=k((RR,$X)=>{var Z9=30,GF=12;$X.exports=function(J,W){var V,Y,X,q,K,z,$,Z,U,H,B,j,F,I,L,N,O,A,P,T,D,M,G,R,C;V=J.state,Y=J.next_in,R=J.input,X=Y+(J.avail_in-5),q=J.next_out,C=J.output,K=q-(W-J.avail_out),z=q+(J.avail_out-257),$=V.dmax,Z=V.wsize,U=V.whave,H=V.wnext,B=V.window,j=V.hold,F=V.bits,I=V.lencode,L=V.distcode,N=(1<<V.lenbits)-1,O=(1<<V.distbits)-1;Q:do{if(F<15)j+=R[Y++]<<F,F+=8,j+=R[Y++]<<F,F+=8;A=I[j&N];J:for(;;){if(P=A>>>24,j>>>=P,F-=P,P=A>>>16&255,P===0)C[q++]=A&65535;else if(P&16){if(T=A&65535,P&=15,P){if(F<P)j+=R[Y++]<<F,F+=8;T+=j&(1<<P)-1,j>>>=P,F-=P}if(F<15)j+=R[Y++]<<F,F+=8,j+=R[Y++]<<F,F+=8;A=L[j&O];W:for(;;){if(P=A>>>24,j>>>=P,F-=P,P=A>>>16&255,P&16){if(D=A&65535,P&=15,F<P){if(j+=R[Y++]<<F,F+=8,F<P)j+=R[Y++]<<F,F+=8}if(D+=j&(1<<P)-1,D>$){J.msg="invalid distance too far back",V.mode=Z9;break Q}if(j>>>=P,F-=P,P=q-K,D>P){if(P=D-P,P>U){if(V.sane){J.msg="invalid distance too far back",V.mode=Z9;break Q}}if(M=0,G=B,H===0){if(M+=Z-P,P<T){T-=P;do C[q++]=B[M++];while(--P);M=q-D,G=C}}else if(H<P){if(M+=Z+H-P,P-=H,P<T){T-=P;do C[q++]=B[M++];while(--P);if(M=0,H<T){P=H,T-=P;do C[q++]=B[M++];while(--P);M=q-D,G=C}}}else if(M+=H-P,P<T){T-=P;do C[q++]=B[M++];while(--P);M=q-D,G=C}while(T>2)C[q++]=G[M++],C[q++]=G[M++],C[q++]=G[M++],T-=3;if(T){if(C[q++]=G[M++],T>1)C[q++]=G[M++]}}else{M=q-D;do C[q++]=C[M++],C[q++]=C[M++],C[q++]=C[M++],T-=3;while(T>2);if(T){if(C[q++]=C[M++],T>1)C[q++]=C[M++]}}}else if((P&64)===0){A=L[(A&65535)+(j&(1<<P)-1)];continue W}else{J.msg="invalid distance code",V.mode=Z9;break Q}break}}else if((P&64)===0){A=I[(A&65535)+(j&(1<<P)-1)];continue J}else if(P&32){V.mode=GF;break Q}else{J.msg="invalid literal/length code",V.mode=Z9;break Q}break}}while(Y<X&&q<z);T=F>>3,Y-=T,F-=T<<3,j&=(1<<F)-1,J.next_in=Y,J.next_out=q,J.avail_in=Y<X?5+(X-Y):5-(Y-X),J.avail_out=q<z?257+(z-q):257-(q-z),V.hold=j,V.bits=F;return}});var NX=k((TR,DX)=>{var UX=C1(),d6=15,HX=852,BX=592,jX=0,jQ=1,FX=2,wF=[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],LF=[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],MF=[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],PF=[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];DX.exports=function(J,W,V,Y,X,q,K,z){var $=z.bits,Z=0,U=0,H=0,B=0,j=0,F=0,I=0,L=0,N=0,O=0,A,P,T,D,M,G=null,R=0,C,x=new UX.Buf16(d6+1),g=new UX.Buf16(d6+1),m=null,s=0,o0,v0,g0;for(Z=0;Z<=d6;Z++)x[Z]=0;for(U=0;U<Y;U++)x[W[V+U]]++;j=$;for(B=d6;B>=1;B--)if(x[B]!==0)break;if(j>B)j=B;if(B===0)return X[q++]=20971520,X[q++]=20971520,z.bits=1,0;for(H=1;H<B;H++)if(x[H]!==0)break;if(j<H)j=H;L=1;for(Z=1;Z<=d6;Z++)if(L<<=1,L-=x[Z],L<0)return-1;if(L>0&&(J===jX||B!==1))return-1;g[1]=0;for(Z=1;Z<d6;Z++)g[Z+1]=g[Z]+x[Z];for(U=0;U<Y;U++)if(W[V+U]!==0)K[g[W[V+U]]++]=U;if(J===jX)G=m=K,C=19;else if(J===jQ)G=wF,R-=257,m=LF,s-=257,C=256;else G=MF,m=PF,C=-1;if(O=0,U=0,Z=H,M=q,F=j,I=0,T=-1,N=1<<j,D=N-1,J===jQ&&N>HX||J===FX&&N>BX)return 1;for(;;){if(o0=Z-I,K[U]<C)v0=0,g0=K[U];else if(K[U]>C)v0=m[s+K[U]],g0=G[R+K[U]];else v0=96,g0=0;A=1<<Z-I,P=1<<F,H=P;do P-=A,X[M+(O>>I)+P]=o0<<24|v0<<16|g0|0;while(P!==0);A=1<<Z-1;while(O&A)A>>=1;if(A!==0)O&=A-1,O+=A;else O=0;if(U++,--x[Z]===0){if(Z===B)break;Z=W[V+K[U]]}if(Z>j&&(O&D)!==T){if(I===0)I=j;M+=H,F=Z-I,L=1<<F;while(F+I<B){if(L-=x[F+I],L<=0)break;F++,L<<=1}if(N+=1<<F,J===jQ&&N>HX||J===FX&&N>BX)return 1;T=O&D,X[T]=j<<24|F<<16|M-q|0}}if(O!==0)X[M+O]=Z-I<<24|4194304|0;return z.bits=j,0}});var tX=k((fF)=>{var c0=C1(),wQ=WQ(),N1=VQ(),AF=zX(),h8=NX(),OF=0,cX=1,dX=2,IX=4,CF=5,$9=6,$6=0,RF=1,TF=2,t0=-2,lX=-3,LQ=-4,SF=-5,GX=8,nX=1,wX=2,LX=3,MX=4,PX=5,AX=6,OX=7,CX=8,RX=9,TX=10,H9=11,T1=12,FQ=13,SX=14,DQ=15,EX=16,vX=17,kX=18,xX=19,z9=20,U9=21,bX=22,_X=23,yX=24,hX=25,gX=26,NQ=27,pX=28,uX=29,W0=30,MQ=31,EF=32,vF=852,kF=592,xF=15,bF=xF;function mX(Q){return(Q>>>24&255)+(Q>>>8&65280)+((Q&65280)<<8)+((Q&255)<<24)}function _F(){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 c0.Buf16(320),this.work=new c0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function oX(Q){var J;if(!Q||!Q.state)return t0;if(J=Q.state,Q.total_in=Q.total_out=J.total=0,Q.msg="",J.wrap)Q.adler=J.wrap&1;return J.mode=nX,J.last=0,J.havedict=0,J.dmax=32768,J.head=null,J.hold=0,J.bits=0,J.lencode=J.lendyn=new c0.Buf32(vF),J.distcode=J.distdyn=new c0.Buf32(kF),J.sane=1,J.back=-1,$6}function aX(Q){var J;if(!Q||!Q.state)return t0;return J=Q.state,J.wsize=0,J.whave=0,J.wnext=0,oX(Q)}function iX(Q,J){var W,V;if(!Q||!Q.state)return t0;if(V=Q.state,J<0)W=0,J=-J;else if(W=(J>>4)+1,J<48)J&=15;if(J&&(J<8||J>15))return t0;if(V.window!==null&&V.wbits!==J)V.window=null;return V.wrap=W,V.wbits=J,aX(Q)}function sX(Q,J){var W,V;if(!Q)return t0;if(V=new _F,Q.state=V,V.window=null,W=iX(Q,J),W!==$6)Q.state=null;return W}function yF(Q){return sX(Q,bF)}var fX=!0,IQ,GQ;function hF(Q){if(fX){var J;IQ=new c0.Buf32(512),GQ=new c0.Buf32(32),J=0;while(J<144)Q.lens[J++]=8;while(J<256)Q.lens[J++]=9;while(J<280)Q.lens[J++]=7;while(J<288)Q.lens[J++]=8;h8(cX,Q.lens,0,288,IQ,0,Q.work,{bits:9}),J=0;while(J<32)Q.lens[J++]=5;h8(dX,Q.lens,0,32,GQ,0,Q.work,{bits:5}),fX=!1}Q.lencode=IQ,Q.lenbits=9,Q.distcode=GQ,Q.distbits=5}function rX(Q,J,W,V){var Y,X=Q.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new c0.Buf8(X.wsize);if(V>=X.wsize)c0.arraySet(X.window,J,W-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>V)Y=V;if(c0.arraySet(X.window,J,W-V,Y,X.wnext),V-=Y,V)c0.arraySet(X.window,J,W-V,V,0),X.wnext=V,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function gF(Q,J){var W,V,Y,X,q,K,z,$,Z,U,H,B,j,F,I=0,L,N,O,A,P,T,D,M,G=new c0.Buf8(4),R,C,x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Q||!Q.state||!Q.output||!Q.input&&Q.avail_in!==0)return t0;if(W=Q.state,W.mode===T1)W.mode=FQ;q=Q.next_out,Y=Q.output,z=Q.avail_out,X=Q.next_in,V=Q.input,K=Q.avail_in,$=W.hold,Z=W.bits,U=K,H=z,M=$6;Q:for(;;)switch(W.mode){case nX:if(W.wrap===0){W.mode=FQ;break}while(Z<16){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.wrap&2&&$===35615){W.check=0,G[0]=$&255,G[1]=$>>>8&255,W.check=N1(W.check,G,2,0),$=0,Z=0,W.mode=wX;break}if(W.flags=0,W.head)W.head.done=!1;if(!(W.wrap&1)||((($&255)<<8)+($>>8))%31){Q.msg="incorrect header check",W.mode=W0;break}if(($&15)!==GX){Q.msg="unknown compression method",W.mode=W0;break}if($>>>=4,Z-=4,D=($&15)+8,W.wbits===0)W.wbits=D;else if(D>W.wbits){Q.msg="invalid window size",W.mode=W0;break}W.dmax=1<<D,Q.adler=W.check=1,W.mode=$&512?TX:T1,$=0,Z=0;break;case wX:while(Z<16){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.flags=$,(W.flags&255)!==GX){Q.msg="unknown compression method",W.mode=W0;break}if(W.flags&57344){Q.msg="unknown header flags set",W.mode=W0;break}if(W.head)W.head.text=$>>8&1;if(W.flags&512)G[0]=$&255,G[1]=$>>>8&255,W.check=N1(W.check,G,2,0);$=0,Z=0,W.mode=LX;case LX:while(Z<32){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.head)W.head.time=$;if(W.flags&512)G[0]=$&255,G[1]=$>>>8&255,G[2]=$>>>16&255,G[3]=$>>>24&255,W.check=N1(W.check,G,4,0);$=0,Z=0,W.mode=MX;case MX:while(Z<16){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.head)W.head.xflags=$&255,W.head.os=$>>8;if(W.flags&512)G[0]=$&255,G[1]=$>>>8&255,W.check=N1(W.check,G,2,0);$=0,Z=0,W.mode=PX;case PX:if(W.flags&1024){while(Z<16){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.length=$,W.head)W.head.extra_len=$;if(W.flags&512)G[0]=$&255,G[1]=$>>>8&255,W.check=N1(W.check,G,2,0);$=0,Z=0}else if(W.head)W.head.extra=null;W.mode=AX;case AX:if(W.flags&1024){if(B=W.length,B>K)B=K;if(B){if(W.head){if(D=W.head.extra_len-W.length,!W.head.extra)W.head.extra=Array(W.head.extra_len);c0.arraySet(W.head.extra,V,X,B,D)}if(W.flags&512)W.check=N1(W.check,V,B,X);K-=B,X+=B,W.length-=B}if(W.length)break Q}W.length=0,W.mode=OX;case OX:if(W.flags&2048){if(K===0)break Q;B=0;do if(D=V[X+B++],W.head&&D&&W.length<65536)W.head.name+=String.fromCharCode(D);while(D&&B<K);if(W.flags&512)W.check=N1(W.check,V,B,X);if(K-=B,X+=B,D)break Q}else if(W.head)W.head.name=null;W.length=0,W.mode=CX;case CX:if(W.flags&4096){if(K===0)break Q;B=0;do if(D=V[X+B++],W.head&&D&&W.length<65536)W.head.comment+=String.fromCharCode(D);while(D&&B<K);if(W.flags&512)W.check=N1(W.check,V,B,X);if(K-=B,X+=B,D)break Q}else if(W.head)W.head.comment=null;W.mode=RX;case RX:if(W.flags&512){while(Z<16){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if($!==(W.check&65535)){Q.msg="header crc mismatch",W.mode=W0;break}$=0,Z=0}if(W.head)W.head.hcrc=W.flags>>9&1,W.head.done=!0;Q.adler=W.check=0,W.mode=T1;break;case TX:while(Z<32){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}Q.adler=W.check=mX($),$=0,Z=0,W.mode=H9;case H9:if(W.havedict===0)return Q.next_out=q,Q.avail_out=z,Q.next_in=X,Q.avail_in=K,W.hold=$,W.bits=Z,TF;Q.adler=W.check=1,W.mode=T1;case T1:if(J===CF||J===$9)break Q;case FQ:if(W.last){$>>>=Z&7,Z-=Z&7,W.mode=NQ;break}while(Z<3){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}switch(W.last=$&1,$>>>=1,Z-=1,$&3){case 0:W.mode=SX;break;case 1:if(hF(W),W.mode=z9,J===$9){$>>>=2,Z-=2;break Q}break;case 2:W.mode=vX;break;case 3:Q.msg="invalid block type",W.mode=W0}$>>>=2,Z-=2;break;case SX:$>>>=Z&7,Z-=Z&7;while(Z<32){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(($&65535)!==($>>>16^65535)){Q.msg="invalid stored block lengths",W.mode=W0;break}if(W.length=$&65535,$=0,Z=0,W.mode=DQ,J===$9)break Q;case DQ:W.mode=EX;case EX:if(B=W.length,B){if(B>K)B=K;if(B>z)B=z;if(B===0)break Q;c0.arraySet(Y,V,X,B,q),K-=B,X+=B,z-=B,q+=B,W.length-=B;break}W.mode=T1;break;case vX:while(Z<14){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(W.nlen=($&31)+257,$>>>=5,Z-=5,W.ndist=($&31)+1,$>>>=5,Z-=5,W.ncode=($&15)+4,$>>>=4,Z-=4,W.nlen>286||W.ndist>30){Q.msg="too many length or distance symbols",W.mode=W0;break}W.have=0,W.mode=kX;case kX:while(W.have<W.ncode){while(Z<3){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}W.lens[x[W.have++]]=$&7,$>>>=3,Z-=3}while(W.have<19)W.lens[x[W.have++]]=0;if(W.lencode=W.lendyn,W.lenbits=7,R={bits:W.lenbits},M=h8(OF,W.lens,0,19,W.lencode,0,W.work,R),W.lenbits=R.bits,M){Q.msg="invalid code lengths set",W.mode=W0;break}W.have=0,W.mode=xX;case xX:while(W.have<W.nlen+W.ndist){for(;;){if(I=W.lencode[$&(1<<W.lenbits)-1],L=I>>>24,N=I>>>16&255,O=I&65535,L<=Z)break;if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(O<16)$>>>=L,Z-=L,W.lens[W.have++]=O;else{if(O===16){C=L+2;while(Z<C){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if($>>>=L,Z-=L,W.have===0){Q.msg="invalid bit length repeat",W.mode=W0;break}D=W.lens[W.have-1],B=3+($&3),$>>>=2,Z-=2}else if(O===17){C=L+3;while(Z<C){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}$>>>=L,Z-=L,D=0,B=3+($&7),$>>>=3,Z-=3}else{C=L+7;while(Z<C){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}$>>>=L,Z-=L,D=0,B=11+($&127),$>>>=7,Z-=7}if(W.have+B>W.nlen+W.ndist){Q.msg="invalid bit length repeat",W.mode=W0;break}while(B--)W.lens[W.have++]=D}}if(W.mode===W0)break;if(W.lens[256]===0){Q.msg="invalid code -- missing end-of-block",W.mode=W0;break}if(W.lenbits=9,R={bits:W.lenbits},M=h8(cX,W.lens,0,W.nlen,W.lencode,0,W.work,R),W.lenbits=R.bits,M){Q.msg="invalid literal/lengths set",W.mode=W0;break}if(W.distbits=6,W.distcode=W.distdyn,R={bits:W.distbits},M=h8(dX,W.lens,W.nlen,W.ndist,W.distcode,0,W.work,R),W.distbits=R.bits,M){Q.msg="invalid distances set",W.mode=W0;break}if(W.mode=z9,J===$9)break Q;case z9:W.mode=U9;case U9:if(K>=6&&z>=258){if(Q.next_out=q,Q.avail_out=z,Q.next_in=X,Q.avail_in=K,W.hold=$,W.bits=Z,AF(Q,H),q=Q.next_out,Y=Q.output,z=Q.avail_out,X=Q.next_in,V=Q.input,K=Q.avail_in,$=W.hold,Z=W.bits,W.mode===T1)W.back=-1;break}W.back=0;for(;;){if(I=W.lencode[$&(1<<W.lenbits)-1],L=I>>>24,N=I>>>16&255,O=I&65535,L<=Z)break;if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if(N&&(N&240)===0){A=L,P=N,T=O;for(;;){if(I=W.lencode[T+(($&(1<<A+P)-1)>>A)],L=I>>>24,N=I>>>16&255,O=I&65535,A+L<=Z)break;if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}$>>>=A,Z-=A,W.back+=A}if($>>>=L,Z-=L,W.back+=L,W.length=O,N===0){W.mode=gX;break}if(N&32){W.back=-1,W.mode=T1;break}if(N&64){Q.msg="invalid literal/length code",W.mode=W0;break}W.extra=N&15,W.mode=bX;case bX:if(W.extra){C=W.extra;while(Z<C){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}W.length+=$&(1<<W.extra)-1,$>>>=W.extra,Z-=W.extra,W.back+=W.extra}W.was=W.length,W.mode=_X;case _X:for(;;){if(I=W.distcode[$&(1<<W.distbits)-1],L=I>>>24,N=I>>>16&255,O=I&65535,L<=Z)break;if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if((N&240)===0){A=L,P=N,T=O;for(;;){if(I=W.distcode[T+(($&(1<<A+P)-1)>>A)],L=I>>>24,N=I>>>16&255,O=I&65535,A+L<=Z)break;if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}$>>>=A,Z-=A,W.back+=A}if($>>>=L,Z-=L,W.back+=L,N&64){Q.msg="invalid distance code",W.mode=W0;break}W.offset=O,W.extra=N&15,W.mode=yX;case yX:if(W.extra){C=W.extra;while(Z<C){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}W.offset+=$&(1<<W.extra)-1,$>>>=W.extra,Z-=W.extra,W.back+=W.extra}if(W.offset>W.dmax){Q.msg="invalid distance too far back",W.mode=W0;break}W.mode=hX;case hX:if(z===0)break Q;if(B=H-z,W.offset>B){if(B=W.offset-B,B>W.whave){if(W.sane){Q.msg="invalid distance too far back",W.mode=W0;break}}if(B>W.wnext)B-=W.wnext,j=W.wsize-B;else j=W.wnext-B;if(B>W.length)B=W.length;F=W.window}else F=Y,j=q-W.offset,B=W.length;if(B>z)B=z;z-=B,W.length-=B;do Y[q++]=F[j++];while(--B);if(W.length===0)W.mode=U9;break;case gX:if(z===0)break Q;Y[q++]=W.length,z--,W.mode=U9;break;case NQ:if(W.wrap){while(Z<32){if(K===0)break Q;K--,$|=V[X++]<<Z,Z+=8}if(H-=z,Q.total_out+=H,W.total+=H,H)Q.adler=W.check=W.flags?N1(W.check,Y,H,q-H):wQ(W.check,Y,H,q-H);if(H=z,(W.flags?$:mX($))!==W.check){Q.msg="incorrect data check",W.mode=W0;break}$=0,Z=0}W.mode=pX;case pX:if(W.wrap&&W.flags){while(Z<32){if(K===0)break Q;K--,$+=V[X++]<<Z,Z+=8}if($!==(W.total&4294967295)){Q.msg="incorrect length check",W.mode=W0;break}$=0,Z=0}W.mode=uX;case uX:M=RF;break Q;case W0:M=lX;break Q;case MQ:return LQ;case EF:default:return t0}if(Q.next_out=q,Q.avail_out=z,Q.next_in=X,Q.avail_in=K,W.hold=$,W.bits=Z,W.wsize||H!==Q.avail_out&&W.mode<W0&&(W.mode<NQ||J!==IX)){if(rX(Q,Q.output,Q.next_out,H-Q.avail_out))return W.mode=MQ,LQ}if(U-=Q.avail_in,H-=Q.avail_out,Q.total_in+=U,Q.total_out+=H,W.total+=H,W.wrap&&H)Q.adler=W.check=W.flags?N1(W.check,Y,H,Q.next_out-H):wQ(W.check,Y,H,Q.next_out-H);if(Q.data_type=W.bits+(W.last?64:0)+(W.mode===T1?128:0)+(W.mode===z9||W.mode===DQ?256:0),(U===0&&H===0||J===IX)&&M===$6)M=SF;return M}function pF(Q){if(!Q||!Q.state)return t0;var J=Q.state;if(J.window)J.window=null;return Q.state=null,$6}function uF(Q,J){var W;if(!Q||!Q.state)return t0;if(W=Q.state,(W.wrap&2)===0)return t0;return W.head=J,J.done=!1,$6}function mF(Q,J){var W=J.length,V,Y,X;if(!Q||!Q.state)return t0;if(V=Q.state,V.wrap!==0&&V.mode!==H9)return t0;if(V.mode===H9){if(Y=1,Y=wQ(Y,J,W,0),Y!==V.check)return lX}if(X=rX(Q,J,W,W),X)return V.mode=MQ,LQ;return V.havedict=1,$6}fF.inflateReset=aX;fF.inflateReset2=iX;fF.inflateResetKeep=oX;fF.inflateInit=yF;fF.inflateInit2=sX;fF.inflate=gF;fF.inflateEnd=pF;fF.inflateGetHeader=uF;fF.inflateSetDictionary=mF;fF.inflateInfo="pako inflate (from Nodeca project)"});var PQ=k((ER,eX)=>{eX.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 Jq=k((vR,Qq)=>{function eF(){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}Qq.exports=eF});var Vq=k((VD)=>{var l6=tX(),g8=C1(),B9=ZQ(),Z0=PQ(),AQ=Q9(),QD=$Q(),JD=Jq(),Wq=Object.prototype.toString;function z6(Q){if(!(this instanceof z6))return new z6(Q);this.options=g8.assign({chunkSize:16384,windowBits:0,to:""},Q||{});var J=this.options;if(J.raw&&J.windowBits>=0&&J.windowBits<16){if(J.windowBits=-J.windowBits,J.windowBits===0)J.windowBits=-15}if(J.windowBits>=0&&J.windowBits<16&&!(Q&&Q.windowBits))J.windowBits+=32;if(J.windowBits>15&&J.windowBits<48){if((J.windowBits&15)===0)J.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new QD,this.strm.avail_out=0;var W=l6.inflateInit2(this.strm,J.windowBits);if(W!==Z0.Z_OK)throw Error(AQ[W]);if(this.header=new JD,l6.inflateGetHeader(this.strm,this.header),J.dictionary){if(typeof J.dictionary==="string")J.dictionary=B9.string2buf(J.dictionary);else if(Wq.call(J.dictionary)==="[object ArrayBuffer]")J.dictionary=new Uint8Array(J.dictionary);if(J.raw){if(W=l6.inflateSetDictionary(this.strm,J.dictionary),W!==Z0.Z_OK)throw Error(AQ[W])}}}z6.prototype.push=function(Q,J){var W=this.strm,V=this.options.chunkSize,Y=this.options.dictionary,X,q,K,z,$,Z=!1;if(this.ended)return!1;if(q=J===~~J?J:J===!0?Z0.Z_FINISH:Z0.Z_NO_FLUSH,typeof Q==="string")W.input=B9.binstring2buf(Q);else if(Wq.call(Q)==="[object ArrayBuffer]")W.input=new Uint8Array(Q);else W.input=Q;W.next_in=0,W.avail_in=W.input.length;do{if(W.avail_out===0)W.output=new g8.Buf8(V),W.next_out=0,W.avail_out=V;if(X=l6.inflate(W,Z0.Z_NO_FLUSH),X===Z0.Z_NEED_DICT&&Y)X=l6.inflateSetDictionary(this.strm,Y);if(X===Z0.Z_BUF_ERROR&&Z===!0)X=Z0.Z_OK,Z=!1;if(X!==Z0.Z_STREAM_END&&X!==Z0.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(W.next_out){if(W.avail_out===0||X===Z0.Z_STREAM_END||W.avail_in===0&&(q===Z0.Z_FINISH||q===Z0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(K=B9.utf8border(W.output,W.next_out),z=W.next_out-K,$=B9.buf2string(W.output,K),W.next_out=z,W.avail_out=V-z,z)g8.arraySet(W.output,W.output,K,z,0);this.onData($)}else this.onData(g8.shrinkBuf(W.output,W.next_out))}if(W.avail_in===0&&W.avail_out===0)Z=!0}while((W.avail_in>0||W.avail_out===0)&&X!==Z0.Z_STREAM_END);if(X===Z0.Z_STREAM_END)q=Z0.Z_FINISH;if(q===Z0.Z_FINISH)return X=l6.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===Z0.Z_OK;if(q===Z0.Z_SYNC_FLUSH)return this.onEnd(Z0.Z_OK),W.avail_out=0,!0;return!0};z6.prototype.onData=function(Q){this.chunks.push(Q)};z6.prototype.onEnd=function(Q){if(Q===Z0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=g8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function OQ(Q,J){var W=new z6(J);if(W.push(Q,!0),W.err)throw W.msg||AQ[W.err];return W.result}function WD(Q,J){return J=J||{},J.raw=!0,OQ(Q,J)}VD.Inflate=z6;VD.inflate=OQ;VD.inflateRaw=WD;VD.ungzip=OQ});var qq=k((xR,Xq)=>{var ZD=C1().assign,$D=ZX(),zD=Vq(),UD=PQ(),Yq={};ZD(Yq,$D,zD,UD);Xq.exports=Yq});var $q=k((bR,Zq)=>{var Kq=(Q,J)=>function(...W){return new J.promiseModule((Y,X)=>{if(J.multiArgs)W.push((...q)=>{if(J.errorFirst)if(q[0])X(q);else q.shift(),Y(q);else Y(q)});else if(J.errorFirst)W.push((q,K)=>{if(q)X(q);else Y(K)});else W.push(Y);Q.apply(this,W)})};Zq.exports=(Q,J)=>{J=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},J);let W=typeof Q;if(!(Q!==null&&(W==="object"||W==="function")))throw TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${Q===null?"null":W}\``);let V=(X)=>{let q=(K)=>typeof K==="string"?X===K:K.test(X);return J.include?J.include.some(q):!J.exclude.some(q)},Y;if(W==="function")Y=function(...X){return J.excludeMain?Q(...X):Kq(Q,J).apply(this,X)};else Y=Object.create(Object.getPrototypeOf(Q));for(let X in Q){let q=Q[X];Y[X]=typeof q==="function"&&V(X)?Kq(q,J):q}return Y}});var wq=k((_R,Gq)=>{function zq(Q){return Array.isArray(Q)?Q:[Q]}var TQ="",Uq=" ",CQ="\\",HD=/^\s+$/,BD=/(?:[^\\]|^)\\$/,jD=/^\\!/,FD=/^\\#/,DD=/\r?\n/g,ND=/^\.*\/|^\.+$/,RQ="/",jq="node-ignore";if(typeof Symbol<"u")jq=Symbol.for("node-ignore");var Hq=jq,ID=(Q,J,W)=>Object.defineProperty(Q,J,{value:W}),GD=/([0-z])-([0-z])/g,Fq=()=>!1,wD=(Q)=>Q.replace(GD,(J,W,V)=>W.charCodeAt(0)<=V.charCodeAt(0)?J:TQ),LD=(Q)=>{let{length:J}=Q;return Q.slice(0,J-J%2)},MD=[[/^\uFEFF/,()=>TQ],[/((?:\\\\)*?)(\\?\s+)$/,(Q,J,W)=>J+(W.indexOf("\\")===0?Uq:TQ)],[/(\\+?)\s/g,(Q,J)=>{let{length:W}=J;return J.slice(0,W-W%2)+Uq}],[/[\\$.|*+(){^]/g,(Q)=>`\\${Q}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(Q,J,W)=>J+6<W.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(Q,J,W)=>{let V=W.replace(/\\\*/g,"[^\\/]*");return J+V}],[/\\\\\\(?=[$.|*+(){^])/g,()=>CQ],[/\\\\/g,()=>CQ],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(Q,J,W,V,Y)=>J===CQ?`\\[${W}${LD(V)}${Y}`:Y==="]"?V.length%2===0?`[${wD(W)}${V}]`:"[]":"[]"],[/(?:[^*])$/,(Q)=>/\/$/.test(Q)?`${Q}$`:`${Q}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(Q,J)=>{return`${J?`${J}[^/]+`:"[^/]*"}(?=$|\\/$)`}]],Bq=Object.create(null),PD=(Q,J)=>{let W=Bq[Q];if(!W)W=MD.reduce((V,[Y,X])=>V.replace(Y,X.bind(Q)),Q),Bq[Q]=W;return J?new RegExp(W,"i"):new RegExp(W)},SQ=(Q)=>typeof Q==="string",AD=(Q)=>Q&&SQ(Q)&&!HD.test(Q)&&!BD.test(Q)&&Q.indexOf("#")!==0,OD=(Q)=>Q.split(DD);class Dq{constructor(Q,J,W,V){this.origin=Q,this.pattern=J,this.negative=W,this.regex=V}}var CD=(Q,J)=>{let W=Q,V=!1;if(Q.indexOf("!")===0)V=!0,Q=Q.substr(1);Q=Q.replace(jD,"!").replace(FD,"#");let Y=PD(Q,J);return new Dq(W,Q,V,Y)},RD=(Q,J)=>{throw new J(Q)},S1=(Q,J,W)=>{if(!SQ(Q))return W(`path must be a string, but got \`${J}\``,TypeError);if(!Q)return W("path must not be empty",TypeError);if(S1.isNotRelative(Q))return W(`path should be a \`path.relative()\`d string, but got "${J}"`,RangeError);return!0},Nq=(Q)=>ND.test(Q);S1.isNotRelative=Nq;S1.convert=(Q)=>Q;class Iq{constructor({ignorecase:Q=!0,ignoreCase:J=Q,allowRelativePaths:W=!1}={}){ID(this,Hq,!0),this._rules=[],this._ignoreCase=J,this._allowRelativePaths=W,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(Q){if(Q&&Q[Hq]){this._rules=this._rules.concat(Q._rules),this._added=!0;return}if(AD(Q)){let J=CD(Q,this._ignoreCase);this._added=!0,this._rules.push(J)}}add(Q){if(this._added=!1,zq(SQ(Q)?OD(Q):Q).forEach(this._addPattern,this),this._added)this._initCache();return this}addPattern(Q){return this.add(Q)}_testOne(Q,J){let W=!1,V=!1;return this._rules.forEach((Y)=>{let{negative:X}=Y;if(V===X&&W!==V||X&&!W&&!V&&!J)return;if(Y.regex.test(Q))W=!X,V=X}),{ignored:W,unignored:V}}_test(Q,J,W,V){let Y=Q&&S1.convert(Q);return S1(Y,Q,this._allowRelativePaths?Fq:RD),this._t(Y,J,W,V)}_t(Q,J,W,V){if(Q in J)return J[Q];if(!V)V=Q.split(RQ);if(V.pop(),!V.length)return J[Q]=this._testOne(Q,W);let Y=this._t(V.join(RQ)+RQ,J,W,V);return J[Q]=Y.ignored?Y:this._testOne(Q,W)}ignores(Q){return this._test(Q,this._ignoreCache,!1).ignored}createFilter(){return(Q)=>!this.ignores(Q)}filter(Q){return zq(Q).filter(this.createFilter())}test(Q){return this._test(Q,this._testCache,!0)}}var j9=(Q)=>new Iq(Q),TD=(Q)=>S1(Q&&S1.convert(Q),Q,Fq);j9.isPathValid=TD;j9.default=j9;Gq.exports=j9;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let Q=(W)=>/^\\\\\?\\/.test(W)||/["<>|\u0000-\u001F]+/u.test(W)?W:W.replace(/\\/g,"/");S1.convert=Q;let J=/^[a-z]:\//i;S1.isNotRelative=(W)=>J.test(W)||Nq(W)}});var Mq=k((yR,Lq)=>{function SD(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I1(Q,J,W){return J=J instanceof RegExp?J:new RegExp(SD(J),"g"),Q.replace(J,W)}var ED={clean:function(J){if(typeof J!=="string")throw Error("Expected a string, received: "+J);return J=I1(J,"./","/"),J=I1(J,"..","."),J=I1(J," ","-"),J=I1(J,/^[~^:?*\\\-]/g,""),J=I1(J,/[~^:?*\\]/g,"-"),J=I1(J,/[~^:?*\\\-]$/g,""),J=I1(J,"@{","-"),J=I1(J,/\.$/g,""),J=I1(J,/\/$/g,""),J=I1(J,/\.lock$/g,""),J}};Lq.exports=ED});var Aq=k((hR,Pq)=>{Pq.exports=function(Q,J){var W=Q,V=J,Y=W.length,X=V.length,q=!1,K=null,z=Y+1,$=[],Z=[],U=[],H="",B=-1,j=0,F=1,I,L,N=function(){if(Y>=X)I=W,L=Y,W=V,V=I,Y=X,X=L,q=!0,z=Y+1},O=function(D,M,G){return{x:D,y:M,k:G}},A=function(D,M){return{elem:D,t:M}},P=function(D,M,G){var R,C,x;if(M>G)R=$[D-1+z];else R=$[D+1+z];x=Math.max(M,G),C=x-D;while(C<Y&&x<X&&W[C]===V[x])++C,++x;return $[D+z]=Z.length,Z[Z.length]=new O(C,x,R),x},T=function(D){var M,G,R,C,x;M=G=1,R=C=0;for(x=D.length-1;x>=0;--x)while(R<D[x].x||C<D[x].y)if(D[x].y-D[x].x>C-R){if(q)U[U.length]=new A(V[C],B);else U[U.length]=new A(V[C],F);++G,++C}else if(D[x].y-D[x].x<C-R){if(q)U[U.length]=new A(W[R],F);else U[U.length]=new A(W[R],B);++M,++R}else U[U.length]=new A(W[R],j),H+=W[R],++M,++G,++R,++C};return N(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return K},getlcs:function(){return H},getses:function(){return U},compose:function(){var D,M,G,R,C,x,g,m;D=X-Y,M=Y+X+3,G={};for(g=0;g<M;++g)G[g]=-1,$[g]=-1;R=-1;do{++R;for(m=-R;m<=D-1;++m)G[m+z]=P(m,G[m-1+z]+1,G[m+1+z]);for(m=D+R;m>=D+1;--m)G[m+z]=P(m,G[m-1+z]+1,G[m+1+z]);G[D+z]=P(D,G[D-1+z]+1,G[D+1+z])}while(G[D+z]!==X);K=D+2*R,C=$[D+z],x=[];while(C!==-1)x[x.length]=new O(Z[C].x,Z[C].y,null),C=Z[C].k;T(x)}}}});var Rq=k((gR,Cq)=>{var vD=Aq();function kD(Q,J){var W=new vD(Q,J);W.compose();var V=W.getses(),Y,X,q=Q.length-1,K=J.length-1;for(var z=V.length-1;z>=0;--z)if(V[z].t===W.SES_COMMON){if(X)X.chain={file1index:q,file2index:K,chain:null},X=X.chain;else Y={file1index:q,file2index:K,chain:null},X=Y;q--,K--}else if(V[z].t===W.SES_DELETE)q--;else if(V[z].t===W.SES_ADD)K--;var $={file1index:-1,file2index:-1,chain:null};if(!X)return $;return X.chain=$,Y}function Oq(Q,J){var W=[],V=Q.length,Y=J.length;for(var X=kD(Q,J);X!==null;X=X.chain){var q=V-X.file1index-1,K=Y-X.file2index-1;if(V=X.file1index,Y=X.file2index,q||K)W.push({file1:[V+1,q],file2:[Y+1,K]})}return W.reverse(),W}function xD(Q,J,W){var V,Y=Oq(J,Q),X=Oq(J,W),q=[];function K(g,m){q.push([g.file1[0],m,g.file1[1],g.file2[0],g.file2[1]])}for(V=0;V<Y.length;V++)K(Y[V],0);for(V=0;V<X.length;V++)K(X[V],2);q.sort(function(g,m){return g[0]-m[0]});var z=[],$=0;function Z(g){if(g>$)z.push([1,$,g-$]),$=g}for(var U=0;U<q.length;U++){var H=U,B=q[U],j=B[0],F=j+B[2];while(U<q.length-1){var I=q[U+1],L=I[0];if(L>F)break;F=Math.max(F,L+I[2]),U++}if(Z(j),H==U){if(B[4]>0)z.push([B[1],B[3],B[4]])}else{var N={0:[Q.length,-1,J.length,-1],2:[W.length,-1,J.length,-1]};for(V=H;V<=U;V++){B=q[V];var O=B[1],A=N[O],P=B[0],T=P+B[2],D=B[3],M=D+B[4];A[0]=Math.min(D,A[0]),A[1]=Math.max(M,A[1]),A[2]=Math.min(P,A[2]),A[3]=Math.max(T,A[3])}var G=N[0][0]+(j-N[0][2]),R=N[0][1]+(F-N[0][3]),C=N[2][0]+(j-N[2][2]),x=N[2][1]+(F-N[2][3]);z.push([-1,G,R-G,j,F-j,C,x-C])}$=F}return Z(J.length),z}function bD(Q,J,W){var V=[],Y=[Q,J,W],X=xD(Q,J,W),q=[];function K(){if(q.length)V.push({ok:q});q=[]}function z(B){for(var j=0;j<B.length;j++)q.push(B[j])}function $(B){if(B[2]!=B[6])return!0;var j=B[1],F=B[5];for(var I=0;I<B[2];I++)if(Q[I+j]!=W[I+F])return!0;return!1}for(var Z=0;Z<X.length;Z++){var U=X[Z],H=U[0];if(H==-1)if(!$(U))z(Y[0].slice(U[1],U[1]+U[2]));else K(),V.push({conflict:{a:Q.slice(U[1],U[1]+U[2]),aIndex:U[1],o:J.slice(U[3],U[3]+U[4]),oIndex:U[3],b:W.slice(U[5],U[5]+U[6]),bIndex:U[5]}});else z(Y[H].slice(U[1],U[1]+U[2]))}return K(),V}Cq.exports=bD});var QZ=k((eK)=>{Object.defineProperty(eK,"__esModule",{value:!0});function o1(Q){return Q&&typeof Q==="object"&&"default"in Q?Q.default:Q}var m8=o1(VV()),rq=o1(D4()),_D=o1(I4()),oQ=o1(qq()),F9=o1($q()),yD=o1(wq()),f8=o1(Mq()),hD=o1(Rq());class o extends Error{constructor(Q){super(Q);this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(Q){let J=new o(Q.message);return J.code=Q.code,J.data=Q.data,J.caller=Q.caller,J.stack=Q.stack,J}get isIsomorphicGitError(){return!0}}class n8 extends o{constructor(Q){super(`Modifying the index is not possible because you have unmerged files: ${Q.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=n8.code,this.data={filepaths:Q}}}n8.code="UnmergedPathsError";class u extends o{constructor(Q){super(`An internal error caused this command to fail.
|
|
24
|
+
|
|
25
|
+
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
|
|
26
|
+
|
|
27
|
+
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${Q}`);this.code=this.name=u.code,this.data={message:Q}}}u.code="InternalError";class e6 extends o{constructor(Q){super(`The filepath "${Q}" contains unsafe character sequences`);this.code=this.name=e6.code,this.data={filepath:Q}}}e6.code="UnsafeFilepathError";class q1{constructor(Q){this.buffer=Q,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(Q){this._start=Q}slice(Q){let J=this.buffer.slice(this._start,this._start+Q);return this._start+=Q,J}toString(Q,J){let W=this.buffer.toString(Q,this._start,this._start+J);return this._start+=J,W}write(Q,J,W){let V=this.buffer.write(Q,this._start,J,W);return this._start+=J,V}copy(Q,J,W){let V=Q.copy(this.buffer,this._start,J,W);return this._start+=V,V}readUInt8(){let Q=this.buffer.readUInt8(this._start);return this._start+=1,Q}writeUInt8(Q){let J=this.buffer.writeUInt8(Q,this._start);return this._start+=1,J}readUInt16BE(){let Q=this.buffer.readUInt16BE(this._start);return this._start+=2,Q}writeUInt16BE(Q){let J=this.buffer.writeUInt16BE(Q,this._start);return this._start+=2,J}readUInt32BE(){let Q=this.buffer.readUInt32BE(this._start);return this._start+=4,Q}writeUInt32BE(Q){let J=this.buffer.writeUInt32BE(Q,this._start);return this._start+=4,J}}function C9(Q,J){return-(Q<J)||+(Q>J)}function tq(Q,J){return C9(Q.path,J.path)}function eq(Q){let J=Q>0?Q>>12:0;if(J!==4&&J!==8&&J!==10&&J!==14)J=8;let W=Q&511;if(W&73)W=493;else W=420;if(J!==8)W=0;return(J<<12)+W}var G1=4294967296;function Tq(Q,J,W,V){if(Q!==void 0&&J!==void 0)return[Q,J];if(W===void 0)W=V.valueOf();let Y=Math.floor(W/1000),X=(W-Y*1000)*1e6;return[Y,X]}function n6(Q){let[J,W]=Tq(Q.ctimeSeconds,Q.ctimeNanoseconds,Q.ctimeMs,Q.ctime),[V,Y]=Tq(Q.mtimeSeconds,Q.mtimeNanoseconds,Q.mtimeMs,Q.mtime);return{ctimeSeconds:J%G1,ctimeNanoseconds:W%G1,mtimeSeconds:V%G1,mtimeNanoseconds:Y%G1,dev:Q.dev%G1,ino:Q.ino%G1,mode:eq(Q.mode%G1),uid:Q.uid%G1,gid:Q.gid%G1,size:Q.size>-1?Q.size%G1:0}}function gD(Q){let J="";for(let W of new Uint8Array(Q)){if(W<16)J+="0";J+=W.toString(16)}return J}var EQ=null;async function L1(Q){if(EQ===null)EQ=await uD();return EQ?Q2(Q):pD(Q)}function pD(Q){return new rq().update(Q).digest("hex")}async function Q2(Q){let J=await crypto.subtle.digest("SHA-1",Q);return gD(J)}async function uD(){try{return await Q2(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(Q){}return!1}function mD(Q){return{assumeValid:Boolean(Q&32768),extended:Boolean(Q&16384),stage:(Q&12288)>>12,nameLength:Q&4095}}function fD(Q){let J=Q.flags;return J.extended=!1,J.nameLength=Math.min(Buffer.from(Q.path).length,4095),(J.assumeValid?32768:0)+(J.extended?16384:0)+((J.stage&3)<<12)+(J.nameLength&4095)}class H6{constructor(Q,J){this._dirty=!1,this._unmergedPaths=J||new Set,this._entries=Q||new Map}_addEntry(Q){if(Q.flags.stage===0)Q.stages=[Q],this._entries.set(Q.path,Q),this._unmergedPaths.delete(Q.path);else{let J=this._entries.get(Q.path);if(!J)this._entries.set(Q.path,Q),J=Q;J.stages[Q.flags.stage]=Q,this._unmergedPaths.add(Q.path)}}static async from(Q){if(Buffer.isBuffer(Q))return H6.fromBuffer(Q);else if(Q===null)return new H6(null);else throw new u("invalid type passed to GitIndex.from")}static async fromBuffer(Q){if(Q.length===0)throw new u("Index file is empty (.git/index)");let J=new H6,W=new q1(Q),V=W.toString("utf8",4);if(V!=="DIRC")throw new u(`Invalid dircache magic file number: ${V}`);let Y=await L1(Q.slice(0,-20)),X=Q.slice(-20).toString("hex");if(X!==Y)throw new u(`Invalid checksum in GitIndex buffer: expected ${X} but saw ${Y}`);let q=W.readUInt32BE();if(q!==2)throw new u(`Unsupported dircache version: ${q}`);let K=W.readUInt32BE(),z=0;while(!W.eof()&&z<K){let $={};$.ctimeSeconds=W.readUInt32BE(),$.ctimeNanoseconds=W.readUInt32BE(),$.mtimeSeconds=W.readUInt32BE(),$.mtimeNanoseconds=W.readUInt32BE(),$.dev=W.readUInt32BE(),$.ino=W.readUInt32BE(),$.mode=W.readUInt32BE(),$.uid=W.readUInt32BE(),$.gid=W.readUInt32BE(),$.size=W.readUInt32BE(),$.oid=W.slice(20).toString("hex");let Z=W.readUInt16BE();$.flags=mD(Z);let U=Q.indexOf(0,W.tell()+1)-W.tell();if(U<1)throw new u(`Got a path length of: ${U}`);if($.path=W.toString("utf8",U),$.path.includes("..\\")||$.path.includes("../"))throw new e6($.path);let H=8-(W.tell()-12)%8;if(H===0)H=8;while(H--){let B=W.readUInt8();if(B!==0)throw new u(`Expected 1-8 null characters but got '${B}' after ${$.path}`);else if(W.eof())throw new u("Unexpected end of file")}$.stages=[],J._addEntry($),z++}return J}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(tq)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap((Q)=>{return Q.stages.length>1?Q.stages.filter((J)=>J):Q})}*[Symbol.iterator](){for(let Q of this.entries)yield Q}insert({filepath:Q,stats:J,oid:W,stage:V=0}){if(!J)J={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0};J=n6(J);let Y=Buffer.from(Q),X={ctimeSeconds:J.ctimeSeconds,ctimeNanoseconds:J.ctimeNanoseconds,mtimeSeconds:J.mtimeSeconds,mtimeNanoseconds:J.mtimeNanoseconds,dev:J.dev,ino:J.ino,mode:J.mode||33188,uid:J.uid,gid:J.gid,size:J.size,path:Q,oid:W,flags:{assumeValid:!1,extended:!1,stage:V,nameLength:Y.length<4095?Y.length:4095},stages:[]};this._addEntry(X),this._dirty=!0}delete({filepath:Q}){if(this._entries.has(Q))this._entries.delete(Q);else for(let J of this._entries.keys())if(J.startsWith(Q+"/"))this._entries.delete(J);if(this._unmergedPaths.has(Q))this._unmergedPaths.delete(Q);this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:Q}){return this._entries.has(Q)}render(){return this.entries.map((Q)=>`${Q.mode.toString(8)} ${Q.oid} ${Q.path}`).join(`
|
|
28
|
+
`)}static async _entryToBuffer(Q){let J=Buffer.from(Q.path),W=Math.ceil((62+J.length+1)/8)*8,V=Buffer.alloc(W),Y=new q1(V),X=n6(Q);return Y.writeUInt32BE(X.ctimeSeconds),Y.writeUInt32BE(X.ctimeNanoseconds),Y.writeUInt32BE(X.mtimeSeconds),Y.writeUInt32BE(X.mtimeNanoseconds),Y.writeUInt32BE(X.dev),Y.writeUInt32BE(X.ino),Y.writeUInt32BE(X.mode),Y.writeUInt32BE(X.uid),Y.writeUInt32BE(X.gid),Y.writeUInt32BE(X.size),Y.write(Q.oid,20,"hex"),Y.writeUInt16BE(fD(Q)),Y.write(Q.path,J.length,"utf8"),V}async toObject(){let Q=Buffer.alloc(12),J=new q1(Q);J.write("DIRC",4,"utf8"),J.writeUInt32BE(2),J.writeUInt32BE(this.entriesFlat.length);let W=[];for(let q of this.entries)if(W.push(H6._entryToBuffer(q)),q.stages.length>1){for(let K of q.stages)if(K&&K!==q)W.push(H6._entryToBuffer(K))}W=await Promise.all(W);let V=Buffer.concat(W),Y=Buffer.concat([Q,V]),X=await L1(Y);return Buffer.concat([Y,Buffer.from(X,"hex")])}}function I9(Q,J,W=!0,V=!0){let Y=n6(Q),X=n6(J);return W&&Y.mode!==X.mode||Y.mtimeSeconds!==X.mtimeSeconds||Y.ctimeSeconds!==X.ctimeSeconds||Y.uid!==X.uid||Y.gid!==X.gid||V&&Y.ino!==X.ino||Y.size!==X.size}var vQ=null,kQ=Symbol("IndexCache");function cD(){return{map:new Map,stats:new Map}}async function dD(Q,J,W){let[V,Y]=await Promise.all([Q.lstat(J),Q.read(J)]),X=await H6.from(Y);W.map.set(J,X),W.stats.set(J,V)}async function lD(Q,J,W){let V=W.stats.get(J);if(V===void 0)return!0;if(V===null)return!1;let Y=await Q.lstat(J);if(Y===null)return!1;return I9(V,Y)}class $0{static async acquire({fs:Q,gitdir:J,cache:W,allowUnmerged:V=!0},Y){if(!W[kQ])W[kQ]=cD();let X=`${J}/index`;if(vQ===null)vQ=new m8({maxPending:1/0});let q,K=[];return await vQ.acquire(X,async()=>{let z=W[kQ];if(await lD(Q,X,z))await dD(Q,X,z);let $=z.map.get(X);if(K=$.unmergedPaths,K.length&&!V)throw new n8(K);if(q=await Y($),$._dirty){let Z=await $.toObject();await Q.write(X,Z),z.stats.set(X,await Q.lstat(X)),$._dirty=!1}}),q}}function G9(Q){let J=Math.max(Q.lastIndexOf("/"),Q.lastIndexOf("\\"));if(J>-1)Q=Q.slice(J+1);return Q}function j6(Q){let J=Math.max(Q.lastIndexOf("/"),Q.lastIndexOf("\\"));if(J===-1)return".";if(J===0)return"/";return Q.slice(0,J)}function J2(Q){let J=new Map,W=function(Y){if(!J.has(Y)){let X={type:"tree",fullpath:Y,basename:G9(Y),metadata:{},children:[]};if(J.set(Y,X),X.parent=W(j6(Y)),X.parent&&X.parent!==X)X.parent.children.push(X)}return J.get(Y)},V=function(Y,X){if(!J.has(Y)){let q={type:"blob",fullpath:Y,basename:G9(Y),metadata:X,parent:W(j6(Y)),children:[]};if(q.parent)q.parent.children.push(q);J.set(Y,q)}return J.get(Y)};W(".");for(let Y of Q)V(Y.path,Y);return J}function nD(Q){switch(Q){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: ${Q.toString(8)}`)}class W2{constructor({fs:Q,gitdir:J,cache:W}){this.treePromise=$0.acquire({fs:Q,gitdir:J,cache:W},async function(Y){return J2(Y.entries)});let V=this;this.ConstructEntry=class{constructor(X){this._fullpath=X,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return V.type(this)}async mode(){return V.mode(this)}async stat(){return V.stat(this)}async content(){return V.content(this)}async oid(){return V.oid(this)}}}async readdir(Q){let J=Q._fullpath,V=(await this.treePromise).get(J);if(!V)return null;if(V.type==="blob")return null;if(V.type!=="tree")throw Error(`ENOTDIR: not a directory, scandir '${J}'`);let Y=V.children.map((X)=>X.fullpath);return Y.sort(C9),Y}async type(Q){if(Q._type===!1)await Q.stat();return Q._type}async mode(Q){if(Q._mode===!1)await Q.stat();return Q._mode}async stat(Q){if(Q._stat===!1){let W=(await this.treePromise).get(Q._fullpath);if(!W)throw Error(`ENOENT: no such file or directory, lstat '${Q._fullpath}'`);let V=W.type==="tree"?{}:n6(W.metadata);if(Q._type=W.type==="tree"?"tree":nD(V.mode),Q._mode=V.mode,W.type==="tree")Q._stat=void 0;else Q._stat=V}return Q._stat}async content(Q){}async oid(Q){if(Q._oid===!1){let W=(await this.treePromise).get(Q._fullpath);Q._oid=W.metadata.oid}return Q._oid}}var R9=Symbol("GitWalkSymbol");function D6(){let Q=Object.create(null);return Object.defineProperty(Q,R9,{value:function({fs:J,gitdir:W,cache:V}){return new W2({fs:J,gitdir:W,cache:V})}}),Object.freeze(Q),Q}class r extends o{constructor(Q){super(`Could not find ${Q}.`);this.code=this.name=r.code,this.data={what:Q}}}r.code="NotFoundError";class R0 extends o{constructor(Q,J,W,V){super(`Object ${Q} ${V?`at ${V}`:""}was anticipated to be a ${W} but it is a ${J}.`);this.code=this.name=R0.code,this.data={oid:Q,actual:J,expected:W,filepath:V}}}R0.code="ObjectTypeError";class c1 extends o{constructor(Q){super(`Expected a 40-char hex object id but saw "${Q}".`);this.code=this.name=c1.code,this.data={value:Q}}}c1.code="InvalidOidError";class o8 extends o{constructor(Q){super(`Could not find a fetch refspec for remote "${Q}". Make sure the config file has an entry like the following:
|
|
29
|
+
[remote "${Q}"]
|
|
30
|
+
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
31
|
+
`);this.code=this.name=o8.code,this.data={remote:Q}}}o8.code="NoRefspecError";class w9{constructor(Q){if(this.refs=new Map,this.parsedConfig=[],Q){let J=null;this.parsedConfig=Q.trim().split(`
|
|
32
|
+
`).map((W)=>{if(/^\s*#/.test(W))return{line:W,comment:!0};let V=W.indexOf(" ");if(W.startsWith("^")){let Y=W.slice(1);return this.refs.set(J+"^{}",Y),{line:W,ref:J,peeled:Y}}else{let Y=W.slice(0,V);return J=W.slice(V+1),this.refs.set(J,Y),{line:W,ref:J,oid:Y}}})}return this}static from(Q){return new w9(Q)}delete(Q){this.parsedConfig=this.parsedConfig.filter((J)=>J.ref!==Q),this.refs.delete(Q)}toString(){return this.parsedConfig.map(({line:Q})=>Q).join(`
|
|
33
|
+
`)+`
|
|
34
|
+
`}}class L9{constructor({remotePath:Q,localPath:J,force:W,matchPrefix:V}){Object.assign(this,{remotePath:Q,localPath:J,force:W,matchPrefix:V})}static from(Q){let[J,W,V,Y,X]=Q.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),q=J==="+",K=V==="*";if(K!==(X==="*"))throw new u("Invalid refspec");return new L9({remotePath:W,localPath:Y,force:q,matchPrefix:K})}translate(Q){if(this.matchPrefix){if(Q.startsWith(this.remotePath))return this.localPath+Q.replace(this.remotePath,"")}else if(Q===this.remotePath)return this.localPath;return null}reverseTranslate(Q){if(this.matchPrefix){if(Q.startsWith(this.localPath))return this.remotePath+Q.replace(this.localPath,"")}else if(Q===this.localPath)return this.remotePath;return null}}class aQ{constructor(Q=[]){this.rules=Q}static from(Q){let J=[];for(let W of Q)J.push(L9.from(W));return new aQ(J)}add(Q){let J=L9.from(Q);this.rules.push(J)}translate(Q){let J=[];for(let W of this.rules)for(let V of Q){let Y=W.translate(V);if(Y)J.push([V,Y])}return J}translateOne(Q){let J=null;for(let W of this.rules){let V=W.translate(Q);if(V)J=V}return J}localNamespaces(){return this.rules.filter((Q)=>Q.matchPrefix).map((Q)=>Q.localPath.replace(/\/$/,""))}}function oD(Q,J){let W=Q.replace(/\^\{\}$/,""),V=J.replace(/\^\{\}$/,""),Y=-(W<V)||+(W>V);if(Y===0)return Q.endsWith("^{}")?1:-1;return Y}/*!
|
|
35
|
+
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
|
36
|
+
* SPDX-License-Identifier: LGPL-3.0-or-later
|
|
37
|
+
* Copyright (c) James Prevett and other ZenFS contributors.
|
|
38
|
+
*/function aD(Q,J){let W="",V=0,Y=-1,X=0,q="\x00";for(let K=0;K<=Q.length;++K){if(K<Q.length)q=Q[K];else if(q==="/")break;else q="/";if(q==="/"){if(Y===K-1||X===1);else if(X===2){if(W.length<2||V!==2||W.at(-1)!=="."||W.at(-2)!=="."){if(W.length>2){let z=W.lastIndexOf("/");if(z===-1)W="",V=0;else W=W.slice(0,z),V=W.length-1-W.lastIndexOf("/");Y=K,X=0;continue}else if(W.length!==0){W="",V=0,Y=K,X=0;continue}}if(J)W+=W.length>0?"/..":"..",V=2}else{if(W.length>0)W+="/"+Q.slice(Y+1,K);else W=Q.slice(Y+1,K);V=K-Y-1}Y=K,X=0}else if(q==="."&&X!==-1)++X;else X=-1}return W}function iD(Q){if(!Q.length)return".";let J=Q[0]==="/",W=Q.at(-1)==="/";if(Q=aD(Q,!J),!Q.length){if(J)return"/";return W?"./":"."}if(W)Q+="/";return J?`/${Q}`:Q}function S(...Q){if(Q.length===0)return".";let J;for(let W=0;W<Q.length;++W){let V=Q[W];if(V.length>0)if(J===void 0)J=V;else J+="/"+V}if(J===void 0)return".";return iD(J)}var sD=(Q)=>{if(typeof Q==="number")return Q;Q=Q.toLowerCase();let J=parseInt(Q);if(Q.endsWith("k"))J*=1024;if(Q.endsWith("m"))J*=1048576;if(Q.endsWith("g"))J*=1073741824;return J},p8=(Q)=>{if(typeof Q==="boolean")return Q;if(Q=Q.trim().toLowerCase(),Q==="true"||Q==="yes"||Q==="on")return!0;if(Q==="false"||Q==="no"||Q==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${Q}`)},Sq={core:{filemode:p8,bare:p8,logallrefupdates:p8,symlinks:p8,ignorecase:p8,bigFileThreshold:sD}},rD=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,tD=/^[A-Za-z0-9-.]+$/,eD=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,QN=/^[A-Za-z][A-Za-z-]*$/,JN=/^(.*?)( *[#;].*)$/,WN=(Q)=>{let J=rD.exec(Q);if(J!=null){let[W,V]=J.slice(1);return[W,V]}return null},VN=(Q)=>{let J=eD.exec(Q);if(J!=null){let[W,V="true"]=J.slice(1),Y=YN(V),X=XN(Y);return[W,X]}return null},YN=(Q)=>{let J=JN.exec(Q);if(J==null)return Q;let[W,V]=J.slice(1);if(Eq(W)&&Eq(V))return`${W}${V}`;return W},Eq=(Q)=>{return(Q.match(/(?:^|[^\\])"/g)||[]).length%2!==0},XN=(Q)=>{return Q.split("").reduce((J,W,V,Y)=>{let X=W==='"'&&Y[V-1]!=="\\",q=W==="\\"&&Y[V+1]==='"';if(X||q)return J;return J+W},"")},vq=(Q)=>{return Q!=null?Q.toLowerCase():null},fQ=(Q,J,W)=>{return[vq(Q),J,vq(W)].filter((V)=>V!=null).join(".")},kq=(Q)=>{let J=Q.split("."),W=J.shift(),V=J.pop(),Y=J.length?J.join("."):void 0;return{section:W,subsection:Y,name:V,path:fQ(W,Y,V),sectionPath:fQ(W,Y,null),isSection:!!W}},qN=(Q,J)=>{return Q.reduce((W,V,Y)=>{return J(V)?Y:W},-1)};class iQ{constructor(Q){let J=null,W=null;this.parsedConfig=Q?Q.split(`
|
|
39
|
+
`).map((V)=>{let Y=null,X=null,q=V.trim(),K=WN(q),z=K!=null;if(z)[J,W]=K;else{let Z=VN(q);if(Z!=null)[Y,X]=Z}let $=fQ(J,W,Y);return{line:V,isSection:z,section:J,subsection:W,name:Y,value:X,path:$}}):[]}static from(Q){return new iQ(Q)}async get(Q,J=!1){let W=kq(Q).path,V=this.parsedConfig.filter((Y)=>Y.path===W).map(({section:Y,name:X,value:q})=>{let K=Sq[Y]&&Sq[Y][X];return K?K(q):q});return J?V:V.pop()}async getall(Q){return this.get(Q,!0)}async getSubsections(Q){return this.parsedConfig.filter((J)=>J.isSection&&J.section===Q).map((J)=>J.subsection)}async deleteSection(Q,J){this.parsedConfig=this.parsedConfig.filter((W)=>!(W.section===Q&&W.subsection===J))}async append(Q,J){return this.set(Q,J,!0)}async set(Q,J,W=!1){let{section:V,subsection:Y,name:X,path:q,sectionPath:K,isSection:z}=kq(Q),$=qN(this.parsedConfig,(Z)=>Z.path===q);if(J==null){if($!==-1)this.parsedConfig.splice($,1)}else if($!==-1){let Z=this.parsedConfig[$],U=Object.assign({},Z,{name:X,value:J,modified:!0});if(W)this.parsedConfig.splice($+1,0,U);else this.parsedConfig[$]=U}else{let Z=this.parsedConfig.findIndex((H)=>H.path===K),U={section:V,subsection:Y,name:X,value:J,modified:!0,path:q};if(tD.test(V)&&QN.test(X))if(Z>=0)this.parsedConfig.splice(Z+1,0,U);else{let H={isSection:z,section:V,subsection:Y,modified:!0,path:K};this.parsedConfig.push(H,U)}}}toString(){return this.parsedConfig.map(({line:Q,section:J,subsection:W,name:V,value:Y,modified:X=!1})=>{if(!X)return Q;if(V!=null&&Y!=null){if(typeof Y==="string"&&/[#;]/.test(Y))return` ${V} = "${Y}"`;return` ${V} = ${Y}`}if(W!=null)return`[${J} "${W}"]`;return`[${J}]`}).join(`
|
|
40
|
+
`)}}class z0{static async get({fs:Q,gitdir:J}){let W=await Q.read(`${J}/config`,{encoding:"utf8"});return iQ.from(W)}static async save({fs:Q,gitdir:J,config:W}){await Q.write(`${J}/config`,W.toString(),{encoding:"utf8"})}}var D9=(Q)=>[`${Q}`,`refs/${Q}`,`refs/tags/${Q}`,`refs/heads/${Q}`,`refs/remotes/${Q}`,`refs/remotes/${Q}/HEAD`],KN=["config","description","index","shallow","commondir"],xQ;async function m1(Q,J){if(xQ===void 0)xQ=new m8;return xQ.acquire(Q,J)}class v{static async updateRemoteRefs({fs:Q,gitdir:J,remote:W,refs:V,symrefs:Y,tags:X,refspecs:q=void 0,prune:K=!1,pruneTags:z=!1}){for(let F of V.values())if(!F.match(/[0-9a-f]{40}/))throw new c1(F);let $=await z0.get({fs:Q,gitdir:J});if(!q){if(q=await $.getall(`remote.${W}.fetch`),q.length===0)throw new o8(W);q.unshift(`+HEAD:refs/remotes/${W}/HEAD`)}let Z=aQ.from(q),U=new Map;if(z){let F=await v.listRefs({fs:Q,gitdir:J,filepath:"refs/tags"});await v.deleteRefs({fs:Q,gitdir:J,refs:F.map((I)=>`refs/tags/${I}`)})}if(X){for(let F of V.keys())if(F.startsWith("refs/tags")&&!F.endsWith("^{}")){if(!await v.exists({fs:Q,gitdir:J,ref:F})){let I=V.get(F);U.set(F,I)}}}let H=Z.translate([...V.keys()]);for(let[F,I]of H){let L=V.get(F);U.set(I,L)}let B=Z.translate([...Y.keys()]);for(let[F,I]of B){let L=Y.get(F),N=Z.translateOne(L);if(N)U.set(I,`ref: ${N}`)}let j=[];if(K){for(let F of Z.localNamespaces()){let I=(await v.listRefs({fs:Q,gitdir:J,filepath:F})).map((L)=>`${F}/${L}`);for(let L of I)if(!U.has(L))j.push(L)}if(j.length>0)await v.deleteRefs({fs:Q,gitdir:J,refs:j})}for(let[F,I]of U)await m1(F,async()=>Q.write(S(J,F),`${I.trim()}
|
|
41
|
+
`,"utf8"));return{pruned:j}}static async writeRef({fs:Q,gitdir:J,ref:W,value:V}){if(!V.match(/[0-9a-f]{40}/))throw new c1(V);await m1(W,async()=>Q.write(S(J,W),`${V.trim()}
|
|
42
|
+
`,"utf8"))}static async writeSymbolicRef({fs:Q,gitdir:J,ref:W,value:V}){await m1(W,async()=>Q.write(S(J,W),`ref: ${V.trim()}
|
|
43
|
+
`,"utf8"))}static async deleteRef({fs:Q,gitdir:J,ref:W}){return v.deleteRefs({fs:Q,gitdir:J,refs:[W]})}static async deleteRefs({fs:Q,gitdir:J,refs:W}){await Promise.all(W.map((q)=>Q.rm(S(J,q))));let V=await m1("packed-refs",async()=>Q.read(`${J}/packed-refs`,{encoding:"utf8"})),Y=w9.from(V),X=Y.refs.size;for(let q of W)if(Y.refs.has(q))Y.delete(q);if(Y.refs.size<X)V=Y.toString(),await m1("packed-refs",async()=>Q.write(`${J}/packed-refs`,V,{encoding:"utf8"}))}static async resolve({fs:Q,gitdir:J,ref:W,depth:V=void 0}){if(V!==void 0){if(V--,V===-1)return W}if(W.startsWith("ref: "))return W=W.slice(5),v.resolve({fs:Q,gitdir:J,ref:W,depth:V});if(W.length===40&&/[0-9a-f]{40}/.test(W))return W;let Y=await v.packedRefs({fs:Q,gitdir:J}),X=D9(W).filter((q)=>!KN.includes(q));for(let q of X){let K=await m1(q,async()=>await Q.read(`${J}/${q}`,{encoding:"utf8"})||Y.get(q));if(K)return v.resolve({fs:Q,gitdir:J,ref:K.trim(),depth:V})}throw new r(W)}static async exists({fs:Q,gitdir:J,ref:W}){try{return await v.expand({fs:Q,gitdir:J,ref:W}),!0}catch(V){return!1}}static async expand({fs:Q,gitdir:J,ref:W}){if(W.length===40&&/[0-9a-f]{40}/.test(W))return W;let V=await v.packedRefs({fs:Q,gitdir:J}),Y=D9(W);for(let X of Y){if(await m1(X,async()=>Q.exists(`${J}/${X}`)))return X;if(V.has(X))return X}throw new r(W)}static async expandAgainstMap({ref:Q,map:J}){let W=D9(Q);for(let V of W)if(await J.has(V))return V;throw new r(Q)}static resolveAgainstMap({ref:Q,fullref:J=Q,depth:W=void 0,map:V}){if(W!==void 0){if(W--,W===-1)return{fullref:J,oid:Q}}if(Q.startsWith("ref: "))return Q=Q.slice(5),v.resolveAgainstMap({ref:Q,fullref:J,depth:W,map:V});if(Q.length===40&&/[0-9a-f]{40}/.test(Q))return{fullref:J,oid:Q};let Y=D9(Q);for(let X of Y){let q=V.get(X);if(q)return v.resolveAgainstMap({ref:q.trim(),fullref:X,depth:W,map:V})}throw new r(Q)}static async packedRefs({fs:Q,gitdir:J}){let W=await m1("packed-refs",async()=>Q.read(`${J}/packed-refs`,{encoding:"utf8"}));return w9.from(W).refs}static async listRefs({fs:Q,gitdir:J,filepath:W}){let V=v.packedRefs({fs:Q,gitdir:J}),Y=null;try{Y=await Q.readdirDeep(`${J}/${W}`),Y=Y.map((X)=>X.replace(`${J}/${W}/`,""))}catch(X){Y=[]}for(let X of(await V).keys())if(X.startsWith(W)){if(X=X.replace(W+"/",""),!Y.includes(X))Y.push(X)}return Y.sort(oD),Y}static async listBranches({fs:Q,gitdir:J,remote:W}){if(W)return v.listRefs({fs:Q,gitdir:J,filepath:`refs/remotes/${W}`});else return v.listRefs({fs:Q,gitdir:J,filepath:"refs/heads"})}static async listTags({fs:Q,gitdir:J}){return(await v.listRefs({fs:Q,gitdir:J,filepath:"refs/tags"})).filter((V)=>!V.endsWith("^{}"))}}function ZN(Q,J){return C9(xq(Q),xq(J))}function xq(Q){return Q.mode==="040000"?Q.path+"/":Q.path}function V2(Q){switch(Q){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: ${Q}`)}function $N(Q){let J=[],W=0;while(W<Q.length){let V=Q.indexOf(32,W);if(V===-1)throw new u(`GitTree: Error parsing buffer at byte location ${W}: Could not find the next space character.`);let Y=Q.indexOf(0,W);if(Y===-1)throw new u(`GitTree: Error parsing buffer at byte location ${W}: Could not find the next null character.`);let X=Q.slice(W,V).toString("utf8");if(X==="40000")X="040000";let q=V2(X),K=Q.slice(V+1,Y).toString("utf8");if(K.includes("\\")||K.includes("/"))throw new e6(K);let z=Q.slice(Y+1,Y+21).toString("hex");W=Y+21,J.push({mode:X,path:K,oid:z,type:q})}return J}function zN(Q){if(typeof Q==="number")Q=Q.toString(8);if(Q.match(/^0?4.*/))return"040000";if(Q.match(/^1006.*/))return"100644";if(Q.match(/^1007.*/))return"100755";if(Q.match(/^120.*/))return"120000";if(Q.match(/^160.*/))return"160000";throw new u(`Could not understand file mode: ${Q}`)}function UN(Q){if(!Q.oid&&Q.sha)Q.oid=Q.sha;if(Q.mode=zN(Q.mode),!Q.type)Q.type=V2(Q.mode);return Q}class b0{constructor(Q){if(Buffer.isBuffer(Q))this._entries=$N(Q);else if(Array.isArray(Q))this._entries=Q.map(UN);else throw new u("invalid type passed to GitTree constructor");this._entries.sort(tq)}static from(Q){return new b0(Q)}render(){return this._entries.map((Q)=>`${Q.mode} ${Q.type} ${Q.oid} ${Q.path}`).join(`
|
|
44
|
+
`)}toObject(){let Q=[...this._entries];return Q.sort(ZN),Buffer.concat(Q.map((J)=>{let W=Buffer.from(J.mode.replace(/^0/,"")),V=Buffer.from(" "),Y=Buffer.from(J.path,"utf8"),X=Buffer.from([0]),q=Buffer.from(J.oid,"hex");return Buffer.concat([W,V,Y,X,q])}))}entries(){return this._entries}*[Symbol.iterator](){for(let Q of this._entries)yield Q}}class N6{static wrap({type:Q,object:J}){let W=`${Q} ${J.length}\x00`,V=W.length,Y=V+J.length,X=new Uint8Array(Y);for(let q=0;q<V;q++)X[q]=W.charCodeAt(q);return X.set(J,V),X}static unwrap(Q){let J=Q.indexOf(32),W=Q.indexOf(0),V=Q.slice(0,J).toString("utf8"),Y=Q.slice(J+1,W).toString("utf8"),X=Q.length-(W+1);if(parseInt(Y)!==X)throw new u(`Length mismatch: expected ${Y} bytes but got ${X} instead.`);return{type:V,object:Buffer.from(Q.slice(W+1))}}}async function Y2({fs:Q,gitdir:J,oid:W}){let V=`objects/${W.slice(0,2)}/${W.slice(2)}`,Y=await Q.read(`${J}/${V}`);if(!Y)return null;return{object:Y,format:"deflated",source:V}}function HN(Q,J){let W=new q1(Q),V=bq(W);if(V!==J.byteLength)throw new u(`applyDelta expected source buffer to be ${V} bytes but the provided buffer was ${J.length} bytes`);let Y=bq(W),X,q=yq(W,J);if(q.byteLength===Y)X=q;else{X=Buffer.alloc(Y);let K=new q1(X);K.copy(q);while(!W.eof())K.copy(yq(W,J));let z=K.tell();if(Y!==z)throw new u(`applyDelta expected target buffer to be ${Y} bytes but the resulting buffer was ${z} bytes`)}return X}function bq(Q){let J=0,W=0,V=null;do V=Q.readUInt8(),J|=(V&127)<<W,W+=7;while(V&128);return J}function _q(Q,J,W){let V=0,Y=0;while(W--){if(J&1)V|=Q.readUInt8()<<Y;J>>=1,Y+=8}return V}function yq(Q,J){let W=Q.readUInt8(),V=128,Y=15,X=112;if(W&128){let q=_q(Q,W&15,4),K=_q(Q,(W&112)>>4,3);if(K===0)K=65536;return J.slice(q,q+K)}else return Q.slice(W)}function BN(Q){let J=[Q];return{next(){return Promise.resolve({done:J.length===0,value:J.pop()})},return(){return J=[],{}},[Symbol.asyncIterator](){return this}}}function X2(Q){if(Q[Symbol.asyncIterator])return Q[Symbol.asyncIterator]();if(Q[Symbol.iterator])return Q[Symbol.iterator]();if(Q.next)return Q;return BN(Q)}class sQ{constructor(Q){if(typeof Buffer>"u")throw Error("Missing Buffer dependency");this.stream=X2(Q),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())return;if(!this.started)await this._init();if(this.cursor===this.buffer.length){if(await this._loadnext(),this._ended)return}return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(this.eof())return;if(!this.started)await this._init();if(this.cursor===this.buffer.length){if(await this._loadnext(),this._ended)return}return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(Q){if(this.eof())return;if(!this.started)await this._init();if(this.cursor+Q>this.buffer.length)this._trim(),await this._accumulate(Q);return this._moveCursor(Q),this.buffer.slice(this.undoCursor,this.cursor)}async skip(Q){if(this.eof())return;if(!this.started)await this._init();if(this.cursor+Q>this.buffer.length)this._trim(),await this._accumulate(Q);this._moveCursor(Q)}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:Q,value:J}=await this.stream.next();if(Q){if(this._ended=!0,!J)return Buffer.alloc(0)}if(J)J=Buffer.from(J);return J}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(Q){if(this.undoCursor=this.cursor,this.cursor+=Q,this.cursor>this.buffer.length)this.cursor=this.buffer.length}async _accumulate(Q){if(this._ended)return;let J=[this.buffer];while(this.cursor+Q>jN(J)){let W=await this._next();if(this._ended)break;J.push(W)}this.buffer=Buffer.concat(J)}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 jN(Q){return Q.reduce((J,W)=>J+W.length,0)}async function FN(Q,J){let W=new sQ(Q),V=await W.read(4);if(V=V.toString("utf8"),V!=="PACK")throw new u(`Invalid PACK header '${V}'`);let Y=await W.read(4);if(Y=Y.readUInt32BE(0),Y!==2)throw new u(`Invalid packfile version: ${Y}`);let X=await W.read(4);if(X=X.readUInt32BE(0),X<1)return;while(!W.eof()&&X--){let q=W.tell(),{type:K,length:z,ofs:$,reference:Z}=await DN(W),U=new oQ.Inflate;while(!U.result){let H=await W.chunk();if(!H)break;if(U.push(H,!1),U.err)throw new u(`Pako error: ${U.msg}`);if(U.result){if(U.result.length!==z)throw new u("Inflated object size is different from that stated in packfile.");await W.undo(),await W.read(H.length-U.strm.avail_in);let B=W.tell();await J({data:U.result,type:K,num:X,offset:q,end:B,reference:Z,ofs:$})}}}}async function DN(Q){let J=await Q.byte(),W=J>>4&7,V=J&15;if(J&128){let q=4;do J=await Q.byte(),V|=(J&127)<<q,q+=7;while(J&128)}let Y,X;if(W===6){let q=0;Y=0;let K=[];do J=await Q.byte(),Y|=(J&127)<<q,q+=7,K.push(J);while(J&128);X=Buffer.from(K)}if(W===7)X=await Q.read(20);return{type:W,length:V,ofs:Y,reference:X}}var bQ=!1;async function q2(Q){if(bQ===null)bQ=IN();return bQ?NN(Q):oQ.inflate(Q)}async function NN(Q){let J=new DecompressionStream("deflate"),W=new Blob([Q]).stream().pipeThrough(J);return new Uint8Array(await new Response(W).arrayBuffer())}function IN(){try{if(new DecompressionStream("deflate"))return!0}catch(Q){}return!1}function GN(Q){let J=[],W=0,V=0;do{W=Q.readUInt8();let Y=W&127;J.push(Y),V=W&128}while(V);return J.reduce((Y,X)=>Y+1<<7|X,-1)}function wN(Q,J){let W=J,V=4,Y=null;do Y=Q.readUInt8(),W|=(Y&127)<<V,V+=7;while(Y&128);return W}class o6{constructor(Q){Object.assign(this,Q),this.offsetCache={}}static async fromIdx({idx:Q,getExternalRefDelta:J}){let W=new q1(Q);if(W.slice(4).toString("hex")!=="ff744f63")return;let Y=W.readUInt32BE();if(Y!==2)throw new u(`Unable to read version ${Y} packfile IDX. (Only version 2 supported)`);if(Q.byteLength>2147483648)throw new u("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");W.seek(W.tell()+1020);let X=W.readUInt32BE(),q=[];for(let $=0;$<X;$++){let Z=W.slice(20).toString("hex");q[$]=Z}W.seek(W.tell()+4*X);let K=new Map;for(let $=0;$<X;$++)K.set(q[$],W.readUInt32BE());let z=W.slice(20).toString("hex");return new o6({hashes:q,crcs:{},offsets:K,packfileSha:z,getExternalRefDelta:J})}static async fromPack({pack:Q,getExternalRefDelta:J,onProgress:W}){let V={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},Y={},X=Q.slice(-20).toString("hex"),q=[],K={},z=new Map,$=null,Z=null;await FN([Q],async({data:F,type:I,reference:L,offset:N,num:O})=>{if($===null)$=O;let A=Math.floor(($-O)*100/$);if(A!==Z){if(W)await W({phase:"Receiving objects",loaded:$-O,total:$})}if(Z=A,I=V[I],["commit","tree","blob","tag"].includes(I))Y[N]={type:I,offset:N};else if(I==="ofs-delta")Y[N]={type:I,offset:N};else if(I==="ref-delta")Y[N]={type:I,offset:N}});let U=Object.keys(Y).map(Number);for(let[F,I]of U.entries()){let L=F+1===U.length?Q.byteLength-20:U[F+1],N=Y[I],O=_D.buf(Q.slice(I,L))>>>0;N.end=L,N.crc=O}let H=new o6({pack:Promise.resolve(Q),packfileSha:X,crcs:K,hashes:q,offsets:z,getExternalRefDelta:J});Z=null;let B=0,j=[0,0,0,0,0,0,0,0,0,0,0,0];for(let F in Y){F=Number(F);let I=Math.floor(B*100/$);if(I!==Z){if(W)await W({phase:"Resolving deltas",loaded:B,total:$})}B++,Z=I;let L=Y[F];if(L.oid)continue;try{H.readDepth=0,H.externalReadDepth=0;let{type:N,object:O}=await H.readSlice({start:F});j[H.readDepth]+=1;let A=await L1(N6.wrap({type:N,object:O}));L.oid=A,q.push(A),z.set(A,F),K[A]=L.crc}catch(N){continue}}return q.sort(),H}async toBuffer(){let Q=[],J=(z,$)=>{Q.push(Buffer.from(z,$))};J("ff744f63","hex"),J("00000002","hex");let W=new q1(Buffer.alloc(1024));for(let z=0;z<256;z++){let $=0;for(let Z of this.hashes)if(parseInt(Z.slice(0,2),16)<=z)$++;W.writeUInt32BE($)}Q.push(W.buffer);for(let z of this.hashes)J(z,"hex");let V=new q1(Buffer.alloc(this.hashes.length*4));for(let z of this.hashes)V.writeUInt32BE(this.crcs[z]);Q.push(V.buffer);let Y=new q1(Buffer.alloc(this.hashes.length*4));for(let z of this.hashes)Y.writeUInt32BE(this.offsets.get(z));Q.push(Y.buffer),J(this.packfileSha,"hex");let X=Buffer.concat(Q),q=await L1(X),K=Buffer.alloc(20);return K.write(q,"hex"),Buffer.concat([X,K])}async load({pack:Q}){this.pack=Q}async unload(){this.pack=null}async read({oid:Q}){if(!this.offsets.get(Q))if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(Q);else throw new u(`Could not read object ${Q} from packfile`);let J=this.offsets.get(Q);return this.readSlice({start:J})}async readSlice({start:Q}){if(this.offsetCache[Q])return Object.assign({},this.offsetCache[Q]);this.readDepth++;let J={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"},W=await this.pack;if(!W)throw new u("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let V=W.slice(Q),Y=new q1(V),X=Y.readUInt8(),q=X&112,K=J[q];if(K===void 0)throw new u("Unrecognized type: 0b"+q.toString(2));let z=X&15,$=z;if(X&128)$=wN(Y,z);let U=null,H=null;if(K==="ofs_delta"){let j=GN(Y),F=Q-j;({object:U,type:K}=await this.readSlice({start:F}))}if(K==="ref_delta"){let j=Y.slice(20).toString("hex");({object:U,type:K}=await this.read({oid:j}))}let B=V.slice(Y.tell());if(H=Buffer.from(await q2(B)),H.byteLength!==$)throw new u(`Packfile told us object would have length ${$} but it had length ${H.byteLength}`);if(U)H=Buffer.from(HN(H,U));if(this.readDepth>3)this.offsetCache[Q]={type:K,object:H};return{type:K,format:"content",object:H}}}var N9=Symbol("PackfileCache");async function LN({fs:Q,filename:J,getExternalRefDelta:W,emitter:V,emitterPrefix:Y}){let X=await Q.read(J);return o6.fromIdx({idx:X,getExternalRefDelta:W})}function rQ({fs:Q,cache:J,filename:W,getExternalRefDelta:V,emitter:Y,emitterPrefix:X}){if(!J[N9])J[N9]=new Map;let q=J[N9].get(W);if(!q)q=LN({fs:Q,filename:W,getExternalRefDelta:V,emitter:Y,emitterPrefix:X}),J[N9].set(W,q);return q}async function MN({fs:Q,cache:J,gitdir:W,oid:V,format:Y="content",getExternalRefDelta:X}){let q=await Q.readdir(S(W,"objects/pack"));q=q.filter((K)=>K.endsWith(".idx"));for(let K of q){let z=`${W}/objects/pack/${K}`,$=await rQ({fs:Q,cache:J,filename:z,getExternalRefDelta:X});if($.error)throw new u($.error);if($.offsets.has(V)){let Z=z.replace(/idx$/,"pack");if(!$.pack)$.pack=Q.read(Z);let U=await $.pack;if(!U)throw $.pack=null,new u(`Could not read packfile at ${Z}. The file may be missing, corrupted, or too large to read into memory.`);if(!$._checksumVerified){let B=$.packfileSha,j=U.subarray(-20),F=Array.from(j).map((N)=>N.toString(16).padStart(2,"0")).join("");if(F!==B)throw new u(`Packfile trailer mismatch: expected ${B}, got ${F}. The packfile may be corrupted.`);let I=U.subarray(0,-20),L=await L1(I);if(L!==B)throw new u(`Packfile payload corrupted: calculated ${L} but expected ${B}. The packfile may have been tampered with.`);$._checksumVerified=!0}let H=await $.read({oid:V,getExternalRefDelta:X});return H.format="content",H.source=`objects/pack/${K.replace(/idx$/,"pack")}`,H}}return null}async function Q0({fs:Q,cache:J,gitdir:W,oid:V,format:Y="content"}){let X=(Z)=>Q0({fs:Q,cache:J,gitdir:W,oid:Z}),q;if(V==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")q={format:"wrapped",object:Buffer.from("tree 0\x00")};if(!q)q=await Y2({fs:Q,gitdir:W,oid:V});if(!q){if(q=await MN({fs:Q,cache:J,gitdir:W,oid:V,getExternalRefDelta:X}),!q)throw new r(V);return q}if(Y==="deflated")return q;if(q.format==="deflated")q.object=Buffer.from(await q2(q.object)),q.format="wrapped";if(Y==="wrapped")return q;let K=await L1(q.object);if(K!==V)throw new u(`SHA check failed! Expected ${V}, computed ${K}`);let{object:z,type:$}=N6.unwrap(q.object);if(q.type=$,q.object=z,q.format="content",Y==="content")return q;throw new u(`invalid requested format "${Y}"`)}class Z1 extends o{constructor(Q,J,W=!0){super(`Failed to create ${Q} at ${J} because it already exists.${W?` (Hint: use 'force: true' parameter to overwrite existing ${Q}.)`:""}`);this.code=this.name=Z1.code,this.data={noun:Q,where:J,canForce:W}}}Z1.code="AlreadyExistsError";class a8 extends o{constructor(Q,J,W){super(`Found multiple ${Q} matching "${J}" (${W.join(", ")}). Use a longer abbreviation length to disambiguate them.`);this.code=this.name=a8.code,this.data={nouns:Q,short:J,matches:W}}}a8.code="AmbiguousError";class i8 extends o{constructor(Q){super(`Your local changes to the following files would be overwritten by checkout: ${Q.join(", ")}`);this.code=this.name=i8.code,this.data={filepaths:Q}}}i8.code="CheckoutConflictError";class s8 extends o{constructor(Q,J){super(`Cannot cherry-pick merge commit ${Q}. Merge commits have ${J} parents and require specifying which parent to use as the base.`);this.code=this.name=s8.code,this.data={oid:Q,parentCount:J}}}s8.code="CherryPickMergeCommitError";class r8 extends o{constructor(Q){super(`Cannot cherry-pick root commit ${Q}. Root commits have no parents.`);this.code=this.name=r8.code,this.data={oid:Q}}}r8.code="CherryPickRootCommitError";class t8 extends o{constructor(Q,J){super(`Failed to checkout "${Q}" because commit ${J} is not available locally. Do a git fetch to make the branch available locally.`);this.code=this.name=t8.code,this.data={ref:Q,oid:J}}}t8.code="CommitNotFetchedError";class e8 extends o{constructor(){super("Empty response from git server.");this.code=this.name=e8.code,this.data={}}}e8.code="EmptyServerResponseError";class Q5 extends o{constructor(){super("A simple fast-forward merge was not possible.");this.code=this.name=Q5.code,this.data={}}}Q5.code="FastForwardError";class J5 extends o{constructor(Q,J){super(`One or more branches were not updated: ${Q}`);this.code=this.name=J5.code,this.data={prettyDetails:Q,result:J}}}J5.code="GitPushError";class a6 extends o{constructor(Q,J,W){super(`HTTP Error: ${Q} ${J}`);this.code=this.name=a6.code,this.data={statusCode:Q,statusMessage:J,response:W}}}a6.code="HttpError";class d1 extends o{constructor(Q){let J="invalid filepath";if(Q==="leading-slash"||Q==="trailing-slash")J='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.';else if(Q==="directory")J='"filepath" should not be a directory.';super(J);this.code=this.name=d1.code,this.data={reason:Q}}}d1.code="InvalidFilepathError";class K1 extends o{constructor(Q,J){super(`"${Q}" would be an invalid git reference. (Hint: a valid alternative would be "${J}".)`);this.code=this.name=K1.code,this.data={ref:Q,suggestion:J}}}K1.code="InvalidRefNameError";class W5 extends o{constructor(Q){super(`Maximum search depth of ${Q} exceeded.`);this.code=this.name=W5.code,this.data={depth:Q}}}W5.code="MaxDepthError";class Q8 extends o{constructor(){super("Merges with conflicts are not supported yet.");this.code=this.name=Q8.code,this.data={}}}Q8.code="MergeNotSupportedError";class I6 extends o{constructor(Q,J,W,V){super(`Automatic merge failed with one or more merge conflicts in the following files: ${Q.toString()}. Fix conflicts then commit the result.`);this.code=this.name=I6.code,this.data={filepaths:Q,bothModified:J,deleteByUs:W,deleteByTheirs:V}}}I6.code="MergeConflictError";class G0 extends o{constructor(Q){super(`No name was provided for ${Q} in the argument or in the .git/config file.`);this.code=this.name=G0.code,this.data={role:Q}}}G0.code="MissingNameError";class x0 extends o{constructor(Q){super(`The function requires a "${Q}" parameter but none was provided.`);this.code=this.name=x0.code,this.data={parameter:Q}}}x0.code="MissingParameterError";class V5 extends o{constructor(Q){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more');this.code=this.name=V5.code,this.data={errors:Q},this.errors=Q}}V5.code="MultipleGitError";class G6 extends o{constructor(Q,J){super(`Expected "${Q}" but received "${J}".`);this.code=this.name=G6.code,this.data={expected:Q,actual:J}}}G6.code="ParseError";class i6 extends o{constructor(Q){let J="";if(Q==="not-fast-forward")J=" because it was not a simple fast-forward";else if(Q==="tag-exists")J=" because tag already exists";super(`Push rejected${J}. Use "force: true" to override.`);this.code=this.name=i6.code,this.data={reason:Q}}}i6.code="PushRejectedError";class f1 extends o{constructor(Q,J){super(`Remote does not support the "${Q}" so the "${J}" parameter cannot be used.`);this.code=this.name=f1.code,this.data={capability:Q,parameter:J}}}f1.code="RemoteCapabilityError";class Y5 extends o{constructor(Q,J){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${Q}`);this.code=this.name=Y5.code,this.data={preview:Q,response:J}}}Y5.code="SmartHttpError";class X5 extends o{constructor(Q,J,W){super(`Git remote "${Q}" uses an unrecognized transport protocol: "${J}"`);this.code=this.name=X5.code,this.data={url:Q,transport:J,suggestion:W}}}X5.code="UnknownTransportError";class q5 extends o{constructor(Q){super(`Cannot parse remote URL: "${Q}"`);this.code=this.name=q5.code,this.data={url:Q}}}q5.code="UrlParseError";class J8 extends o{constructor(){super("The operation was canceled.");this.code=this.name=J8.code,this.data={}}}J8.code="UserCanceledError";class K5 extends o{constructor(Q){super(`Could not merge index: Entry for '${Q}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`);this.code=this.name=K5.code,this.data={filepath:Q}}}K5.code="IndexResetError";class Z5 extends o{constructor(Q){super(`"${Q}" does not point to any commit. You're maybe working on a repository with no commits yet. `);this.code=this.name=Z5.code,this.data={ref:Q}}}Z5.code="NoCommitError";var K2=Object.freeze({__proto__:null,AlreadyExistsError:Z1,AmbiguousError:a8,CheckoutConflictError:i8,CherryPickMergeCommitError:s8,CherryPickRootCommitError:r8,CommitNotFetchedError:t8,EmptyServerResponseError:e8,FastForwardError:Q5,GitPushError:J5,HttpError:a6,InternalError:u,InvalidFilepathError:d1,InvalidOidError:c1,InvalidRefNameError:K1,MaxDepthError:W5,MergeNotSupportedError:Q8,MergeConflictError:I6,MissingNameError:G0,MissingParameterError:x0,MultipleGitError:V5,NoRefspecError:o8,NotFoundError:r,ObjectTypeError:R0,ParseError:G6,PushRejectedError:i6,RemoteCapabilityError:f1,SmartHttpError:Y5,UnknownTransportError:X5,UnsafeFilepathError:e6,UrlParseError:q5,UserCanceledError:J8,UnmergedPathsError:n8,IndexResetError:K5,NoCommitError:Z5});function cQ({name:Q,email:J,timestamp:W,timezoneOffset:V}){return V=PN(V),`${Q} <${J}> ${W} ${V}`}function PN(Q){let J=AN(ON(Q));Q=Math.abs(Q);let W=Math.floor(Q/60);Q-=W*60;let V=String(W),Y=String(Q);if(V.length<2)V="0"+V;if(Y.length<2)Y="0"+Y;return(J===-1?"-":"+")+V+Y}function AN(Q){return Math.sign(Q)||(Object.is(Q,-0)?-1:1)}function ON(Q){return Q===0?Q:-Q}function E1(Q){return Q=Q.replace(/\r/g,""),Q=Q.replace(/^\n+/,""),Q=Q.replace(/\n+$/,"")+`
|
|
45
|
+
`,Q}function M9(Q){let[,J,W,V,Y]=Q.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:J,email:W,timestamp:Number(V),timezoneOffset:CN(Y)}}function CN(Q){let[,J,W,V]=Q.match(/(\+|-)(\d\d)(\d\d)/);return V=(J==="+"?1:-1)*(Number(W)*60+Number(V)),RN(V)}function RN(Q){return Q===0?Q:-Q}class C0{constructor(Q){if(typeof Q==="string")this._tag=Q;else if(Buffer.isBuffer(Q))this._tag=Q.toString("utf8");else if(typeof Q==="object")this._tag=C0.render(Q);else throw new u("invalid type passed to GitAnnotatedTag constructor")}static from(Q){return new C0(Q)}static render(Q){return`object ${Q.object}
|
|
46
|
+
type ${Q.type}
|
|
47
|
+
tag ${Q.tag}
|
|
48
|
+
tagger ${cQ(Q.tagger)}
|
|
49
|
+
|
|
50
|
+
${Q.message}
|
|
51
|
+
${Q.gpgsig?Q.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
|
52
|
+
|
|
53
|
+
`))}message(){let Q=this.withoutSignature();return Q.slice(Q.indexOf(`
|
|
54
|
+
|
|
55
|
+
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let Q=this.justHeaders().split(`
|
|
56
|
+
`),J=[];for(let V of Q)if(V[0]===" ")J[J.length-1]+=`
|
|
57
|
+
`+V.slice(1);else J.push(V);let W={};for(let V of J){let Y=V.slice(0,V.indexOf(" ")),X=V.slice(V.indexOf(" ")+1);if(Array.isArray(W[Y]))W[Y].push(X);else W[Y]=X}if(W.tagger)W.tagger=M9(W.tagger);if(W.committer)W.committer=M9(W.committer);return W}withoutSignature(){let Q=E1(this._tag);if(Q.indexOf(`
|
|
58
|
+
-----BEGIN PGP SIGNATURE-----`)===-1)return Q;return Q.slice(0,Q.lastIndexOf(`
|
|
59
|
+
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
|
60
|
+
-----BEGIN PGP SIGNATURE-----`)===-1)return;let Q=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return E1(Q)}payload(){return this.withoutSignature()+`
|
|
61
|
+
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(Q,J,W){let V=Q.payload(),{signature:Y}=await J({payload:V,secretKey:W});Y=E1(Y);let X=V+Y;return C0.from(X)}}function _Q(Q){return Q.trim().split(`
|
|
62
|
+
`).map((J)=>" "+J).join(`
|
|
63
|
+
`)+`
|
|
64
|
+
`}function TN(Q){return Q.split(`
|
|
65
|
+
`).map((J)=>J.replace(/^ /,"")).join(`
|
|
66
|
+
`)}class V0{constructor(Q){if(typeof Q==="string")this._commit=Q;else if(Buffer.isBuffer(Q))this._commit=Q.toString("utf8");else if(typeof Q==="object")this._commit=V0.render(Q);else throw new u("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:Q,signature:J}){let W=V0.justHeaders(Q),V=V0.justMessage(Q),Y=E1(W+`
|
|
67
|
+
gpgsig`+_Q(J)+`
|
|
68
|
+
`+V);return new V0(Y)}static from(Q){return new V0(Q)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return V0.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(Q){return E1(Q.slice(Q.indexOf(`
|
|
69
|
+
|
|
70
|
+
`)+2))}static justHeaders(Q){return Q.slice(0,Q.indexOf(`
|
|
71
|
+
|
|
72
|
+
`))}parseHeaders(){let Q=V0.justHeaders(this._commit).split(`
|
|
73
|
+
`),J=[];for(let V of Q)if(V[0]===" ")J[J.length-1]+=`
|
|
74
|
+
`+V.slice(1);else J.push(V);let W={parent:[]};for(let V of J){let Y=V.slice(0,V.indexOf(" ")),X=V.slice(V.indexOf(" ")+1);if(Array.isArray(W[Y]))W[Y].push(X);else W[Y]=X}if(W.author)W.author=M9(W.author);if(W.committer)W.committer=M9(W.committer);return W}static renderHeaders(Q){let J="";if(Q.tree)J+=`tree ${Q.tree}
|
|
75
|
+
`;else J+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
76
|
+
`;if(Q.parent){if(Q.parent.length===void 0)throw new u("commit 'parent' property should be an array");for(let Y of Q.parent)J+=`parent ${Y}
|
|
77
|
+
`}let W=Q.author;J+=`author ${cQ(W)}
|
|
78
|
+
`;let V=Q.committer||Q.author;if(J+=`committer ${cQ(V)}
|
|
79
|
+
`,Q.gpgsig)J+="gpgsig"+_Q(Q.gpgsig);return J}static render(Q){return V0.renderHeaders(Q)+`
|
|
80
|
+
`+E1(Q.message)}render(){return this._commit}withoutSignature(){let Q=E1(this._commit);if(Q.indexOf(`
|
|
81
|
+
gpgsig`)===-1)return Q;let J=Q.slice(0,Q.indexOf(`
|
|
82
|
+
gpgsig`)),W=Q.slice(Q.indexOf(`-----END PGP SIGNATURE-----
|
|
83
|
+
`)+28);return E1(J+`
|
|
84
|
+
`+W)}isolateSignature(){let Q=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return TN(Q)}static async sign(Q,J,W){let V=Q.withoutSignature(),Y=V0.justMessage(Q._commit),{signature:X}=await J({payload:V,secretKey:W});X=E1(X);let K=V0.justHeaders(Q._commit)+`
|
|
85
|
+
gpgsig`+_Q(X)+`
|
|
86
|
+
`+Y;return V0.from(K)}}async function s6({fs:Q,cache:J,gitdir:W,oid:V}){if(V==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:b0.from([]),oid:V};let{type:Y,object:X}=await Q0({fs:Q,cache:J,gitdir:W,oid:V});if(Y==="tag")return V=C0.from(X).parse().object,s6({fs:Q,cache:J,gitdir:W,oid:V});if(Y==="commit")return V=V0.from(X).parse().tree,s6({fs:Q,cache:J,gitdir:W,oid:V});if(Y!=="tree")throw new R0(V,Y,"tree");return{tree:b0.from(X),oid:V}}class Z2{constructor({fs:Q,gitdir:J,ref:W,cache:V}){this.fs=Q,this.cache=V,this.gitdir=J,this.mapPromise=(async()=>{let X=new Map,q;try{q=await v.resolve({fs:Q,gitdir:J,ref:W})}catch(z){if(z instanceof r)q="4b825dc642cb6eb9a060e54bf8d69288fbee4904"}let K=await s6({fs:Q,cache:this.cache,gitdir:J,oid:q});return K.type="tree",K.mode="40000",X.set(".",K),X})();let Y=this;this.ConstructEntry=class{constructor(q){this._fullpath=q,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return Y.type(this)}async mode(){return Y.mode(this)}async stat(){return Y.stat(this)}async content(){return Y.content(this)}async oid(){return Y.oid(this)}}}async readdir(Q){let J=Q._fullpath,{fs:W,cache:V,gitdir:Y}=this,X=await this.mapPromise,q=X.get(J);if(!q)throw Error(`No obj for ${J}`);let K=q.oid;if(!K)throw Error(`No oid for obj ${JSON.stringify(q)}`);if(q.type!=="tree")return null;let{type:z,object:$}=await Q0({fs:W,cache:V,gitdir:Y,oid:K});if(z!==q.type)throw new R0(K,z,q.type);let Z=b0.from($);for(let U of Z)X.set(S(J,U.path),U);return Z.entries().map((U)=>S(J,U.path))}async type(Q){if(Q._type===!1){let J=await this.mapPromise,{type:W}=J.get(Q._fullpath);Q._type=W}return Q._type}async mode(Q){if(Q._mode===!1){let J=await this.mapPromise,{mode:W}=J.get(Q._fullpath);Q._mode=eq(parseInt(W,8))}return Q._mode}async stat(Q){}async content(Q){if(Q._content===!1){let J=await this.mapPromise,{fs:W,cache:V,gitdir:Y}=this,q=J.get(Q._fullpath).oid,{type:K,object:z}=await Q0({fs:W,cache:V,gitdir:Y,oid:q});if(K!=="blob")Q._content=void 0;else Q._content=new Uint8Array(z)}return Q._content}async oid(Q){if(Q._oid===!1){let W=(await this.mapPromise).get(Q._fullpath);Q._oid=W.oid}return Q._oid}}function d0({ref:Q="HEAD"}={}){let J=Object.create(null);return Object.defineProperty(J,R9,{value:function({fs:W,gitdir:V,cache:Y}){return new Z2({fs:W,gitdir:V,ref:Q,cache:Y})}}),Object.freeze(J),J}class $2{constructor({fs:Q,dir:J,gitdir:W,cache:V}){this.fs=Q,this.cache=V,this.dir=J,this.gitdir=W,this.config=null;let Y=this;this.ConstructEntry=class{constructor(q){this._fullpath=q,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return Y.type(this)}async mode(){return Y.mode(this)}async stat(){return Y.stat(this)}async content(){return Y.content(this)}async oid(){return Y.oid(this)}}}async readdir(Q){let J=Q._fullpath,{fs:W,dir:V}=this,Y=await W.readdir(S(V,J));if(Y===null)return null;return Y.map((X)=>S(J,X))}async type(Q){if(Q._type===!1)await Q.stat();return Q._type}async mode(Q){if(Q._mode===!1)await Q.stat();return Q._mode}async stat(Q){if(Q._stat===!1){let{fs:J,dir:W}=this,V=await J.lstat(`${W}/${Q._fullpath}`);if(!V)throw Error(`ENOENT: no such file or directory, lstat '${Q._fullpath}'`);let Y=V.isDirectory()?"tree":"blob";if(Y==="blob"&&!V.isFile()&&!V.isSymbolicLink())Y="special";if(Q._type=Y,V=n6(V),Q._mode=V.mode,V.size===-1&&Q._actualSize)V.size=Q._actualSize;Q._stat=V}return Q._stat}async content(Q){if(Q._content===!1){let{fs:J,dir:W,gitdir:V}=this;if(await Q.type()==="tree")Q._content=void 0;else{let Y;if(await Q.mode()>>12===10)Y=await J.readlink(`${W}/${Q._fullpath}`);else{let q=await(await this._getGitConfig(J,V)).get("core.autocrlf");Y=await J.read(`${W}/${Q._fullpath}`,{autocrlf:q})}if(Q._actualSize=Y.length,Q._stat&&Q._stat.size===-1)Q._stat.size=Q._actualSize;Q._content=new Uint8Array(Y)}}return Q._content}async oid(Q){if(Q._oid===!1){let J=this,{fs:W,gitdir:V,cache:Y}=this,X;await $0.acquire({fs:W,gitdir:V,cache:Y},async function(q){let K=q.entriesMap.get(Q._fullpath),z=await Q.stat(),Z=await(await J._getGitConfig(W,V)).get("core.filemode"),U=typeof process<"u"?process.platform!=="win32":!0;if(!K||I9(z,K,Z,U)){let H=await Q.content();if(H===void 0)X=void 0;else if(X=await L1(N6.wrap({type:"blob",object:H})),K&&X===K.oid&&(!Z||z.mode===K.mode)&&I9(z,K,Z,U))q.insert({filepath:Q._fullpath,stats:z,oid:X})}else X=K.oid}),Q._oid=X}return Q._oid}async _getGitConfig(Q,J){if(this.config)return this.config;return this.config=await z0.get({fs:Q,gitdir:J}),this.config}}function W8(){let Q=Object.create(null);return Object.defineProperty(Q,R9,{value:function({fs:J,dir:W,gitdir:V,cache:Y}){return new $2({fs:J,dir:W,gitdir:V,cache:Y})}}),Object.freeze(Q),Q}function SN(Q,J){let W=J-Q;return Array.from({length:W},(V,Y)=>Q+Y)}var z2=typeof Array.prototype.flat>"u"?(Q)=>Q.reduce((J,W)=>J.concat(W),[]):(Q)=>Q.flat();class U2{constructor(){this.value=null}consider(Q){if(Q===null||Q===void 0)return;if(this.value===null)this.value=Q;else if(Q<this.value)this.value=Q}reset(){this.value=null}}function*EN(Q){let J=new U2,W,V=[],Y=Q.length;for(let X=0;X<Y;X++)if(V[X]=Q[X].next().value,V[X]!==void 0)J.consider(V[X]);if(J.value===null)return;while(!0){let X=[];W=J.value,J.reset();for(let q=0;q<Y;q++){if(V[q]!==void 0&&V[q]===W)X[q]=V[q],V[q]=Q[q].next().value;else X[q]=null;if(V[q]!==void 0)J.consider(V[q])}if(yield X,J.value===null)return}}async function l1({fs:Q,cache:J,dir:W,gitdir:V,trees:Y,map:X=async(z,$)=>$,reduce:q=async(z,$)=>{let Z=z2($);if(z!==void 0)Z.unshift(z);return Z},iterate:K=(z,$)=>Promise.all([...$].map(z))}){let z=Y.map((B)=>B[R9]({fs:Q,dir:W,gitdir:V,cache:J})),$=Array(z.length).fill("."),Z=SN(0,z.length),U=async(B)=>{Z.forEach((I)=>{let L=B[I];B[I]=L&&new z[I].ConstructEntry(L)});let F=(await Promise.all(Z.map((I)=>{let L=B[I];return L?z[I].readdir(L):[]}))).map((I)=>{return(I===null?[]:I)[Symbol.iterator]()});return{entries:B,children:EN(F)}},H=async(B)=>{let{entries:j,children:F}=await U(B),I=j.find((N)=>N&&N._fullpath)._fullpath,L=await X(I,j);if(L!==null){let N=await K(H,F);return N=N.filter((O)=>O!==void 0),q(L,N)}};return H($)}async function dQ(Q,J){let W=await Q.readdir(J);if(W==null)await Q.rm(J);else if(W.length)await Promise.all(W.map((V)=>{let Y=S(J,V);return Q.lstat(Y).then((X)=>{if(!X)return;return X.isDirectory()?dQ(Q,Y):Q.rm(Y)})})).then(()=>Q.rmdir(J));else await Q.rmdir(J)}function vN(Q){return kN(Q)&&hq(Q.then)&&hq(Q.catch)}function kN(Q){return Q&&typeof Q==="object"}function hq(Q){return typeof Q==="function"}function gq(Q){return vN(((W)=>{try{return W.readFile().catch((V)=>V)}catch(V){return V}})(Q))}var pq=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function uq(Q,J){if(gq(J))for(let W of pq)Q[`_${W}`]=J[W].bind(J);else for(let W of pq)Q[`_${W}`]=F9(J[W].bind(J));if(gq(J)){if(J.cp)Q._cp=J.cp.bind(J);if(J.rm)Q._rm=J.rm.bind(J);else if(J.rmdir.length>1)Q._rm=J.rmdir.bind(J);else Q._rm=dQ.bind(null,Q)}else{if(J.cp)Q._cp=F9(J.cp.bind(J));if(J.rm)Q._rm=F9(J.rm.bind(J));else if(J.rmdir.length>2)Q._rm=F9(J.rmdir.bind(J));else Q._rm=dQ.bind(null,Q)}}class y{constructor(Q){if(typeof Q._original_unwrapped_fs<"u")return Q;let J=Object.getOwnPropertyDescriptor(Q,"promises");if(J&&J.enumerable)uq(this,Q.promises);else uq(this,Q);this._original_unwrapped_fs=Q}async exists(Q,J={}){try{return await this._stat(Q),!0}catch(W){if(W.code==="ENOENT"||W.code==="ENOTDIR"||(W.code||"").includes("ENS"))return!1;else throw console.log('Unhandled error in "FileSystem.exists()" function',W),W}}async read(Q,J={}){try{let W=await this._readFile(Q,J);if(J.autocrlf==="true")try{W=new TextDecoder("utf8",{fatal:!0}).decode(W),W=W.replace(/\r\n/g,`
|
|
87
|
+
`),W=new TextEncoder().encode(W)}catch(V){}if(typeof W!=="string")W=Buffer.from(W);return W}catch(W){return null}}async write(Q,J,W={}){try{await this._writeFile(Q,J,W)}catch(V){await this.mkdir(j6(Q)),await this._writeFile(Q,J,W)}}async mkdir(Q,J=!1){try{await this._mkdir(Q)}catch(W){if(W===null)return;if(W.code==="EEXIST")return;if(J)throw W;if(W.code==="ENOENT"){let V=j6(Q);if(V==="."||V==="/"||V===Q)throw W;await this.mkdir(V),await this.mkdir(Q,!0)}}}async rm(Q){try{await this._unlink(Q)}catch(J){if(J.code!=="ENOENT")throw J}}async rmdir(Q,J){try{if(J&&J.recursive)await this._rm(Q,J);else await this._rmdir(Q)}catch(W){if(W.code!=="ENOENT")throw W}}async readdir(Q){try{let J=await this._readdir(Q);return J.sort(C9),J}catch(J){if(J.code==="ENOTDIR")return null;return[]}}async readdirDeep(Q){let J=await this._readdir(Q);return(await Promise.all(J.map(async(V)=>{let Y=Q+"/"+V;return(await this._stat(Y)).isDirectory()?this.readdirDeep(Y):Y}))).reduce((V,Y)=>V.concat(Y),[])}async lstat(Q){try{return await this._lstat(Q)}catch(J){if(J.code==="ENOENT"||(J.code||"").includes("ENS"))return null;throw J}}async readlink(Q,J={encoding:"buffer"}){try{let W=await this._readlink(Q,J);return Buffer.isBuffer(W)?W:Buffer.from(W)}catch(W){if(W.code==="ENOENT"||(W.code||"").includes("ENS"))return null;throw W}}async writelink(Q,J){return this._symlink(J.toString("utf8"),Q)}}function w(Q,J){if(J===void 0)throw new x0(Q)}function xN(Q){return Q.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(Q)}async function h({fsp:Q,dotgit:J}){w("fsp",Q),w("dotgit",J);let W=await Q._stat(J).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));if(W.isDirectory())return J;else if(W.isFile())return Q._readFile(J,"utf8").then((V)=>V.trimRight().substr(8)).then((V)=>{if(xN(V))return V;return S(j6(J),V)});else return J}async function P9(Q,J){if(!Q&&!J)return!1;if(Q&&!J)return!0;if(!Q&&J)return!0;if(await Q.type()==="tree"&&await J.type()==="tree")return!1;if(await Q.type()===await J.type()&&await Q.mode()===await J.mode()&&await Q.oid()===await J.oid())return!1;return!0}async function H2({fs:Q,dir:J,gitdir:W=S(J,".git"),commit:V="HEAD",cache:Y={}}){try{w("fs",Q),w("dir",J),w("gitdir",W);let X=new y(Q),q=[d0({ref:V}),W8(),D6()],K=[],z=await h({fsp:X,dotgit:W});await $0.acquire({fs:X,gitdir:z,cache:Y},async function(Z){K=Z.unmergedPaths});let $=await l1({fs:X,cache:Y,dir:J,gitdir:z,trees:q,map:async function(Z,[U,H,B]){let j=!await P9(H,B),F=K.includes(Z),I=!await P9(B,U);if(j||F)return U?{path:Z,mode:await U.mode(),oid:await U.oid(),type:await U.type(),content:await U.content()}:void 0;if(I)return!1;else throw new K5(Z)}});await $0.acquire({fs:X,gitdir:z,cache:Y},async function(Z){for(let U of $){if(U===!1)continue;if(!U){await X.rmdir(`${J}/${U.path}`,{recursive:!0}),Z.delete({filepath:U.path});continue}if(U.type==="blob"){let H=new TextDecoder().decode(U.content);await X.write(`${J}/${U.path}`,H,{mode:U.mode}),Z.insert({filepath:U.path,oid:U.oid,stage:0})}}})}catch(X){throw X.caller="git.abortMerge",X}}class w6{static async isIgnored({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V}){if(G9(V)===".git")return!0;if(V===".")return!1;let Y="",X=S(W,"info","exclude");if(await Q.exists(X))Y=await Q.read(X,"utf8");let q=[{gitignore:S(J,".gitignore"),filepath:V}],K=V.split("/").filter(Boolean);for(let $=1;$<K.length;$++){let Z=K.slice(0,$).join("/"),U=K.slice($).join("/");q.push({gitignore:S(J,Z,".gitignore"),filepath:U})}let z=!1;for(let $ of q){let Z;try{Z=await Q.read($.gitignore,"utf8")}catch(B){if(B.code==="NOENT")continue}let U=yD().add(Y);U.add(Z);let H=j6($.filepath);if(H!=="."&&U.ignores(H))return!0;if(z)z=!U.test($.filepath).unignored;else z=U.test($.filepath).ignored}return z}}async function bN({fs:Q,gitdir:J,object:W,format:V,oid:Y}){if(V!=="deflated")throw new u("GitObjectStoreLoose expects objects to write to be in deflated format");let X=`objects/${Y.slice(0,2)}/${Y.slice(2)}`,q=`${J}/${X}`;if(!await Q.exists(q))await Q.write(q,W)}var yQ=null;async function B2(Q){if(yQ===null)yQ=yN();return yQ?_N(Q):oQ.deflate(Q)}async function _N(Q){let J=new CompressionStream("deflate"),W=new Blob([Q]).stream().pipeThrough(J);return new Uint8Array(await new Response(W).arrayBuffer())}function yN(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(Q){return!1}}async function _0({fs:Q,gitdir:J,type:W,object:V,format:Y="content",oid:X=void 0,dryRun:q=!1}){if(Y!=="deflated"){if(Y!=="wrapped")V=N6.wrap({type:W,object:V});X=await L1(V),V=Buffer.from(await B2(V))}if(!q)await bN({fs:Q,gitdir:J,object:V,format:"deflated",oid:X});return X}function j2(Q){let J;while(~(J=Q.indexOf(92)))Q[J]=47;return Q}async function F2({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V,cache:Y={},force:X=!1,parallel:q=!0}){try{w("fs",Q),w("dir",J),w("gitdir",W),w("filepath",V);let K=new y(Q),z=await h({fsp:K,dotgit:W});await $0.acquire({fs:K,gitdir:z,cache:Y},async($)=>{let U=await(await z0.get({fs:K,gitdir:z})).get("core.autocrlf");return lQ({dir:J,gitdir:z,fs:K,filepath:V,index:$,force:X,parallel:q,autocrlf:U})})}catch(K){throw K.caller="git.add",K}}async function lQ({dir:Q,gitdir:J,fs:W,filepath:V,index:Y,force:X,parallel:q,autocrlf:K}){V=Array.isArray(V)?V:[V];let z=V.map(async(H)=>{if(!X){if(await w6.isIgnored({fs:W,dir:Q,gitdir:J,filepath:H}))return}let B=await W.lstat(S(Q,H));if(!B)throw new r(H);if(B.isDirectory()){let j=await W.readdir(S(Q,H));if(q){let F=j.map((I)=>lQ({dir:Q,gitdir:J,fs:W,filepath:[S(H,I)],index:Y,force:X,parallel:q,autocrlf:K}));await Promise.all(F)}else for(let F of j)await lQ({dir:Q,gitdir:J,fs:W,filepath:[S(H,F)],index:Y,force:X,parallel:q,autocrlf:K})}else{let j=B.isSymbolicLink()?await W.readlink(S(Q,H)).then(j2):await W.read(S(Q,H),{autocrlf:K});if(j===null)throw new r(H);let F=await _0({fs:W,gitdir:J,type:"blob",object:j});Y.insert({filepath:H,stats:B,oid:F})}}),$=await Promise.allSettled(z),Z=$.filter((H)=>H.status==="rejected").map((H)=>H.reason);if(Z.length>1)throw new V5(Z);if(Z.length===1)throw Z[0];return $.filter((H)=>H.status==="fulfilled"&&H.value).map((H)=>H.value)}async function c8({fs:Q,gitdir:J,path:W}){return(await z0.get({fs:Q,gitdir:J})).get(W)}function D2(Q,...J){for(let W of J)if(W)for(let V of Object.keys(W)){let Y=W[V];if(Y!==void 0)Q[V]=Y}return Q}async function n1({fs:Q,gitdir:J,author:W,commit:V}){let Y=Math.floor(Date.now()/1000),X={name:await c8({fs:Q,gitdir:J,path:"user.name"}),email:await c8({fs:Q,gitdir:J,path:"user.email"})||"",timestamp:Y,timezoneOffset:new Date(Y*1000).getTimezoneOffset()},q=D2({},X,V?V.author:void 0,W);if(q.name===void 0)return;return q}async function F6({fs:Q,gitdir:J,author:W,committer:V,commit:Y}){let X=Math.floor(Date.now()/1000),q={name:await c8({fs:Q,gitdir:J,path:"user.name"}),email:await c8({fs:Q,gitdir:J,path:"user.email"})||"",timestamp:X,timezoneOffset:new Date(X*1000).getTimezoneOffset()},K=D2({},q,Y?Y.committer:void 0,W,V);if(K.name===void 0)return;return K}async function N2({fs:Q,cache:J,gitdir:W,oid:V}){let{type:Y,object:X}=await Q0({fs:Q,cache:J,gitdir:W,oid:V});if(Y==="tag")return V=C0.from(X).parse().object,N2({fs:Q,cache:J,gitdir:W,oid:V});if(Y!=="commit")throw new R0(V,Y,"commit");return{commit:V0.from(X),oid:V}}async function w1({fs:Q,cache:J,gitdir:W,oid:V}){let{commit:Y,oid:X}=await N2({fs:Q,cache:J,gitdir:W,oid:V});return{oid:X,commit:Y.parse(),payload:Y.withoutSignature()}}async function $5({fs:Q,cache:J,onSign:W,gitdir:V,message:Y,author:X,committer:q,signingKey:K,amend:z=!1,dryRun:$=!1,noUpdateBranch:Z=!1,ref:U,parent:H,tree:B}){let j=!1,F=!1;if(!U)F=!(await Q.read(`${V}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),U=await v.resolve({fs:Q,gitdir:V,ref:"HEAD",depth:2});let I,L;try{I=await v.resolve({fs:Q,gitdir:V,ref:U}),L=await w1({fs:Q,gitdir:V,oid:I,cache:{}})}catch{j=!0}if(z&&j)throw new Z5(U);let N=!z?await n1({fs:Q,gitdir:V,author:X}):await n1({fs:Q,gitdir:V,author:X,commit:L.commit});if(!N)throw new G0("author");let O=!z?await F6({fs:Q,gitdir:V,author:N,committer:q}):await F6({fs:Q,gitdir:V,author:N,committer:q,commit:L.commit});if(!O)throw new G0("committer");return $0.acquire({fs:Q,gitdir:V,cache:J,allowUnmerged:!1},async function(A){let T=J2(A.entries).get(".");if(!B)B=await I2({fs:Q,gitdir:V,inode:T,dryRun:$});if(!H)if(!z)H=I?[I]:[];else H=L.commit.parent;else H=await Promise.all(H.map((G)=>{return v.resolve({fs:Q,gitdir:V,ref:G})}));if(!Y)if(!z)throw new x0("message");else Y=L.commit.message;let D=V0.from({tree:B,parent:H,author:N,committer:O,message:Y});if(K)D=await V0.sign(D,W,K);let M=await _0({fs:Q,gitdir:V,type:"commit",object:D.toObject(),dryRun:$});if(!Z&&!$)await v.writeRef({fs:Q,gitdir:V,ref:F?"HEAD":U,value:M});return M})}async function I2({fs:Q,gitdir:J,inode:W,dryRun:V}){let Y=W.children;for(let z of Y)if(z.type==="tree")z.metadata.mode="040000",z.metadata.oid=await I2({fs:Q,gitdir:J,inode:z,dryRun:V});let X=Y.map((z)=>({mode:z.metadata.mode,path:z.basename,oid:z.metadata.oid,type:z.type})),q=b0.from(X);return await _0({fs:Q,gitdir:J,type:"tree",object:q.toObject(),dryRun:V})}async function z5({fs:Q,cache:J,gitdir:W,oid:V,filepath:Y}){if(Y.startsWith("/"))throw new d1("leading-slash");else if(Y.endsWith("/"))throw new d1("trailing-slash");let X=V,q=await s6({fs:Q,cache:J,gitdir:W,oid:V}),K=q.tree;if(Y==="")V=q.oid;else{let z=Y.split("/");V=await G2({fs:Q,cache:J,gitdir:W,tree:K,pathArray:z,oid:X,filepath:Y})}return V}async function G2({fs:Q,cache:J,gitdir:W,tree:V,pathArray:Y,oid:X,filepath:q}){let K=Y.shift();for(let z of V)if(z.path===K)if(Y.length===0)return z.oid;else{let{type:$,object:Z}=await Q0({fs:Q,cache:J,gitdir:W,oid:z.oid});if($!=="tree")throw new R0(X,$,"tree",q);return V=b0.from(Z),G2({fs:Q,cache:J,gitdir:W,tree:V,pathArray:Y,oid:X,filepath:q})}throw new r(`file or directory found at "${X}:${q}"`)}async function V8({fs:Q,cache:J,gitdir:W,oid:V,filepath:Y=void 0}){if(Y!==void 0)V=await z5({fs:Q,cache:J,gitdir:W,oid:V,filepath:Y});let{tree:X,oid:q}=await s6({fs:Q,cache:J,gitdir:W,oid:V});return{oid:q,tree:X.entries()}}async function U5({fs:Q,gitdir:J,tree:W}){let V=b0.from(W).toObject();return await _0({fs:Q,gitdir:J,type:"tree",object:V,format:"content"})}async function hN({fs:Q,cache:J,onSign:W,gitdir:V,ref:Y,oid:X,note:q,force:K,author:z,committer:$,signingKey:Z}){let U;try{U=await v.resolve({gitdir:V,fs:Q,ref:Y})}catch(L){if(!(L instanceof r))throw L}let B=(await V8({fs:Q,cache:J,gitdir:V,oid:U||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(K)B=B.filter((L)=>L.path!==X);else for(let L of B)if(L.path===X)throw new Z1("note",X);if(typeof q==="string")q=Buffer.from(q,"utf8");let j=await _0({fs:Q,gitdir:V,type:"blob",object:q,format:"content"});B.push({mode:"100644",path:X,oid:j,type:"blob"});let F=await U5({fs:Q,gitdir:V,tree:B});return await $5({fs:Q,cache:J,onSign:W,gitdir:V,ref:Y,tree:F,parent:U&&[U],message:`Note added by 'isomorphic-git addNote'
|
|
88
|
+
`,author:z,committer:$,signingKey:Z})}async function w2({fs:Q,onSign:J,dir:W,gitdir:V=S(W,".git"),ref:Y="refs/notes/commits",oid:X,note:q,force:K,author:z,committer:$,signingKey:Z,cache:U={}}){try{if(w("fs",Q),w("gitdir",V),w("oid",X),w("note",q),Z)w("onSign",J);let H=new y(Q),B=await n1({fs:H,gitdir:V,author:z});if(!B)throw new G0("author");let j=await F6({fs:H,gitdir:V,author:B,committer:$});if(!j)throw new G0("committer");let F=await h({fsp:H,dotgit:V});return await hN({fs:H,cache:U,onSign:J,gitdir:F,ref:Y,oid:X,note:q,force:K,author:B,committer:j,signingKey:Z})}catch(H){throw H.caller="git.addNote",H}}var gN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function d8(Q,J){if(typeof Q!=="string")throw TypeError("Reference name must be a string");return!gN.test(Q)&&(!!J||Q.includes("/"))}async function L2({fs:Q,gitdir:J,remote:W,url:V,force:Y}){if(!d8(W,!0))throw new K1(W,f8.clean(W));let X=await z0.get({fs:Q,gitdir:J});if(!Y){if((await X.getSubsections("remote")).includes(W)){if(V!==await X.get(`remote.${W}.url`))throw new Z1("remote",W)}}await X.set(`remote.${W}.url`,V),await X.set(`remote.${W}.fetch`,`+refs/heads/*:refs/remotes/${W}/*`),await z0.save({fs:Q,gitdir:J,config:X})}async function M2({fs:Q,dir:J,gitdir:W=S(J,".git"),remote:V,url:Y,force:X=!1}){try{w("fs",Q),w("gitdir",W),w("remote",V),w("url",Y);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await L2({fs:q,gitdir:K,remote:V,url:Y,force:X})}catch(q){throw q.caller="git.addRemote",q}}async function pN({fs:Q,cache:J,onSign:W,gitdir:V,ref:Y,tagger:X,message:q=Y,gpgsig:K,object:z,signingKey:$,force:Z=!1}){if(Y=Y.startsWith("refs/tags/")?Y:`refs/tags/${Y}`,!Z&&await v.exists({fs:Q,gitdir:V,ref:Y}))throw new Z1("tag",Y);let U=await v.resolve({fs:Q,gitdir:V,ref:z||"HEAD"}),{type:H}=await Q0({fs:Q,cache:J,gitdir:V,oid:U}),B=C0.from({object:U,type:H,tag:Y.replace("refs/tags/",""),tagger:X,message:q,gpgsig:K});if($)B=await C0.sign(B,W,$);let j=await _0({fs:Q,gitdir:V,type:"tag",object:B.toObject()});await v.writeRef({fs:Q,gitdir:V,ref:Y,value:j})}async function P2({fs:Q,onSign:J,dir:W,gitdir:V=S(W,".git"),ref:Y,tagger:X,message:q=Y,gpgsig:K,object:z,signingKey:$,force:Z=!1,cache:U={}}){try{if(w("fs",Q),w("gitdir",V),w("ref",Y),$)w("onSign",J);let H=new y(Q),B=await h({fsp:H,dotgit:V}),j=await n1({fs:H,gitdir:B,author:X});if(!j)throw new G0("tagger");return await pN({fs:H,cache:U,onSign:J,gitdir:B,ref:Y,tagger:j,message:q,gpgsig:K,object:z,signingKey:$,force:Z})}catch(H){throw H.caller="git.annotatedTag",H}}async function uN({fs:Q,gitdir:J,ref:W,object:V,checkout:Y=!1,force:X=!1}){if(!d8(W,!0))throw new K1(W,f8.clean(W));let q=`refs/heads/${W}`;if(!X){if(await v.exists({fs:Q,gitdir:J,ref:q}))throw new Z1("branch",W,!1)}let K;try{K=await v.resolve({fs:Q,gitdir:J,ref:V||"HEAD"})}catch(z){}if(K)await v.writeRef({fs:Q,gitdir:J,ref:q,value:K});if(Y)await v.writeSymbolicRef({fs:Q,gitdir:J,ref:"HEAD",value:q})}async function A2({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,object:Y,checkout:X=!1,force:q=!1}){try{w("fs",Q),w("gitdir",W),w("ref",V);let K=new y(Q),z=await h({fsp:K,dotgit:W});return await uN({fs:K,gitdir:z,ref:V,object:Y,checkout:X,force:q})}catch(K){throw K.caller="git.branch",K}}var O2=(Q,J)=>{if(Q==="."||J==null||J.length===0||J===".")return!0;if(J.length>=Q.length)return J.startsWith(Q);else return Q.startsWith(J)};async function tQ({fs:Q,cache:J,onProgress:W,onPostCheckout:V,dir:Y,gitdir:X,remote:q,ref:K,filepaths:z,noCheckout:$,noUpdateHead:Z,dryRun:U,force:H,track:B=!0,nonBlocking:j=!1,batchSize:F=100}){let I;if(V)try{I=await v.resolve({fs:Q,gitdir:X,ref:"HEAD"})}catch(N){I="0000000000000000000000000000000000000000"}let L;try{L=await v.resolve({fs:Q,gitdir:X,ref:K})}catch(N){if(K==="HEAD")throw N;let O=`${q}/${K}`;if(L=await v.resolve({fs:Q,gitdir:X,ref:O}),B){let A=await z0.get({fs:Q,gitdir:X});await A.set(`branch.${K}.remote`,q),await A.set(`branch.${K}.merge`,`refs/heads/${K}`),await z0.save({fs:Q,gitdir:X,config:A})}await v.writeRef({fs:Q,gitdir:X,ref:`refs/heads/${K}`,value:L})}if(!$){let N;try{N=await mN({fs:Q,cache:J,onProgress:W,dir:Y,gitdir:X,ref:K,force:H,filepaths:z})}catch(D){if(D instanceof r&&D.data.what===L)throw new t8(K,L);else throw D}let O=N.filter(([D])=>D==="conflict").map(([D,M])=>M);if(O.length>0)throw new i8(O);let A=N.filter(([D])=>D==="error").map(([D,M])=>M);if(A.length>0)throw new u(A.join(", "));if(U){if(V)await V({previousHead:I,newHead:L,type:z!=null&&z.length>0?"file":"branch"});return}let P=0,T=N.length;if(await $0.acquire({fs:Q,gitdir:X,cache:J},async function(D){await Promise.all(N.filter(([M])=>M==="delete"||M==="delete-index").map(async function([M,G]){let R=`${Y}/${G}`;if(M==="delete")await Q.rm(R);if(D.delete({filepath:G}),W)await W({phase:"Updating workdir",loaded:++P,total:T})}))}),await $0.acquire({fs:Q,gitdir:X,cache:J},async function(D){for(let[M,G]of N)if(M==="rmdir"||M==="rmdir-index"){let R=`${Y}/${G}`;try{if(M==="rmdir")await Q.rmdir(R);if(D.delete({filepath:G}),W)await W({phase:"Updating workdir",loaded:++P,total:T})}catch(C){if(C.code==="ENOTEMPTY")console.log(`Did not delete ${G} because directory is not empty`);else throw C}}}),await Promise.all(N.filter(([D])=>D==="mkdir"||D==="mkdir-index").map(async function([D,M]){let G=`${Y}/${M}`;if(await Q.mkdir(G),W)await W({phase:"Updating workdir",loaded:++P,total:T})})),j){let D=N.filter(([G])=>G==="create"||G==="create-index"||G==="update"||G==="mkdir-index"),M=await mq("Update Working Dir",D.map(([G,R,C,x,g])=>()=>cN({fs:Q,cache:J,gitdir:X,dir:Y},[G,R,C,x,g])),W,F);await $0.acquire({fs:Q,gitdir:X,cache:J,allowUnmerged:!0},async function(G){await mq("Update Index",M.map(([R,C,x])=>()=>fN({index:G,fullpath:R,oid:C,stats:x})),W,F)})}else await $0.acquire({fs:Q,gitdir:X,cache:J,allowUnmerged:!0},async function(D){await Promise.all(N.filter(([M])=>M==="create"||M==="create-index"||M==="update"||M==="mkdir-index").map(async function([M,G,R,C,x]){let g=`${Y}/${G}`;try{if(M!=="create-index"&&M!=="mkdir-index"){let{object:s}=await Q0({fs:Q,cache:J,gitdir:X,oid:R});if(x)await Q.rm(g);if(C===33188)await Q.write(g,s);else if(C===33261)await Q.write(g,s,{mode:511});else if(C===40960)await Q.writelink(g,s);else throw new u(`Invalid mode 0o${C.toString(8)} detected in blob ${R}`)}let m=await Q.lstat(g);if(C===33261)m.mode=493;if(M==="mkdir-index")m.mode=57344;if(D.insert({filepath:G,stats:m,oid:R}),W)await W({phase:"Updating workdir",loaded:++P,total:T})}catch(m){console.log(m)}}))});if(V)await V({previousHead:I,newHead:L,type:z!=null&&z.length>0?"file":"branch"})}if(!Z){let N=await v.expand({fs:Q,gitdir:X,ref:K});if(N.startsWith("refs/heads"))await v.writeSymbolicRef({fs:Q,gitdir:X,ref:"HEAD",value:N});else await v.writeRef({fs:Q,gitdir:X,ref:"HEAD",value:L})}}async function mN({fs:Q,cache:J,onProgress:W,dir:V,gitdir:Y,ref:X,force:q,filepaths:K}){let z=0;return l1({fs:Q,cache:J,dir:V,gitdir:Y,trees:[d0({ref:X}),W8(),D6()],map:async function($,[Z,U,H]){if($===".")return;if(K&&!K.some((j)=>O2($,j)))return null;if(W)await W({phase:"Analyzing workdir",loaded:++z});switch([!!H,!!Z,!!U].map(Number).join("")){case"000":return;case"001":if(q&&K&&K.includes($))return["delete",$];return;case"010":switch(await Z.type()){case"tree":return["mkdir",$];case"blob":return["create",$,await Z.oid(),await Z.mode()];case"commit":return["mkdir-index",$,await Z.oid(),await Z.mode()];default:return["error",`new entry Unhandled type ${await Z.type()}`]}case"011":switch(`${await Z.type()}-${await U.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",$];case"blob-blob":if(await Z.oid()!==await U.oid())if(q)return["update",$,await Z.oid(),await Z.mode(),await Z.mode()!==await U.mode()];else return["conflict",$];else if(await Z.mode()!==await U.mode())if(q)return["update",$,await Z.oid(),await Z.mode(),!0];else return["conflict",$];else return["create-index",$,await Z.oid(),await Z.mode()];case"commit-tree":return;case"commit-blob":return["conflict",$];default:return["error",`new entry Unhandled type ${Z.type}`]}case"100":return["delete-index",$];case"101":switch(await H.type()){case"tree":return["rmdir-index",$];case"blob":if(await H.oid()!==await U.oid())if(q)return["delete",$];else return["conflict",$];else return["delete",$];case"commit":return["rmdir-index",$];default:return["error",`delete entry Unhandled type ${await H.type()}`]}case"110":case"111":switch(`${await H.type()}-${await Z.type()}`){case"tree-tree":return;case"blob-blob":{if(await H.oid()===await Z.oid()&&await H.mode()===await Z.mode()&&!q)return;if(U){if(await U.oid()!==await H.oid()&&await U.oid()!==await Z.oid())if(q)return["update",$,await Z.oid(),await Z.mode(),await Z.mode()!==await U.mode()];else return["conflict",$]}else if(q)return["update",$,await Z.oid(),await Z.mode(),await Z.mode()!==await H.mode()];if(await Z.mode()!==await H.mode())return["update",$,await Z.oid(),await Z.mode(),!0];if(await Z.oid()!==await H.oid())return["update",$,await Z.oid(),await Z.mode(),!1];else return}case"tree-blob":return["update-dir-to-blob",$,await Z.oid()];case"blob-tree":return["update-blob-to-tree",$];case"commit-commit":return["mkdir-index",$,await Z.oid(),await Z.mode()];default:return["error",`update entry Unhandled type ${await H.type()}-${await Z.type()}`]}}},reduce:async function($,Z){if(Z=z2(Z),!$)return Z;else if($&&$[0]==="rmdir")return Z.push($),Z;else return Z.unshift($),Z}})}async function fN({index:Q,fullpath:J,stats:W,oid:V}){try{Q.insert({filepath:J,stats:W,oid:V})}catch(Y){console.warn(`Error inserting ${J} into index:`,Y)}}async function cN({fs:Q,cache:J,gitdir:W,dir:V},[Y,X,q,K,z]){let $=`${V}/${X}`;if(Y!=="create-index"&&Y!=="mkdir-index"){let{object:U}=await Q0({fs:Q,cache:J,gitdir:W,oid:q});if(z)await Q.rm($);if(K===33188)await Q.write($,U);else if(K===33261)await Q.write($,U,{mode:511});else if(K===40960)await Q.writelink($,U);else throw new u(`Invalid mode 0o${K.toString(8)} detected in blob ${q}`)}let Z=await Q.lstat($);if(K===33261)Z.mode=493;if(Y==="mkdir-index")Z.mode=57344;return[X,q,Z]}async function mq(Q,J,W,V){let Y=[];try{for(let X=0;X<J.length;X+=V){let q=J.slice(X,X+V).map((z)=>z());if((await Promise.allSettled(q)).forEach((z)=>{if(z.status==="fulfilled")Y.push(z.value)}),W)await W({phase:"Updating workdir",loaded:X+q.length,total:J.length})}return Y}catch(X){console.error(`Error during ${Q}: ${X}`)}return Y}async function eQ({fs:Q,onProgress:J,onPostCheckout:W,dir:V,gitdir:Y=S(V,".git"),remote:X="origin",ref:q,filepaths:K,noCheckout:z=!1,noUpdateHead:$=q===void 0,dryRun:Z=!1,force:U=!1,track:H=!0,cache:B={},nonBlocking:j=!1,batchSize:F=100}){try{w("fs",Q),w("dir",V),w("gitdir",Y);let I=q||"HEAD",L=new y(Q),N=await h({fsp:L,dotgit:Y});return await tQ({fs:L,cache:B,onProgress:J,onPostCheckout:W,dir:V,gitdir:N,remote:X,ref:I,filepaths:K,noCheckout:z,noUpdateHead:$,dryRun:Z,force:U,track:H,nonBlocking:j,batchSize:F})}catch(I){throw I.caller="git.checkout",I}}var hQ=/^.*(\r?\n|$)/gm;function dN({branches:Q,contents:J}){let W=Q[1],V=Q[2],Y=J[0],X=J[1],q=J[2],K=X.match(hQ),z=Y.match(hQ),$=q.match(hQ),Z=hD(K,z,$),U=7,H="",B=!0;for(let j of Z){if(j.ok)H+=j.ok.join("");if(j.conflict)B=!1,H+=`${"<".repeat(7)} ${W}
|
|
89
|
+
`,H+=j.conflict.a.join(""),H+=`${"=".repeat(7)}
|
|
90
|
+
`,H+=j.conflict.b.join(""),H+=`${">".repeat(7)} ${V}
|
|
91
|
+
`}return{cleanMerge:B,mergedText:H}}async function C2({fs:Q,cache:J,dir:W,gitdir:V=S(W,".git"),index:Y,ourOid:X,baseOid:q,theirOid:K,ourName:z="ours",baseName:$="base",theirName:Z="theirs",dryRun:U=!1,abortOnConflict:H=!0,mergeDriver:B}){let j=d0({ref:X}),F=d0({ref:q}),I=d0({ref:K}),L=[],N=[],O=[],A=[],P=await l1({fs:Q,cache:J,dir:W,gitdir:V,trees:[j,F,I],map:async function(T,[D,M,G]){let R=G9(T),C=await P9(D,M),x=await P9(G,M);switch(`${C}-${x}`){case"false-false":return{mode:await M.mode(),path:R,oid:await M.oid(),type:await M.type()};case"false-true":{if(!G&&await D.type()==="tree")return{mode:await D.mode(),path:R,oid:await D.oid(),type:await D.type()};return G?{mode:await G.mode(),path:R,oid:await G.oid(),type:await G.type()}:void 0}case"true-false":{if(!D&&await G.type()==="tree")return{mode:await G.mode(),path:R,oid:await G.oid(),type:await G.type()};return D?{mode:await D.mode(),path:R,oid:await D.oid(),type:await D.type()}:void 0}case"true-true":{if(D&&G&&await D.type()==="tree"&&await G.type()==="tree")return{mode:await D.mode(),path:R,oid:await D.oid(),type:"tree"};if(D&&G&&await D.type()==="blob"&&await G.type()==="blob")return lN({fs:Q,gitdir:V,path:R,ours:D,base:M,theirs:G,ourName:z,baseName:$,theirName:Z,mergeDriver:B}).then(async(g)=>{if(!g.cleanMerge){if(L.push(T),N.push(T),!H){let m="";if(M&&await M.type()==="blob")m=await M.oid();let s=await D.oid(),o0=await G.oid();if(Y.delete({filepath:T}),m)Y.insert({filepath:T,oid:m,stage:1});Y.insert({filepath:T,oid:s,stage:2}),Y.insert({filepath:T,oid:o0,stage:3})}}else if(!H)Y.insert({filepath:T,oid:g.mergeResult.oid,stage:0});return g.mergeResult});if(M&&!D&&G&&await M.type()==="blob"&&await G.type()==="blob"){if(L.push(T),O.push(T),!H){let g=await M.oid(),m=await G.oid();Y.delete({filepath:T}),Y.insert({filepath:T,oid:g,stage:1}),Y.insert({filepath:T,oid:m,stage:3})}return{mode:await G.mode(),oid:await G.oid(),type:"blob",path:R}}if(M&&D&&!G&&await M.type()==="blob"&&await D.type()==="blob"){if(L.push(T),A.push(T),!H){let g=await M.oid(),m=await D.oid();Y.delete({filepath:T}),Y.insert({filepath:T,oid:g,stage:1}),Y.insert({filepath:T,oid:m,stage:2})}return{mode:await D.mode(),oid:await D.oid(),type:"blob",path:R}}if(M&&!D&&!G&&(await M.type()==="blob"||await M.type()==="tree"))return;throw new Q8}}},reduce:L.length!==0&&(!W||H)?void 0:async(T,D)=>{let M=D.filter(Boolean);if(!T)return;if(T&&T.type==="tree"&&M.length===0&&T.path!==".")return;if(M.length>0||T.path==="."&&M.length===0){let R=new b0(M).toObject(),C=await _0({fs:Q,gitdir:V,type:"tree",object:R,dryRun:U});T.oid=C}return T}});if(L.length!==0){if(W&&!H)await l1({fs:Q,cache:J,dir:W,gitdir:V,trees:[d0({ref:P.oid})],map:async function(T,[D]){let M=`${W}/${T}`;if(await D.type()==="blob"){let G=await D.mode(),R=new TextDecoder().decode(await D.content());await Q.write(M,R,{mode:G})}return!0}});return new I6(L,N,O,A)}return P.oid}async function lN({fs:Q,gitdir:J,path:W,ours:V,base:Y,theirs:X,ourName:q,theirName:K,baseName:z,dryRun:$,mergeDriver:Z=dN}){let H="100755",B="",j="";if(Y&&await Y.type()==="blob")H=await Y.mode(),B=await Y.oid(),j=Buffer.from(await Y.content()).toString("utf8");let F=H===await V.mode()?await X.mode():await V.mode();if(await V.oid()===await X.oid())return{cleanMerge:!0,mergeResult:{mode:F,path:W,oid:await V.oid(),type:"blob"}};if(await V.oid()===B)return{cleanMerge:!0,mergeResult:{mode:F,path:W,oid:await X.oid(),type:"blob"}};if(await X.oid()===B)return{cleanMerge:!0,mergeResult:{mode:F,path:W,oid:await V.oid(),type:"blob"}};let I=Buffer.from(await V.content()).toString("utf8"),L=Buffer.from(await X.content()).toString("utf8"),{mergedText:N,cleanMerge:O}=await Z({branches:[z,q,K],contents:[j,I,L],path:W}),A=await _0({fs:Q,gitdir:J,type:"blob",object:Buffer.from(N,"utf8"),dryRun:$});return{cleanMerge:O,mergeResult:{mode:F,path:W,oid:A,type:"blob"}}}var nN={stage:D6,workdir:W8},gQ;async function r6(Q,J){if(gQ===void 0)gQ=new m8;return gQ.acquire(Q,J)}async function oN(Q,J,W,V,Y=null){let X=S(W,V),q=await Q.lstat(X);if(!q)throw new r(X);if(q.isDirectory())throw new u(`${X}: file expected, but found directory`);let K=Y?await Y2({fs:Q,gitdir:J,oid:Y}):void 0,z=K?Y:void 0;if(!K)await r6({fs:Q,gitdir:J,currentFilepath:X},async()=>{let $=q.isSymbolicLink()?await Q.readlink(X).then(j2):await Q.read(X);if($===null)throw new r(X);z=await _0({fs:Q,gitdir:J,type:"blob",object:$})});return z}async function aN({fs:Q,dir:J,gitdir:W,entries:V}){async function Y(X){if(X.type==="tree"){if(!X.oid){let q=await Promise.all(X.children.map(Y));X.oid=await U5({fs:Q,gitdir:W,tree:q}),X.mode=16384}}else if(X.type==="blob")X.oid=await oN(Q,W,J,X.path,X.oid),X.mode=33188;return X.path=X.path.split("/").pop(),X}return Promise.all(V.map(Y))}async function fq({fs:Q,dir:J,gitdir:W,treePair:V}){let Y=V[1]==="stage",X=V.map((B)=>typeof B==="string"?nN[B]():B),q=[],Z=await l1({fs:Q,cache:{},dir:J,gitdir:W,trees:X,map:async(B,[j,F])=>{if(B==="."||await w6.isIgnored({fs:Q,dir:J,gitdir:W,filepath:B}))return;if(F){if(!j||await j.oid()!==await F.oid()&&await F.oid()!==void 0)q.push([j,F]);return{mode:await F.mode(),path:B,oid:await F.oid(),type:await F.type()}}},reduce:async(B,j)=>{if(j=j.filter(Boolean),!B)return j.length>0?j:void 0;else return B.children=j,B},iterate:async(B,j)=>{let F=[];for(let I of j){let[L,N]=I;if(Y){if(N)if(await Q.exists(`${J}/${N.toString()}`))F.push(I);else q.push([null,N])}else if(L)if(!N)q.push([L,null]);else F.push(I)}return F.length?Promise.all(F.map(B)):[]}});if(q.length===0||Z.length===0)return null;let H=(await aN({fs:Q,dir:J,gitdir:W,entries:Z})).filter(Boolean).map((B)=>({mode:B.mode,path:B.path,oid:B.oid,type:B.type}));return U5({fs:Q,gitdir:W,tree:H})}async function R2({fs:Q,dir:J,gitdir:W,stashCommit:V,parentCommit:Y,wasStaged:X}){let q=[],K=[],z=await l1({fs:Q,cache:{},dir:J,gitdir:W,trees:[d0({ref:Y}),d0({ref:V})],map:async($,[Z,U])=>{if($==="."||await w6.isIgnored({fs:Q,dir:J,gitdir:W,filepath:$}))return;let H=U?await U.type():await Z.type();if(H!=="tree"&&H!=="blob")return;if(!U&&Z){let j=H==="tree"?"rmdir":"rm";if(H==="tree")q.push($);if(H==="blob"&&X)K.push({filepath:$,oid:await Z.oid()});return{method:j,filepath:$}}let B=await U.oid();if(!Z||await Z.oid()!==B)if(H==="tree")return{method:"mkdir",filepath:$};else{if(X)K.push({filepath:$,oid:B,stats:await Q.lstat(S(J,$))});return{method:"write",filepath:$,oid:B}}}});await r6({fs:Q,gitdir:W,dirRemoved:q,ops:z},async()=>{for(let $ of z){let Z=S(J,$.filepath);switch($.method){case"rmdir":await Q.rmdir(Z);break;case"mkdir":await Q.mkdir(Z);break;case"rm":await Q.rm(Z);break;case"write":if(!q.some((U)=>Z.startsWith(U))){let{object:U}=await Q0({fs:Q,cache:{},gitdir:W,oid:$.oid});if(await Q.exists(Z))await Q.rm(Z);await Q.write(Z,U)}break}}}),await $0.acquire({fs:Q,gitdir:W,cache:{}},async($)=>{K.forEach(({filepath:Z,stats:U,oid:H})=>{$.insert({filepath:Z,stats:U,oid:H})})})}async function cq({fs:Q,cache:J,dir:W,gitdir:V,oid:Y,dryRun:X=!1,noUpdateBranch:q=!1,abortOnConflict:K=!0,committer:z,mergeDriver:$}){let{commit:Z,oid:U}=await w1({fs:Q,cache:J,gitdir:V,oid:Y});if(Z.parent.length>1)throw new s8(U,Z.parent.length);if(Z.parent.length===0)throw new r8(U);let H=await v.resolve({fs:Q,gitdir:V,ref:"HEAD"}),{commit:B}=await w1({fs:Q,cache:J,gitdir:V,oid:H}),j=Z.parent[0],{commit:F}=await w1({fs:Q,cache:J,gitdir:V,oid:j}),I=await $0.acquire({fs:Q,gitdir:V,cache:J,allowUnmerged:!1},async(N)=>{return C2({fs:Q,cache:J,dir:W,gitdir:V,index:N,ourOid:B.tree,baseOid:F.tree,theirOid:Z.tree,ourName:"HEAD",baseName:`parent of ${U.slice(0,7)}`,theirName:U.slice(0,7),dryRun:X,abortOnConflict:K,mergeDriver:$})});if(I instanceof I6)throw I;let L=await $5({fs:Q,cache:J,gitdir:V,message:Z.message,tree:I,parent:[H],author:Z.author,committer:z,dryRun:X,noUpdateBranch:q});if(W&&!X&&!q)await R2({fs:Q,dir:W,gitdir:V,stashCommit:L,parentCommit:H,wasStaged:!0});return L}async function T2({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,cache:Y={},committer:X,dryRun:q=!1,noUpdateBranch:K=!1,abortOnConflict:z=!0,mergeDriver:$}){try{w("fs",Q),w("gitdir",W),w("oid",V);let Z=new y(Q),U=await h({fsp:Z,dotgit:W}),{commit:H}=await w1({fs:Z,cache:Y,gitdir:U,oid:V});if(H.parent&&H.parent.length>1)return await cq({fs:Z,cache:Y,dir:J,gitdir:U,oid:V,dryRun:q,noUpdateBranch:K,abortOnConflict:z,committer:void 0,mergeDriver:$});let B=await F6({fs:Z,gitdir:U,committer:X});if(!B)throw new G0("committer");return await cq({fs:Z,cache:Y,dir:J,gitdir:U,oid:V,dryRun:q,noUpdateBranch:K,abortOnConflict:z,committer:B,mergeDriver:$})}catch(Z){throw Z.caller="git.cherryPick",Z}}var iN=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function B6(Q){let J=iN.exec(Q);if(J)if(J[1]==="remotes/"&&Q.endsWith("/HEAD"))return J[2].slice(0,-5);else return J[2];return Q}async function a1({fs:Q,gitdir:J,fullname:W=!1,test:V=!1}){let Y=await v.resolve({fs:Q,gitdir:J,ref:"HEAD",depth:2});if(V)try{await v.resolve({fs:Q,gitdir:J,ref:Y})}catch(X){return}if(!Y.startsWith("refs/"))return;return W?Y:B6(Y)}function sN(Q){return Q=Q.replace(/^git@([^:]+):/,"https://$1/"),Q=Q.replace(/^ssh:\/\//,"https://"),Q}function S2({username:Q="",password:J=""}){return`Basic ${Buffer.from(`${Q}:${J}`).toString("base64")}`}async function H5(Q,J){let W=X2(Q);while(!0){let{value:V,done:Y}=await W.next();if(V)await J(V);if(Y)break}if(W.return)W.return()}async function A9(Q){let J=0,W=[];await H5(Q,(X)=>{W.push(X),J+=X.byteLength});let V=new Uint8Array(J),Y=0;for(let X of W)V.set(X,Y),Y+=X.byteLength;return V}function dq(Q){let J=Q.match(/^https?:\/\/([^/]+)@/);if(J==null)return{url:Q,auth:{}};J=J[1];let[W,V]=J.split(":");return Q=Q.replace(`${J}@`,""),{url:Q,auth:{username:W,password:V}}}function nQ(Q,J){let W=J.toString(16);return"0".repeat(Q-W.length)+W}class X0{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(Q){if(typeof Q==="string")Q=Buffer.from(Q);let J=Q.length+4,W=nQ(4,J);return Buffer.concat([Buffer.from(W,"utf8"),Q])}static streamReader(Q){let J=new sQ(Q);return async function(){try{let V=await J.read(4);if(V==null)return!0;if(V=parseInt(V.toString("utf8"),16),V===0)return null;if(V===1)return null;let Y=await J.read(V-4);if(Y==null)return!0;return Y}catch(V){return Q.error=V,!0}}}}async function lq(Q){let J={},W;while(!0){if(W=await Q(),W===!0)break;if(W===null)continue;W=W.toString("utf8").replace(/\n$/,"");let V=W.indexOf("=");if(V>-1){let Y=W.slice(0,V),X=W.slice(V+1);J[Y]=X}else J[W]=!0}return{protocolVersion:2,capabilities2:J}}async function nq(Q,{service:J}){let W=new Set,V=new Map,Y=new Map,X=X0.streamReader(Q),q=await X();while(q===null)q=await X();if(q===!0)throw new e8;if(q.includes("version 2"))return lq(X);if(q.toString("utf8").replace(/\n$/,"")!==`# service=${J}`)throw new G6(`# service=${J}\\n`,q.toString("utf8"));let K=await X();while(K===null)K=await X();if(K===!0)return{capabilities:W,refs:V,symrefs:Y};if(K=K.toString("utf8"),K.includes("version 2"))return lq(X);let[z,$]=pQ(K,"\x00","\\x00");if($.split(" ").map((Z)=>W.add(Z)),z!=="0000000000000000000000000000000000000000 capabilities^{}"){let[Z,U]=pQ(z," "," ");V.set(U,Z);while(!0){let H=await X();if(H===!0)break;if(H!==null){let[B,j]=pQ(H.toString("utf8")," "," ");V.set(j,B)}}}for(let Z of W)if(Z.startsWith("symref=")){let U=Z.match(/symref=([^:]+):(.*)/);if(U.length===3)Y.set(U[1],U[2])}return{protocolVersion:1,capabilities:W,refs:V,symrefs:Y}}function pQ(Q,J,W){let V=Q.trim().split(J);if(V.length!==2)throw new G6(`Two strings separated by '${W}'`,Q.toString("utf8"));return V}var oq=(Q,J)=>Q.endsWith("?")?`${Q}${J}`:`${Q}/${J.replace(/^https?:\/\//,"")}`,aq=(Q,J)=>{if(J.username||J.password)Q.Authorization=S2(J);if(J.headers)Object.assign(Q,J.headers)},uQ=async(Q)=>{try{let J=Buffer.from(await A9(Q.body)),W=J.toString("utf8");return{preview:W.length<256?W:W.slice(0,256)+"...",response:W,data:J}}catch(J){return{}}};class l8{static async capabilities(){return["discover","connect"]}static async discover({http:Q,onProgress:J,onAuth:W,onAuthSuccess:V,onAuthFailure:Y,corsProxy:X,service:q,url:K,headers:z,protocolVersion:$}){let{url:Z,auth:U}=dq(K),H=X?oq(X,Z):Z;if(U.username||U.password)z.Authorization=S2(U);if($===2)z["Git-Protocol"]="version=2";let B,j,F=!1;do if(B=await Q.request({onProgress:J,method:"GET",url:`${H}/info/refs?service=${q}`,headers:z}),j=!1,B.statusCode===401||B.statusCode===203){let I=F?Y:W;if(I){if(U=await I(Z,{...U,headers:{...z}}),U&&U.cancel)throw new J8;else if(U)aq(z,U),F=!0,j=!0}}else if(B.statusCode===200&&F&&V)await V(Z,U);while(j);if(B.statusCode!==200){let{response:I}=await uQ(B);throw new a6(B.statusCode,B.statusMessage,I)}if(B.headers["content-type"]===`application/x-${q}-advertisement`){let I=await nq(B.body,{service:q});return I.auth=U,I}else{let{preview:I,response:L,data:N}=await uQ(B);try{let O=await nq([N],{service:q});return O.auth=U,O}catch(O){throw new Y5(I,L)}}}static async connect({http:Q,onProgress:J,corsProxy:W,service:V,url:Y,auth:X,body:q,headers:K}){let z=dq(Y);if(z)Y=z.url;if(W)Y=oq(W,Y);K["content-type"]=`application/x-${V}-request`,K.accept=`application/x-${V}-result`,aq(K,X);let $=await Q.request({onProgress:J,method:"POST",url:`${Y}/${V}`,body:q,headers:K});if($.statusCode!==200){let{response:Z}=uQ($);throw new a6($.statusCode,$.statusMessage,Z)}return $}}class B5{static getRemoteHelperFor({url:Q}){let J=new Map;J.set("http",l8),J.set("https",l8);let W=rN({url:Q});if(!W)throw new q5(Q);if(J.has(W.transport))return J.get(W.transport);throw new X5(Q,W.transport,W.transport==="ssh"?sN(Q):void 0)}}function rN({url:Q}){if(Q.startsWith("git@"))return{transport:"ssh",address:Q};let J=Q.match(/(\w+)(:\/\/|::)(.*)/);if(J===null)return;if(J[2]==="://")return{transport:J[1],address:J[0]};if(J[2]==="::")return{transport:J[1],address:J[3]}}var U6=null;class t6{static async read({fs:Q,gitdir:J}){if(U6===null)U6=new m8;let W=S(J,"shallow"),V=new Set;return await U6.acquire(W,async function(){let Y=await Q.read(W,{encoding:"utf8"});if(Y===null)return V;if(Y.trim()==="")return V;Y.trim().split(`
|
|
92
|
+
`).map((X)=>V.add(X))}),V}static async write({fs:Q,gitdir:J,oids:W}){if(U6===null)U6=new m8;let V=S(J,"shallow");if(W.size>0){let Y=[...W].join(`
|
|
93
|
+
`)+`
|
|
94
|
+
`;await U6.acquire(V,async function(){await Q.write(V,Y,{encoding:"utf8"})})}else await U6.acquire(V,async function(){await Q.rm(V)})}}async function tN({fs:Q,gitdir:J,oid:W}){let V=`objects/${W.slice(0,2)}/${W.slice(2)}`;return Q.exists(`${J}/${V}`)}async function eN({fs:Q,cache:J,gitdir:W,oid:V,getExternalRefDelta:Y}){let X=await Q.readdir(S(W,"objects/pack"));X=X.filter((q)=>q.endsWith(".idx"));for(let q of X){let K=`${W}/objects/pack/${q}`,z=await rQ({fs:Q,cache:J,filename:K,getExternalRefDelta:Y});if(z.error)throw new u(z.error);if(z.offsets.has(V))return!0}return!1}async function iq({fs:Q,cache:J,gitdir:W,oid:V,format:Y="content"}){let X=(K)=>Q0({fs:Q,cache:J,gitdir:W,oid:K}),q=await tN({fs:Q,gitdir:W,oid:V});if(!q)q=await eN({fs:Q,cache:J,gitdir:W,oid:V,getExternalRefDelta:X});return q}function QI(Q){let Y="5041434b0000000200000000";return Q.slice(0,12).toString("hex")===Y}function E2(Q,J){let W=Q.map((V)=>V.split("=",1)[0]);return J.filter((V)=>{let Y=V.split("=",1)[0];return W.includes(Y)})}var T9={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"};class u8{constructor(){this._queue=[]}write(Q){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let J=this._waiting;this._waiting=null,J({value:Q})}else this._queue.push(Q)}end(){if(this._ended=!0,this._waiting){let Q=this._waiting;this._waiting=null,Q({done:!0})}}destroy(Q){this.error=Q,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((Q)=>{this._waiting=Q})}}function JI(Q){let J=Q.indexOf("\r"),W=Q.indexOf(`
|
|
95
|
+
`);if(J===-1&&W===-1)return-1;if(J===-1)return W+1;if(W===-1)return J+1;if(W===J+1)return W+1;return Math.min(J,W)+1}function v2(Q){let J=new u8,W="";return(async()=>{if(await H5(Q,(V)=>{V=V.toString("utf8"),W+=V;while(!0){let Y=JI(W);if(Y===-1)break;J.write(W.slice(0,Y)),W=W.slice(Y)}}),W.length>0)J.write(W);J.end()})(),J}class QJ{static demux(Q){let J=X0.streamReader(Q),W=new u8,V=new u8,Y=new u8,X=async function(){let q=await J();if(q===null)return X();if(q===!0){W.end(),Y.end(),Q.error?V.destroy(Q.error):V.end();return}switch(q[0]){case 1:{V.write(q.slice(1));break}case 2:{Y.write(q.slice(1));break}case 3:{let K=q.slice(1);Y.write(K),W.end(),Y.end(),V.destroy(Error(K.toString("utf8")));return}default:W.write(q)}X()};return X(),{packetlines:W,packfile:V,progress:Y}}}async function WI(Q){let{packetlines:J,packfile:W,progress:V}=QJ.demux(Q),Y=[],X=[],q=[],K=!1,z=!1;return new Promise(($,Z)=>{H5(J,(U)=>{let H=U.toString("utf8").trim();if(H.startsWith("shallow")){let B=H.slice(-41).trim();if(B.length!==40)Z(new c1(B));Y.push(B)}else if(H.startsWith("unshallow")){let B=H.slice(-41).trim();if(B.length!==40)Z(new c1(B));X.push(B)}else if(H.startsWith("ACK")){let[,B,j]=H.split(" ");if(q.push({oid:B,status:j}),!j)z=!0}else if(H.startsWith("NAK"))K=!0,z=!0;else z=!0,K=!0;if(z)Q.error?Z(Q.error):$({shallows:Y,unshallows:X,acks:q,nak:K,packfile:W,progress:V})}).finally(()=>{if(!z)Q.error?Z(Q.error):$({shallows:Y,unshallows:X,acks:q,nak:K,packfile:W,progress:V})})})}function VI({capabilities:Q=[],wants:J=[],haves:W=[],shallows:V=[],depth:Y=null,since:X=null,exclude:q=[]}){let K=[];J=[...new Set(J)];let z=` ${Q.join(" ")}`;for(let $ of J)K.push(X0.encode(`want ${$}${z}
|
|
96
|
+
`)),z="";for(let $ of V)K.push(X0.encode(`shallow ${$}
|
|
97
|
+
`));if(Y!==null)K.push(X0.encode(`deepen ${Y}
|
|
98
|
+
`));if(X!==null)K.push(X0.encode(`deepen-since ${Math.floor(X.valueOf()/1000)}
|
|
99
|
+
`));for(let $ of q)K.push(X0.encode(`deepen-not ${$}
|
|
100
|
+
`));K.push(X0.flush());for(let $ of W)K.push(X0.encode(`have ${$}
|
|
101
|
+
`));return K.push(X0.encode(`done
|
|
102
|
+
`)),K}async function JJ({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,gitdir:z,ref:$,remoteRef:Z,remote:U,url:H,corsProxy:B,depth:j=null,since:F=null,exclude:I=[],relative:L=!1,tags:N=!1,singleBranch:O=!1,headers:A={},prune:P=!1,pruneTags:T=!1}){let D=$||await a1({fs:Q,gitdir:z,test:!0}),M=await z0.get({fs:Q,gitdir:z}),G=U||D&&await M.get(`branch.${D}.remote`)||"origin",R=H||await M.get(`remote.${G}.url`);if(typeof R>"u")throw new x0("remote OR url");let C=Z||D&&await M.get(`branch.${D}.merge`)||$||"HEAD";if(B===void 0)B=await M.get("http.corsProxy");let x=B5.getRemoteHelperFor({url:R}),g=await x.discover({http:W,onAuth:X,onAuthSuccess:q,onAuthFailure:K,corsProxy:B,service:"git-upload-pack",url:R,headers:A,protocolVersion:1}),m=g.auth,s=g.refs;if(s.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(j!==null&&!g.capabilities.has("shallow"))throw new f1("shallow","depth");if(F!==null&&!g.capabilities.has("deepen-since"))throw new f1("deepen-since","since");if(I.length>0&&!g.capabilities.has("deepen-not"))throw new f1("deepen-not","exclude");if(L===!0&&!g.capabilities.has("deepen-relative"))throw new f1("deepen-relative","relative");let{oid:o0,fullref:v0}=v.resolveAgainstMap({ref:C,map:s});for(let E of s.keys()){if(E===v0||E==="HEAD"||E.startsWith("refs/heads/")||N&&E.startsWith("refs/tags/"))continue;s.delete(E)}let g0=E2([...g.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${T9.agent}`]);if(L)g0.push("deepen-relative");let B8=O?[o0]:s.values(),j8=O?[D]:await v.listRefs({fs:Q,gitdir:z,filepath:"refs"}),M0=[];for(let E of j8)try{E=await v.expand({fs:Q,gitdir:z,ref:E});let _=await v.resolve({fs:Q,gitdir:z,ref:E});if(await iq({fs:Q,cache:J,gitdir:z,oid:_}))M0.push(_)}catch(_){}M0=[...new Set(M0)];let e=await t6.read({fs:Q,gitdir:z}),a0=g.capabilities.has("shallow")?[...e]:[],F0=VI({capabilities:g0,wants:B8,haves:M0,shallows:a0,depth:j,since:F,exclude:I}),t1=Buffer.from(await A9(F0)),A1=await x.connect({http:W,onProgress:V,corsProxy:B,service:"git-upload-pack",url:R,auth:m,body:[t1],headers:A}),K0=await WI(A1.body);if(A1.headers)K0.headers=A1.headers;for(let E of K0.shallows)if(!e.has(E))try{let{object:_}=await Q0({fs:Q,cache:J,gitdir:z,oid:E}),l=new V0(_),J0=await Promise.all(l.headers().parent.map((O1)=>iq({fs:Q,cache:J,gitdir:z,oid:O1})));if(!(J0.length===0||J0.every((O1)=>O1)))e.add(E)}catch(_){e.add(E)}for(let E of K0.unshallows)e.delete(E);if(await t6.write({fs:Q,gitdir:z,oids:e}),O){let E=new Map([[v0,o0]]),_=new Map,l=10,J0=v0;while(l--){let J7=g.symrefs.get(J0);if(J7===void 0)break;_.set(J0,J7),J0=J7}let P0=s.get(J0);if(P0)E.set(J0,P0);let{pruned:O1}=await v.updateRemoteRefs({fs:Q,gitdir:z,remote:G,refs:E,symrefs:_,tags:N,prune:P});if(P)K0.pruned=O1}else{let{pruned:E}=await v.updateRemoteRefs({fs:Q,gitdir:z,remote:G,refs:s,symrefs:g.symrefs,tags:N,prune:P,pruneTags:T});if(P)K0.pruned=E}if(K0.HEAD=g.symrefs.get("HEAD"),K0.HEAD===void 0){let{oid:E}=v.resolveAgainstMap({ref:"HEAD",map:s});for(let[_,l]of s.entries())if(_!=="HEAD"&&l===E){K0.HEAD=_;break}}let Q7=v0.startsWith("refs/tags")?"tag":"branch";if(K0.FETCH_HEAD={oid:o0,description:`${Q7} '${B6(v0)}' of ${R}`},V||Y){let E=v2(K0.progress);H5(E,async(_)=>{if(Y)await Y(_);if(V){let l=_.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);if(l)await V({phase:l[1].trim(),loaded:parseInt(l[2],10),total:parseInt(l[3],10)})}})}let C6=Buffer.from(await A9(K0.packfile));if(A1.body.error)throw A1.body.error;let p0=C6.slice(-20).toString("hex"),p={defaultBranch:K0.HEAD,fetchHead:K0.FETCH_HEAD.oid,fetchHeadDescription:K0.FETCH_HEAD.description};if(K0.headers)p.headers=K0.headers;if(P)p.pruned=K0.pruned;if(p0!==""&&!QI(C6)){p.packfile=`objects/pack/pack-${p0}.pack`;let E=S(z,p.packfile);await Q.write(E,C6);let _=(J0)=>Q0({fs:Q,cache:J,gitdir:z,oid:J0}),l=await o6.fromPack({pack:C6,getExternalRefDelta:_,onProgress:V});await Q.write(E.replace(/\.pack$/,".idx"),await l.toBuffer())}return p}async function k2({fs:Q,bare:J=!1,dir:W,gitdir:V=J?W:S(W,".git"),defaultBranch:Y="master"}){if(await Q.exists(V+"/config"))return;let X=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];X=X.map((q)=>V+"/"+q);for(let q of X)await Q.mkdir(q);await Q.write(V+"/config",`[core]
|
|
103
|
+
repositoryformatversion = 0
|
|
104
|
+
filemode = false
|
|
105
|
+
bare = ${J}
|
|
106
|
+
`+(J?"":` logallrefupdates = true
|
|
107
|
+
`)+` symlinks = false
|
|
108
|
+
ignorecase = true
|
|
109
|
+
`),await Q.write(V+"/HEAD",`ref: refs/heads/${Y}
|
|
110
|
+
`)}async function YI({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,onPostCheckout:z,dir:$,gitdir:Z,url:U,corsProxy:H,ref:B,remote:j,depth:F,since:I,exclude:L,relative:N,singleBranch:O,noCheckout:A,noTags:P,headers:T,nonBlocking:D,batchSize:M=100}){try{if(await k2({fs:Q,gitdir:Z}),await L2({fs:Q,gitdir:Z,remote:j,url:U,force:!1}),H){let C=await z0.get({fs:Q,gitdir:Z});await C.set("http.corsProxy",H),await z0.save({fs:Q,gitdir:Z,config:C})}let{defaultBranch:G,fetchHead:R}=await JJ({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,gitdir:Z,ref:B,remote:j,corsProxy:H,depth:F,since:I,exclude:L,relative:N,singleBranch:O,headers:T,tags:!P});if(R===null)return;B=B||G,B=B.replace("refs/heads/",""),await tQ({fs:Q,cache:J,onProgress:V,onPostCheckout:z,dir:$,gitdir:Z,ref:B,remote:j,noCheckout:A,nonBlocking:D,batchSize:M})}catch(G){throw await Q.rmdir(Z,{recursive:!0,maxRetries:10}).catch(()=>{return}),G}}async function x2({fs:Q,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,onPostCheckout:K,dir:z,gitdir:$=S(z,".git"),url:Z,corsProxy:U=void 0,ref:H=void 0,remote:B="origin",depth:j=void 0,since:F=void 0,exclude:I=[],relative:L=!1,singleBranch:N=!1,noCheckout:O=!1,noTags:A=!1,headers:P={},cache:T={},nonBlocking:D=!1,batchSize:M=100}){try{if(w("fs",Q),w("http",J),w("gitdir",$),!O)w("dir",z);w("url",Z);let G=new y(Q),R=await h({fsp:G,dotgit:$});return await YI({fs:G,cache:T,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,onPostCheckout:K,dir:z,gitdir:R,url:Z,corsProxy:U,ref:H,remote:B,depth:j,since:F,exclude:I,relative:L,singleBranch:N,noCheckout:O,noTags:A,headers:P,nonBlocking:D,batchSize:M})}catch(G){throw G.caller="git.clone",G}}async function b2({fs:Q,onSign:J,dir:W,gitdir:V=S(W,".git"),message:Y,author:X,committer:q,signingKey:K,amend:z=!1,dryRun:$=!1,noUpdateBranch:Z=!1,ref:U,parent:H,tree:B,cache:j={}}){try{if(w("fs",Q),!z)w("message",Y);if(K)w("onSign",J);let F=new y(Q),I=await h({fsp:F,dotgit:V});return await $5({fs:F,cache:j,onSign:J,gitdir:I,message:Y,author:X,committer:q,signingKey:K,amend:z,dryRun:$,noUpdateBranch:Z,ref:U,parent:H,tree:B})}catch(F){throw F.caller="git.commit",F}}async function _2({fs:Q,dir:J,gitdir:W=S(J,".git"),fullname:V=!1,test:Y=!1}){try{w("fs",Q),w("gitdir",W);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await a1({fs:X,gitdir:q,fullname:V,test:Y})}catch(X){throw X.caller="git.currentBranch",X}}async function XI({fs:Q,gitdir:J,ref:W}){if(W=W.startsWith("refs/heads/")?W:`refs/heads/${W}`,!await v.exists({fs:Q,gitdir:J,ref:W}))throw new r(W);let Y=await v.expand({fs:Q,gitdir:J,ref:W}),X=await a1({fs:Q,gitdir:J,fullname:!0});if(Y===X){let z=await v.resolve({fs:Q,gitdir:J,ref:Y});await v.writeRef({fs:Q,gitdir:J,ref:"HEAD",value:z})}await v.deleteRef({fs:Q,gitdir:J,ref:Y});let q=B6(W),K=await z0.get({fs:Q,gitdir:J});await K.deleteSection("branch",q),await z0.save({fs:Q,gitdir:J,config:K})}async function y2({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V}){try{w("fs",Q),w("ref",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await XI({fs:Y,gitdir:X,ref:V})}catch(Y){throw Y.caller="git.deleteBranch",Y}}async function h2({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V}){try{w("fs",Q),w("ref",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});await v.deleteRef({fs:Y,gitdir:X,ref:V})}catch(Y){throw Y.caller="git.deleteRef",Y}}async function qI({fs:Q,gitdir:J,remote:W}){let V=await z0.get({fs:Q,gitdir:J});await V.deleteSection("remote",W),await z0.save({fs:Q,gitdir:J,config:V})}async function g2({fs:Q,dir:J,gitdir:W=S(J,".git"),remote:V}){try{w("fs",Q),w("remote",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await qI({fs:Y,gitdir:X,remote:V})}catch(Y){throw Y.caller="git.deleteRemote",Y}}async function KI({fs:Q,gitdir:J,ref:W}){W=W.startsWith("refs/tags/")?W:`refs/tags/${W}`,await v.deleteRef({fs:Q,gitdir:J,ref:W})}async function p2({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V}){try{w("fs",Q),w("ref",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await KI({fs:Y,gitdir:X,ref:V})}catch(Y){throw Y.caller="git.deleteTag",Y}}async function ZI({fs:Q,gitdir:J,oid:W}){let V=W.slice(0,2);return(await Q.readdir(`${J}/objects/${V}`)).map((X)=>`${V}${X}`).filter((X)=>X.startsWith(W))}async function $I({fs:Q,cache:J,gitdir:W,oid:V,getExternalRefDelta:Y}){let X=[],q=await Q.readdir(S(W,"objects/pack"));q=q.filter((K)=>K.endsWith(".idx"));for(let K of q){let z=`${W}/objects/pack/${K}`,$=await rQ({fs:Q,cache:J,filename:z,getExternalRefDelta:Y});if($.error)throw new u($.error);for(let Z of $.offsets.keys())if(Z.startsWith(V))X.push(Z)}return X}async function zI({fs:Q,cache:J,gitdir:W,oid:V}){let Y=(K)=>Q0({fs:Q,cache:J,gitdir:W,oid:K}),X=await ZI({fs:Q,gitdir:W,oid:V}),q=await $I({fs:Q,cache:J,gitdir:W,oid:V,getExternalRefDelta:Y});for(let K of q)if(X.indexOf(K)===-1)X.push(K);if(X.length===1)return X[0];if(X.length>1)throw new a8("oids",V,X);throw new r(`an object matching "${V}"`)}async function u2({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await zI({fs:X,cache:Y,gitdir:q,oid:V})}catch(X){throw X.caller="git.expandOid",X}}async function m2({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V}){try{w("fs",Q),w("gitdir",W),w("ref",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await v.expand({fs:Y,gitdir:X,ref:V})}catch(Y){throw Y.caller="git.expandRef",Y}}async function WJ({fs:Q,cache:J,gitdir:W,oids:V}){let Y={},X=V.length,q=V.map((K,z)=>({index:z,oid:K}));while(q.length){let K=new Set;for(let{oid:$,index:Z}of q){if(!Y[$])Y[$]=new Set;if(Y[$].add(Z),Y[$].size===X)K.add($)}if(K.size>0)return[...K];let z=new Map;for(let{oid:$,index:Z}of q)try{let{object:U}=await Q0({fs:Q,cache:J,gitdir:W,oid:$}),H=V0.from(U),{parent:B}=H.parseHeaders();for(let j of B)if(!Y[j]||!Y[j].has(Z))z.set(j+":"+Z,{oid:j,index:Z})}catch(U){}q=Array.from(z.values())}return[]}async function f2({fs:Q,cache:J,dir:W,gitdir:V,ours:Y,theirs:X,fastForward:q=!0,fastForwardOnly:K=!1,dryRun:z=!1,noUpdateBranch:$=!1,abortOnConflict:Z=!0,message:U,author:H,committer:B,signingKey:j,onSign:F,mergeDriver:I,allowUnrelatedHistories:L=!1}){if(Y===void 0)Y=await a1({fs:Q,gitdir:V,fullname:!0});Y=await v.expand({fs:Q,gitdir:V,ref:Y}),X=await v.expand({fs:Q,gitdir:V,ref:X});let N=await v.resolve({fs:Q,gitdir:V,ref:Y}),O=await v.resolve({fs:Q,gitdir:V,ref:X}),A=await WJ({fs:Q,cache:J,gitdir:V,oids:[N,O]});if(A.length!==1)if(A.length===0&&L)A.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Q8;let P=A[0];if(P===O)return{oid:N,alreadyMerged:!0};if(q&&P===N){if(!z&&!$)await v.writeRef({fs:Q,gitdir:V,ref:Y,value:O});return{oid:O,fastForward:!0}}else{if(K)throw new Q5;let T=await $0.acquire({fs:Q,gitdir:V,cache:J,allowUnmerged:!1},async(M)=>{return C2({fs:Q,cache:J,dir:W,gitdir:V,index:M,ourOid:N,theirOid:O,baseOid:P,ourName:B6(Y),baseName:"base",theirName:B6(X),dryRun:z,abortOnConflict:Z,mergeDriver:I})});if(T instanceof I6)throw T;if(!U)U=`Merge branch '${B6(X)}' into ${B6(Y)}`;return{oid:await $5({fs:Q,cache:J,gitdir:V,message:U,ref:Y,tree:T,parent:[N,O],author:H,committer:B,signingKey:j,onSign:F,dryRun:z,noUpdateBranch:$}),tree:T,mergeCommit:!0}}}async function c2({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,dir:z,gitdir:$,ref:Z,url:U,remote:H,remoteRef:B,prune:j,pruneTags:F,fastForward:I,fastForwardOnly:L,corsProxy:N,singleBranch:O,headers:A,author:P,committer:T,signingKey:D}){try{if(!Z){let R=await a1({fs:Q,gitdir:$});if(!R)throw new x0("ref");Z=R}let{fetchHead:M,fetchHeadDescription:G}=await JJ({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,gitdir:$,corsProxy:N,ref:Z,url:U,remote:H,remoteRef:B,singleBranch:O,headers:A,prune:j,pruneTags:F});await f2({fs:Q,cache:J,gitdir:$,ours:Z,theirs:M,fastForward:I,fastForwardOnly:L,message:`Merge ${G}`,author:P,committer:T,signingKey:D,dryRun:!1,noUpdateBranch:!1}),await tQ({fs:Q,cache:J,onProgress:V,dir:z,gitdir:$,ref:Z,remote:H,noCheckout:!1})}catch(M){throw M.caller="git.pull",M}}async function d2({fs:Q,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,dir:K,gitdir:z=S(K,".git"),ref:$,url:Z,remote:U,remoteRef:H,corsProxy:B,singleBranch:j,headers:F={},cache:I={}}){try{w("fs",Q),w("http",J),w("gitdir",z);let L={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},N=new y(Q),O=await h({fsp:N,dotgit:z});return await c2({fs:N,cache:I,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,dir:K,gitdir:O,ref:$,url:Z,remote:U,remoteRef:H,fastForwardOnly:!0,corsProxy:B,singleBranch:j,headers:F,author:L,committer:L})}catch(L){throw L.caller="git.fastForward",L}}async function l2({fs:Q,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,dir:K,gitdir:z=S(K,".git"),ref:$,remote:Z,remoteRef:U,url:H,corsProxy:B,depth:j=null,since:F=null,exclude:I=[],relative:L=!1,tags:N=!1,singleBranch:O=!1,headers:A={},prune:P=!1,pruneTags:T=!1,cache:D={}}){try{w("fs",Q),w("http",J),w("gitdir",z);let M=new y(Q),G=await h({fsp:M,dotgit:z});return await JJ({fs:M,cache:D,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,gitdir:G,ref:$,remote:Z,remoteRef:U,url:H,corsProxy:B,depth:j,since:F,exclude:I,relative:L,tags:N,singleBranch:O,headers:A,prune:P,pruneTags:T})}catch(M){throw M.caller="git.fetch",M}}async function n2({fs:Q,dir:J,gitdir:W=S(J,".git"),oids:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("oids",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await WJ({fs:X,cache:Y,gitdir:q,oids:V})}catch(X){throw X.caller="git.findMergeBase",X}}async function o2({fs:Q,filepath:J}){if(await Q.exists(S(J,".git")))return J;else{let W=j6(J);if(W===J)throw new r(`git root for ${J}`);return o2({fs:Q,filepath:W})}}async function a2({fs:Q,filepath:J}){try{return w("fs",Q),w("filepath",J),await o2({fs:new y(Q),filepath:J})}catch(W){throw W.caller="git.findRoot",W}}async function i2({fs:Q,dir:J,gitdir:W=S(J,".git"),path:V}){try{w("fs",Q),w("gitdir",W),w("path",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await c8({fs:Y,gitdir:X,path:V})}catch(Y){throw Y.caller="git.getConfig",Y}}async function UI({fs:Q,gitdir:J,path:W}){return(await z0.get({fs:Q,gitdir:J})).getall(W)}async function s2({fs:Q,dir:J,gitdir:W=S(J,".git"),path:V}){try{w("fs",Q),w("gitdir",W),w("path",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await UI({fs:Y,gitdir:X,path:V})}catch(Y){throw Y.caller="git.getConfigAll",Y}}async function r2({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,url:X,headers:q={},forPush:K=!1}){try{w("http",Q),w("url",X);let $=await B5.getRemoteHelperFor({url:X}).discover({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,service:K?"git-receive-pack":"git-upload-pack",url:X,headers:q,protocolVersion:1}),Z={capabilities:[...$.capabilities]};for(let[U,H]of $.refs){let B=U.split("/"),j=B.pop(),F=Z;for(let I of B)F[I]=F[I]||{},F=F[I];F[j]=H}for(let[U,H]of $.symrefs){let B=U.split("/"),j=B.pop(),F=Z;for(let I of B)F[I]=F[I]||{},F=F[I];F[j]=H}return Z}catch(z){throw z.caller="git.getRemoteInfo",z}}function t2(Q,J,W,V){let Y=[];for(let[X,q]of Q.refs){if(J&&!X.startsWith(J))continue;if(X.endsWith("^{}")){if(V){let z=X.replace("^{}",""),$=Y[Y.length-1],Z=$.ref===z?$:Y.find((U)=>U.ref===z);if(Z===void 0)throw Error("I did not expect this to happen");Z.peeled=q}continue}let K={ref:X,oid:q};if(W){if(Q.symrefs.has(X))K.target=Q.symrefs.get(X)}Y.push(K)}return Y}async function e2({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,url:X,headers:q={},forPush:K=!1,protocolVersion:z=2}){try{w("http",Q),w("url",X);let Z=await B5.getRemoteHelperFor({url:X}).discover({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,service:K?"git-receive-pack":"git-upload-pack",url:X,headers:q,protocolVersion:z});if(Z.protocolVersion===2)return{protocolVersion:Z.protocolVersion,capabilities:Z.capabilities2};let U={};for(let H of Z.capabilities){let[B,j]=H.split("=");if(j)U[B]=j;else U[B]=!0}return{protocolVersion:1,capabilities:U,refs:t2(Z,void 0,!0,!0)}}catch($){throw $.caller="git.getRemoteInfo2",$}}async function HI({type:Q,object:J,format:W="content",oid:V=void 0}){if(W!=="deflated"){if(W!=="wrapped")J=N6.wrap({type:Q,object:J});V=await L1(J)}return{oid:V,object:J}}async function QK({object:Q}){try{if(w("object",Q),typeof Q==="string")Q=Buffer.from(Q,"utf8");else if(!(Q instanceof Uint8Array))Q=new Uint8Array(Q);let J="blob",{oid:W,object:V}=await HI({type:J,format:"content",object:Q});return{oid:W,type:J,object:V,format:"wrapped"}}catch(J){throw J.caller="git.hashBlob",J}}async function BI({fs:Q,cache:J,onProgress:W,dir:V,gitdir:Y,filepath:X}){try{X=S(V,X);let q=await Q.read(X),K=($)=>Q0({fs:Q,cache:J,gitdir:Y,oid:$}),z=await o6.fromPack({pack:q,getExternalRefDelta:K,onProgress:W});return await Q.write(X.replace(/\.pack$/,".idx"),await z.toBuffer()),{oids:[...z.hashes]}}catch(q){throw q.caller="git.indexPack",q}}async function JK({fs:Q,onProgress:J,dir:W,gitdir:V=S(W,".git"),filepath:Y,cache:X={}}){try{w("fs",Q),w("dir",W),w("gitdir",W),w("filepath",Y);let q=new y(Q),K=await h({fsp:q,dotgit:V});return await BI({fs:q,cache:X,onProgress:J,dir:W,gitdir:K,filepath:Y})}catch(q){throw q.caller="git.indexPack",q}}async function WK({fs:Q,bare:J=!1,dir:W,gitdir:V=J?W:S(W,".git"),defaultBranch:Y="master"}){try{if(w("fs",Q),w("gitdir",V),!J)w("dir",W);let X=new y(Q),q=await h({fsp:X,dotgit:V});return await k2({fs:X,bare:J,dir:W,gitdir:q,defaultBranch:Y})}catch(X){throw X.caller="git.init",X}}async function VK({fs:Q,cache:J,gitdir:W,oid:V,ancestor:Y,depth:X}){let q=await t6.read({fs:Q,gitdir:W});if(!V)throw new x0("oid");if(!Y)throw new x0("ancestor");if(V===Y)return!1;let K=[V],z=new Set,$=0;while(K.length){if($++===X)throw new W5(X);let Z=K.shift(),{type:U,object:H}=await Q0({fs:Q,cache:J,gitdir:W,oid:Z});if(U!=="commit")throw new R0(Z,U,"commit");let B=V0.from(H).parse();for(let j of B.parent)if(j===Y)return!0;if(!q.has(Z)){for(let j of B.parent)if(!z.has(j))K.push(j),z.add(j)}}return!1}async function YK({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,ancestor:Y,depth:X=-1,cache:q={}}){try{w("fs",Q),w("gitdir",W),w("oid",V),w("ancestor",Y);let K=new y(Q),z=await h({fsp:K,dotgit:W});return await VK({fs:K,cache:q,gitdir:z,oid:V,ancestor:Y,depth:X})}catch(K){throw K.caller="git.isDescendent",K}}async function XK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V}){try{w("fs",Q),w("dir",J),w("gitdir",W),w("filepath",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return w6.isIgnored({fs:Y,dir:J,gitdir:X,filepath:V})}catch(Y){throw Y.caller="git.isIgnored",Y}}async function qK({fs:Q,dir:J,gitdir:W=S(J,".git"),remote:V}){try{w("fs",Q),w("gitdir",W);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return v.listBranches({fs:Y,gitdir:X,remote:V})}catch(Y){throw Y.caller="git.listBranches",Y}}async function jI({fs:Q,gitdir:J,ref:W,cache:V}){if(W){let Y=await v.resolve({gitdir:J,fs:Q,ref:W}),X=[];return await KK({fs:Q,cache:V,gitdir:J,oid:Y,filenames:X,prefix:""}),X}else return $0.acquire({fs:Q,gitdir:J,cache:V},async function(Y){return Y.entries.map((X)=>X.path)})}async function KK({fs:Q,cache:J,gitdir:W,oid:V,filenames:Y,prefix:X}){let{tree:q}=await V8({fs:Q,cache:J,gitdir:W,oid:V});for(let K of q)if(K.type==="tree")await KK({fs:Q,cache:J,gitdir:W,oid:K.oid,filenames:Y,prefix:S(X,K.path)});else Y.push(S(X,K.path))}async function ZK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await jI({fs:X,cache:Y,gitdir:q,ref:V})}catch(X){throw X.caller="git.listFiles",X}}async function FI({fs:Q,cache:J,gitdir:W,ref:V}){let Y;try{Y=await v.resolve({gitdir:W,fs:Q,ref:V})}catch(K){if(K instanceof r)return[]}return(await V8({fs:Q,cache:J,gitdir:W,oid:Y})).tree.map((K)=>({target:K.path,note:K.oid}))}async function $K({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V="refs/notes/commits",cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("ref",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await FI({fs:X,cache:Y,gitdir:q,ref:V})}catch(X){throw X.caller="git.listNotes",X}}async function zK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V}){try{w("fs",Q),w("gitdir",W);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return v.listRefs({fs:Y,gitdir:X,filepath:V})}catch(Y){throw Y.caller="git.listRefs",Y}}async function DI({fs:Q,gitdir:J}){let W=await z0.get({fs:Q,gitdir:J}),V=await W.getSubsections("remote");return Promise.all(V.map(async(X)=>{let q=await W.get(`remote.${X}.url`);return{remote:X,url:q}}))}async function UK({fs:Q,dir:J,gitdir:W=S(J,".git")}){try{w("fs",Q),w("gitdir",W);let V=new y(Q),Y=await h({fsp:V,dotgit:W});return await DI({fs:V,gitdir:Y})}catch(V){throw V.caller="git.listRemotes",V}}async function NI(Q){let J=X0.streamReader(Q),W=[],V;while(!0){if(V=await J(),V===!0)break;if(V===null)continue;V=V.toString("utf8").replace(/\n$/,"");let[Y,X,...q]=V.split(" "),K={ref:X,oid:Y};for(let z of q){let[$,Z]=z.split(":");if($==="symref-target")K.target=Z;else if($==="peeled")K.peeled=Z}W.push(K)}return W}async function II({prefix:Q,symrefs:J,peelTags:W}){let V=[];if(V.push(X0.encode(`command=ls-refs
|
|
111
|
+
`)),V.push(X0.encode(`agent=${T9.agent}
|
|
112
|
+
`)),W||J||Q)V.push(X0.delim());if(W)V.push(X0.encode("peel"));if(J)V.push(X0.encode("symrefs"));if(Q)V.push(X0.encode(`ref-prefix ${Q}`));return V.push(X0.flush()),V}async function HK({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,url:X,headers:q={},forPush:K=!1,protocolVersion:z=2,prefix:$,symrefs:Z,peelTags:U}){try{w("http",Q),w("url",X);let H=await l8.discover({http:Q,onAuth:J,onAuthSuccess:W,onAuthFailure:V,corsProxy:Y,service:K?"git-receive-pack":"git-upload-pack",url:X,headers:q,protocolVersion:z});if(H.protocolVersion===1)return t2(H,$,Z,U);let B=await II({prefix:$,symrefs:Z,peelTags:U}),j=await l8.connect({http:Q,auth:H.auth,headers:q,corsProxy:Y,service:K?"git-receive-pack":"git-upload-pack",url:X,body:B});return NI(j.body)}catch(H){throw H.caller="git.listServerRefs",H}}async function BK({fs:Q,dir:J,gitdir:W=S(J,".git")}){try{w("fs",Q),w("gitdir",W);let V=new y(Q),Y=await h({fsp:V,dotgit:W});return v.listTags({fs:V,gitdir:Y})}catch(V){throw V.caller="git.listTags",V}}function GI(Q,J){return Q.committer.timestamp-J.committer.timestamp}var wI="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function sq({fs:Q,cache:J,gitdir:W,oid:V,fileId:Y}){if(Y===wI)return;let X=V,q,K=await s6({fs:Q,cache:J,gitdir:W,oid:V}),z=K.tree;if(Y===K.oid)q=K.path;else if(q=await jK({fs:Q,cache:J,gitdir:W,tree:z,fileId:Y,oid:X}),Array.isArray(q)){if(q.length===0)q=void 0;else if(q.length===1)q=q[0]}return q}async function jK({fs:Q,cache:J,gitdir:W,tree:V,fileId:Y,oid:X,filepaths:q=[],parentPath:K=""}){let z=V.entries().map(function($){let Z;if($.oid===Y)Z=S(K,$.path),q.push(Z);else if($.type==="tree")Z=Q0({fs:Q,cache:J,gitdir:W,oid:$.oid}).then(function({object:U}){return jK({fs:Q,cache:J,gitdir:W,tree:b0.from(U),fileId:Y,oid:X,filepaths:q,parentPath:S(K,$.path)})});return Z});return await Promise.all(z),q}async function LI({fs:Q,cache:J,gitdir:W,filepath:V,ref:Y,depth:X,since:q,force:K,follow:z}){let $=typeof q>"u"?void 0:Math.floor(q.valueOf()/1000),Z=[],U=await t6.read({fs:Q,gitdir:W}),H=await v.resolve({fs:Q,gitdir:W,ref:Y}),B=[await w1({fs:Q,cache:J,gitdir:W,oid:H})],j,F,I;function L(N){if(I&&V)Z.push(N)}while(B.length>0){let N=B.pop();if($!==void 0&&N.commit.committer.timestamp<=$)break;if(V){let O;try{if(O=await z5({fs:Q,cache:J,gitdir:W,oid:N.commit.tree,filepath:V}),F&&j!==O)Z.push(F);j=O,F=N,I=!0}catch(A){if(A instanceof r){let P=z&&j;if(P){if(P=await sq({fs:Q,cache:J,gitdir:W,oid:N.commit.tree,fileId:j}),P){if(Array.isArray(P)){if(F){let T=await sq({fs:Q,cache:J,gitdir:W,oid:F.commit.tree,fileId:j});if(Array.isArray(T))if(P=P.filter((D)=>T.indexOf(D)===-1),P.length===1){if(P=P[0],V=P,F)Z.push(F)}else{if(P=!1,F)Z.push(F);break}}}else if(V=P,F)Z.push(F)}}if(!P){if(I&&j){if(Z.push(F),!K)break}if(!K&&!z)throw A}F=N,I=!1}else throw A}}else Z.push(N);if(X!==void 0&&Z.length===X){L(N);break}if(!U.has(N.oid))for(let O of N.commit.parent){let A=await w1({fs:Q,cache:J,gitdir:W,oid:O});if(!B.map((P)=>P.oid).includes(A.oid))B.push(A)}if(B.length===0)L(N);B.sort((O,A)=>GI(O.commit,A.commit))}return Z}async function FK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V,ref:Y="HEAD",depth:X,since:q,force:K,follow:z,cache:$={}}){try{w("fs",Q),w("gitdir",W),w("ref",Y);let Z=new y(Q),U=await h({fsp:Z,dotgit:W});return await LI({fs:Z,cache:$,gitdir:U,filepath:V,ref:Y,depth:X,since:q,force:K,follow:z})}catch(Z){throw Z.caller="git.log",Z}}async function DK({fs:Q,onSign:J,dir:W,gitdir:V=S(W,".git"),ours:Y,theirs:X,fastForward:q=!0,fastForwardOnly:K=!1,dryRun:z=!1,noUpdateBranch:$=!1,abortOnConflict:Z=!0,message:U,author:H,committer:B,signingKey:j,cache:F={},mergeDriver:I,allowUnrelatedHistories:L=!1}){try{if(w("fs",Q),j)w("onSign",J);let N=new y(Q),O=await h({fsp:N,dotgit:V}),A=await n1({fs:N,gitdir:O,author:H});if(!A&&(!K||!q))throw new G0("author");let P=await F6({fs:N,gitdir:O,author:A,committer:B});if(!P&&(!K||!q))throw new G0("committer");return await f2({fs:N,cache:F,dir:W,gitdir:O,ours:Y,theirs:X,fastForward:q,fastForwardOnly:K,dryRun:z,noUpdateBranch:$,abortOnConflict:Z,message:U,author:A,committer:P,signingKey:j,onSign:J,mergeDriver:I,allowUnrelatedHistories:L})}catch(N){throw N.caller="git.merge",N}}var MI={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function NK({fs:Q,cache:J,dir:W,gitdir:V=S(W,".git"),oids:Y}){let X=new rq,q=[];function K(Z,U){let H=Buffer.from(Z,U);q.push(H),X.update(H)}async function z({stype:Z,object:U}){let H=MI[Z],B=U.length,j=B>15?128:0,F=B&15;B=B>>>4;let I=(j|H|F).toString(16);K(I,"hex");while(j)j=B>127?128:0,I=j|B&127,K(nQ(2,I),"hex"),B=B>>>7;K(Buffer.from(await B2(U)))}K("PACK"),K("00000002","hex"),K(nQ(8,Y.length),"hex");for(let Z of Y){let{type:U,object:H}=await Q0({fs:Q,cache:J,gitdir:V,oid:Z});await z({write:K,object:H,stype:U})}let $=X.digest();return q.push($),q}async function PI({fs:Q,cache:J,gitdir:W,oids:V,write:Y}){let X=await NK({fs:Q,cache:J,gitdir:W,oids:V}),q=Buffer.from(await A9(X)),z=`pack-${q.slice(-20).toString("hex")}.pack`;if(Y)return await Q.write(S(W,`objects/pack/${z}`),q),{filename:z};return{filename:z,packfile:new Uint8Array(q)}}async function IK({fs:Q,dir:J,gitdir:W=S(J,".git"),oids:V,write:Y=!1,cache:X={}}){try{w("fs",Q),w("gitdir",W),w("oids",V);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await PI({fs:q,cache:X,gitdir:K,oids:V,write:Y})}catch(q){throw q.caller="git.packObjects",q}}async function GK({fs:Q,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,dir:K,gitdir:z=S(K,".git"),ref:$,url:Z,remote:U,remoteRef:H,prune:B=!1,pruneTags:j=!1,fastForward:F=!0,fastForwardOnly:I=!1,corsProxy:L,singleBranch:N,headers:O={},author:A,committer:P,signingKey:T,cache:D={}}){try{w("fs",Q),w("gitdir",z);let M=new y(Q),G=await h({fsp:M,dotgit:z}),R=await n1({fs:M,gitdir:G,author:A});if(!R)throw new G0("author");let C=await F6({fs:M,gitdir:G,author:R,committer:P});if(!C)throw new G0("committer");return await c2({fs:M,cache:D,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,dir:K,gitdir:G,ref:$,url:Z,remote:U,remoteRef:H,fastForward:F,fastForwardOnly:I,corsProxy:L,singleBranch:N,headers:O,author:R,committer:C,signingKey:T,prune:B,pruneTags:j})}catch(M){throw M.caller="git.pull",M}}async function AI({fs:Q,cache:J,dir:W,gitdir:V=S(W,".git"),start:Y,finish:X}){let q=await t6.read({fs:Q,gitdir:V}),K=new Set,z=new Set;for(let U of Y)K.add(await v.resolve({fs:Q,gitdir:V,ref:U}));for(let U of X)try{let H=await v.resolve({fs:Q,gitdir:V,ref:U});z.add(H)}catch(H){}let $=new Set;async function Z(U){$.add(U);let{type:H,object:B}=await Q0({fs:Q,cache:J,gitdir:V,oid:U});if(H==="tag"){let F=C0.from(B).headers().object;return Z(F)}if(H!=="commit")throw new R0(U,H,"commit");if(!q.has(U)){let F=V0.from(B).headers().parent;for(U of F)if(!z.has(U)&&!$.has(U))await Z(U)}}for(let U of K)await Z(U);return $}async function mQ({fs:Q,cache:J,dir:W,gitdir:V=S(W,".git"),oids:Y}){let X=new Set;async function q(K){if(X.has(K))return;X.add(K);let{type:z,object:$}=await Q0({fs:Q,cache:J,gitdir:V,oid:K});if(z==="tag"){let U=C0.from($).headers().object;await q(U)}else if(z==="commit"){let U=V0.from($).headers().tree;await q(U)}else if(z==="tree"){let Z=b0.from($);for(let U of Z){if(U.type==="blob")X.add(U.oid);if(U.type==="tree")await q(U.oid)}}}for(let K of Y)await q(K);return X}async function OI(Q){let J={},W="",V=X0.streamReader(Q),Y=await V();while(Y!==!0){if(Y!==null)W+=Y.toString("utf8")+`
|
|
113
|
+
`;Y=await V()}let X=W.toString("utf8").split(`
|
|
114
|
+
`);if(Y=X.shift(),!Y.startsWith("unpack "))throw new G6('unpack ok" or "unpack [error message]',Y);if(J.ok=Y==="unpack ok",!J.ok)J.error=Y.slice(7);J.refs={};for(let q of X){if(q.trim()==="")continue;let K=q.slice(0,2),z=q.slice(3),$=z.indexOf(" ");if($===-1)$=z.length;let Z=z.slice(0,$),U=z.slice($+1);J.refs[Z]={ok:K==="ok",error:U}}return J}async function CI({capabilities:Q=[],triplets:J=[]}){let W=[],V=`\x00 ${Q.join(" ")}`;for(let Y of J)W.push(X0.encode(`${Y.oldoid} ${Y.oid} ${Y.fullRef}${V}
|
|
115
|
+
`)),V="";return W.push(X0.flush()),W}async function RI({fs:Q,cache:J,http:W,onProgress:V,onMessage:Y,onAuth:X,onAuthSuccess:q,onAuthFailure:K,onPrePush:z,gitdir:$,ref:Z,remoteRef:U,remote:H,url:B,force:j=!1,delete:F=!1,corsProxy:I,headers:L={}}){let N=Z||await a1({fs:Q,gitdir:$});if(typeof N>"u")throw new x0("ref");let O=await z0.get({fs:Q,gitdir:$});H=H||await O.get(`branch.${N}.pushRemote`)||await O.get("remote.pushDefault")||await O.get(`branch.${N}.remote`)||"origin";let A=B||await O.get(`remote.${H}.pushurl`)||await O.get(`remote.${H}.url`);if(typeof A>"u")throw new x0("remote OR url");let P=U||await O.get(`branch.${N}.merge`);if(typeof A>"u")throw new x0("remoteRef");if(I===void 0)I=await O.get("http.corsProxy");let T=await v.expand({fs:Q,gitdir:$,ref:N}),D=F?"0000000000000000000000000000000000000000":await v.resolve({fs:Q,gitdir:$,ref:T}),M=B5.getRemoteHelperFor({url:A}),G=await M.discover({http:W,onAuth:X,onAuthSuccess:q,onAuthFailure:K,corsProxy:I,service:"git-receive-pack",url:A,headers:L,protocolVersion:1}),R=G.auth,C;if(!P)C=T;else try{C=await v.expandAgainstMap({ref:P,map:G.refs})}catch(e){if(e instanceof r)C=P.startsWith("refs/")?P:`refs/heads/${P}`;else throw e}let x=G.refs.get(C)||"0000000000000000000000000000000000000000";if(z){if(!await z({remote:H,url:A,localRef:{ref:F?"(delete)":T,oid:D},remoteRef:{ref:C,oid:x}}))throw new J8}let g=!G.capabilities.has("no-thin"),m=new Set;if(!F){let e=[...G.refs.values()],a0=new Set;if(x!=="0000000000000000000000000000000000000000"){let F0=await WJ({fs:Q,cache:J,gitdir:$,oids:[D,x]});for(let t1 of F0)e.push(t1);if(g)a0=await mQ({fs:Q,cache:J,gitdir:$,oids:F0})}if(!e.includes(D)){let F0=await AI({fs:Q,cache:J,gitdir:$,start:[D],finish:e});m=await mQ({fs:Q,cache:J,gitdir:$,oids:F0})}if(g){try{let F0=await v.resolve({fs:Q,gitdir:$,ref:`refs/remotes/${H}/HEAD`,depth:2}),{oid:t1}=await v.resolveAgainstMap({ref:F0.replace(`refs/remotes/${H}/`,""),fullref:F0,map:G.refs}),A1=[t1];for(let K0 of await mQ({fs:Q,cache:J,gitdir:$,oids:A1}))a0.add(K0)}catch(F0){}for(let F0 of a0)m.delete(F0)}if(D===x)j=!0;if(!j){if(T.startsWith("refs/tags")&&x!=="0000000000000000000000000000000000000000")throw new i6("tag-exists");if(D!=="0000000000000000000000000000000000000000"&&x!=="0000000000000000000000000000000000000000"&&!await VK({fs:Q,cache:J,gitdir:$,oid:D,ancestor:x,depth:-1}))throw new i6("not-fast-forward")}}let s=E2([...G.capabilities],["report-status","side-band-64k",`agent=${T9.agent}`]),o0=await CI({capabilities:s,triplets:[{oldoid:x,oid:D,fullRef:C}]}),v0=F?[]:await NK({fs:Q,cache:J,gitdir:$,oids:[...m]}),g0=await M.connect({http:W,onProgress:V,corsProxy:I,service:"git-receive-pack",url:A,auth:R,headers:L,body:[...o0,...v0]}),{packfile:B8,progress:j8}=await QJ.demux(g0.body);if(Y){let e=v2(j8);H5(e,async(a0)=>{await Y(a0)})}let M0=await OI(B8);if(g0.headers)M0.headers=g0.headers;if(H&&M0.ok&&M0.refs[C].ok&&!T.startsWith("refs/tags")){let e=`refs/remotes/${H}/${C.replace("refs/heads","")}`;if(F)await v.deleteRef({fs:Q,gitdir:$,ref:e});else await v.writeRef({fs:Q,gitdir:$,ref:e,value:D})}if(M0.ok&&Object.values(M0.refs).every((e)=>e.ok))return M0;else{let e=Object.entries(M0.refs).filter(([a0,F0])=>!F0.ok).map(([a0,F0])=>`
|
|
116
|
+
- ${a0}: ${F0.error}`).join("");throw new J5(e,M0)}}async function wK({fs:Q,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,onPrePush:K,dir:z,gitdir:$=S(z,".git"),ref:Z,remoteRef:U,remote:H="origin",url:B,force:j=!1,delete:F=!1,corsProxy:I,headers:L={},cache:N={}}){try{w("fs",Q),w("http",J),w("gitdir",$);let O=new y(Q),A=await h({fsp:O,dotgit:$});return await RI({fs:O,cache:N,http:J,onProgress:W,onMessage:V,onAuth:Y,onAuthSuccess:X,onAuthFailure:q,onPrePush:K,gitdir:A,ref:Z,remoteRef:U,remote:H,url:B,force:j,delete:F,corsProxy:I,headers:L})}catch(O){throw O.caller="git.push",O}}async function LK({fs:Q,cache:J,gitdir:W,oid:V}){let{type:Y,object:X}=await Q0({fs:Q,cache:J,gitdir:W,oid:V});if(Y==="tag")return V=C0.from(X).parse().object,LK({fs:Q,cache:J,gitdir:W,oid:V});if(Y!=="blob")throw new R0(V,Y,"blob");return{oid:V,blob:new Uint8Array(X)}}async function MK({fs:Q,cache:J,gitdir:W,oid:V,filepath:Y=void 0}){if(Y!==void 0)V=await z5({fs:Q,cache:J,gitdir:W,oid:V,filepath:Y});return await LK({fs:Q,cache:J,gitdir:W,oid:V})}async function PK({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,filepath:Y,cache:X={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await MK({fs:q,cache:X,gitdir:K,oid:V,filepath:Y})}catch(q){throw q.caller="git.readBlob",q}}async function VJ({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await w1({fs:X,cache:Y,gitdir:q,oid:V})}catch(X){throw X.caller="git.readCommit",X}}async function TI({fs:Q,cache:J,gitdir:W,ref:V="refs/notes/commits",oid:Y}){let X=await v.resolve({gitdir:W,fs:Q,ref:V}),{blob:q}=await MK({fs:Q,cache:J,gitdir:W,oid:X,filepath:Y});return q}async function AK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V="refs/notes/commits",oid:Y,cache:X={}}){try{w("fs",Q),w("gitdir",W),w("ref",V),w("oid",Y);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await TI({fs:q,cache:X,gitdir:K,ref:V,oid:Y})}catch(q){throw q.caller="git.readNote",q}}async function OK({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,format:Y="parsed",filepath:X=void 0,encoding:q=void 0,cache:K={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let z=new y(Q),$=await h({fsp:z,dotgit:W});if(X!==void 0)V=await z5({fs:z,cache:K,gitdir:$,oid:V,filepath:X});let U=await Q0({fs:z,cache:K,gitdir:$,oid:V,format:Y==="parsed"?"content":Y});if(U.oid=V,Y==="parsed")switch(U.format="parsed",U.type){case"commit":U.object=V0.from(U.object).parse();break;case"tree":U.object=b0.from(U.object).entries();break;case"blob":if(q)U.object=U.object.toString(q);else U.object=new Uint8Array(U.object),U.format="content";break;case"tag":U.object=C0.from(U.object).parse();break;default:throw new R0(U.oid,U.type,"blob|commit|tag|tree")}else if(U.format==="deflated"||U.format==="wrapped")U.type=U.format;return U}catch(z){throw z.caller="git.readObject",z}}async function SI({fs:Q,cache:J,gitdir:W,oid:V}){let{type:Y,object:X}=await Q0({fs:Q,cache:J,gitdir:W,oid:V,format:"content"});if(Y!=="tag")throw new R0(V,Y,"tag");let q=C0.from(X);return{oid:V,tag:q.parse(),payload:q.payload()}}async function CK({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await SI({fs:X,cache:Y,gitdir:q,oid:V})}catch(X){throw X.caller="git.readTag",X}}async function RK({fs:Q,dir:J,gitdir:W=S(J,".git"),oid:V,filepath:Y=void 0,cache:X={}}){try{w("fs",Q),w("gitdir",W),w("oid",V);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await V8({fs:q,cache:X,gitdir:K,oid:V,filepath:Y})}catch(q){throw q.caller="git.readTree",q}}async function TK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("filepath",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});await $0.acquire({fs:X,gitdir:q,cache:Y},async function(K){K.delete({filepath:V})})}catch(X){throw X.caller="git.remove",X}}async function EI({fs:Q,cache:J,onSign:W,gitdir:V,ref:Y="refs/notes/commits",oid:X,author:q,committer:K,signingKey:z}){let $;try{$=await v.resolve({gitdir:V,fs:Q,ref:Y})}catch(j){if(!(j instanceof r))throw j}let U=(await V8({fs:Q,cache:J,gitdir:V,oid:$||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;U=U.filter((j)=>j.path!==X);let H=await U5({fs:Q,gitdir:V,tree:U});return await $5({fs:Q,cache:J,onSign:W,gitdir:V,ref:Y,tree:H,parent:$&&[$],message:`Note removed by 'isomorphic-git removeNote'
|
|
117
|
+
`,author:q,committer:K,signingKey:z})}async function SK({fs:Q,onSign:J,dir:W,gitdir:V=S(W,".git"),ref:Y="refs/notes/commits",oid:X,author:q,committer:K,signingKey:z,cache:$={}}){try{w("fs",Q),w("gitdir",V),w("oid",X);let Z=new y(Q),U=await h({fsp:Z,dotgit:V}),H=await n1({fs:Z,gitdir:U,author:q});if(!H)throw new G0("author");let B=await F6({fs:Z,gitdir:U,author:H,committer:K});if(!B)throw new G0("committer");return await EI({fs:Z,cache:$,onSign:J,gitdir:U,ref:Y,oid:X,author:H,committer:B,signingKey:z})}catch(Z){throw Z.caller="git.removeNote",Z}}async function vI({fs:Q,gitdir:J,oldref:W,ref:V,checkout:Y=!1}){if(!d8(V,!0))throw new K1(V,f8.clean(V));if(!d8(W,!0))throw new K1(W,f8.clean(W));let X=`refs/heads/${W}`,q=`refs/heads/${V}`;if(await v.exists({fs:Q,gitdir:J,ref:q}))throw new Z1("branch",V,!1);let z=await v.resolve({fs:Q,gitdir:J,ref:X,depth:1});await v.writeRef({fs:Q,gitdir:J,ref:q,value:z}),await v.deleteRef({fs:Q,gitdir:J,ref:X});let Z=await a1({fs:Q,gitdir:J,fullname:!0})===X;if(Y||Z)await v.writeSymbolicRef({fs:Q,gitdir:J,ref:"HEAD",value:q})}async function EK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,oldref:Y,checkout:X=!1}){try{w("fs",Q),w("gitdir",W),w("ref",V),w("oldref",Y);let q=new y(Q),K=await h({fsp:q,dotgit:W});return await vI({fs:q,gitdir:K,ref:V,oldref:Y,checkout:X})}catch(q){throw q.caller="git.renameBranch",q}}async function vK({gitdir:Q,type:J,object:W}){return L1(N6.wrap({type:J,object:W}))}async function kK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V,ref:Y,cache:X={}}){try{w("fs",Q),w("gitdir",W),w("filepath",V);let q=new y(Q),K=await h({fsp:q,dotgit:W}),z,$;try{z=await v.resolve({fs:q,gitdir:K,ref:Y||"HEAD"})}catch(H){if(Y)throw H}if(z)try{z=await z5({fs:q,cache:X,gitdir:K,oid:z,filepath:V})}catch(H){z=null}let Z={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},U=J&&await q.read(S(J,V));if(U){if($=await vK({gitdir:K,type:"blob",object:U}),z===$)Z=await q.lstat(S(J,V))}await $0.acquire({fs:q,gitdir:K,cache:X},async function(H){if(H.delete({filepath:V}),z)H.insert({filepath:V,stats:Z,oid:z})})}catch(q){throw q.caller="git.reset",q}}async function xK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,depth:Y}){try{w("fs",Q),w("gitdir",W),w("ref",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});return await v.resolve({fs:X,gitdir:q,ref:V,depth:Y})}catch(X){throw X.caller="git.resolveRef",X}}async function bK({fs:Q,dir:J,gitdir:W=S(J,".git"),path:V,value:Y,append:X=!1}){try{w("fs",Q),w("gitdir",W),w("path",V);let q=new y(Q),K=await h({fsp:q,dotgit:W}),z=await z0.get({fs:q,gitdir:K});if(X)await z.append(V,Y);else await z.set(V,Y);await z0.save({fs:q,gitdir:K,config:z})}catch(q){throw q.caller="git.setConfig",q}}async function _K({fs:Q,gitdir:J,commit:W}){let V=V0.from(W).toObject();return await _0({fs:Q,gitdir:J,type:"commit",object:V,format:"content"})}class O9{static get timezoneOffsetForRefLogEntry(){let Q=new Date().getTimezoneOffset(),J=Math.abs(Math.floor(Q/60)),W=Math.abs(Q%60).toString().padStart(2,"0");return`${Q>0?"-":"+"}${J.toString().padStart(2,"0")}${W}`}static createStashReflogEntry(Q,J,W){let V=Q.name.replace(/\s/g,""),Y="0000000000000000000000000000000000000000",X=Math.floor(Date.now()/1000),q=O9.timezoneOffsetForRefLogEntry;return`0000000000000000000000000000000000000000 ${J} ${V} ${Q.email} ${X} ${q} ${W}
|
|
118
|
+
`}static getStashReflogEntry(Q,J=!1){return Q.split(`
|
|
119
|
+
`).filter((Y)=>Y).reverse().map((Y,X)=>J?`stash@{${X}}: ${Y.split("\t")[1]}`:Y)}}class v1{constructor({fs:Q,dir:J,gitdir:W=S(J,".git")}){Object.assign(this,{fs:Q,dir:J,gitdir:W,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return S(this.gitdir,v1.refStash)}get refLogsStashPath(){return S(this.gitdir,v1.refLogsStash)}async getAuthor(){if(!this._author){if(this._author=await n1({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author)throw new G0("author")}return this._author}async getStashSHA(Q,J){if(!await this.fs.exists(this.refStashPath))return null;return(J||await this.readStashReflogs({parsed:!1}))[Q].split(" ")[1]}async writeStashCommit({message:Q,tree:J,parent:W}){return _K({fs:this.fs,gitdir:this.gitdir,commit:{message:Q,tree:J,parent:W,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(Q){let J=await this.readStashReflogs({parsed:!1});if(Q!==0){if(Q<0||Q>J.length-1)throw new K1(`stash@${Q}`,"number that is in range of [0, num of stash pushed]")}let W=await this.getStashSHA(Q,J);if(!W)return{};return w1({fs:this.fs,cache:{},gitdir:this.gitdir,oid:W})}async writeStashRef(Q){return v.writeRef({fs:this.fs,gitdir:this.gitdir,ref:v1.refStash,value:Q})}async writeStashReflogEntry({stashCommit:Q,message:J}){let W=await this.getAuthor(),V=O9.createStashReflogEntry(W,Q,J),Y=this.refLogsStashPath;await r6({filepath:Y,entry:V},async()=>{let X=await this.fs.exists(Y)?await this.fs.read(Y,"utf8"):"";await this.fs.write(Y,X+V,"utf8")})}async readStashReflogs({parsed:Q=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let J=await this.fs.read(this.refLogsStashPath,"utf8");return O9.getStashReflogEntry(J,Q)}}async function yK({fs:Q,dir:J,gitdir:W,message:V=""}){let Y=new v1({fs:Q,dir:J,gitdir:W});await Y.getAuthor();let X=await a1({fs:Q,gitdir:W,fullname:!1}),q=await v.resolve({fs:Q,gitdir:W,ref:"HEAD"}),z=(await VJ({fs:Q,dir:J,gitdir:W,oid:q})).commit.message,$=[q],Z=null,U=d0({ref:"HEAD"}),H=await fq({fs:Q,dir:J,gitdir:W,treePair:[d0({ref:"HEAD"}),"stage"]});if(H){let I=await Y.writeStashCommit({message:`stash-Index: WIP on ${X} - ${new Date().toISOString()}`,tree:H,parent:$});$.push(I),Z=H,U=D6()}let B=await fq({fs:Q,dir:J,gitdir:W,treePair:[U,"workdir"]});if(B){let I=await Y.writeStashCommit({message:`stash-WorkDir: WIP on ${X} - ${new Date().toISOString()}`,tree:B,parent:[$[$.length-1]]});$.push(I),Z=B}if(!Z||!H&&!B)throw new r("changes, nothing to stash");let j=(V.trim()||`WIP on ${X}`)+`: ${q.substring(0,7)} ${z}`;return{stashCommit:await Y.writeStashCommit({message:j,tree:Z,parent:$}),stashMsg:j,branch:X,stashMgr:Y}}async function kI({fs:Q,dir:J,gitdir:W,message:V=""}){let{stashCommit:Y,stashMsg:X,branch:q,stashMgr:K}=await yK({fs:Q,dir:J,gitdir:W,message:V});return await K.writeStashRef(Y),await K.writeStashReflogEntry({stashCommit:Y,message:X}),await eQ({fs:Q,dir:J,gitdir:W,ref:q,track:!1,force:!0}),Y}async function xI({fs:Q,dir:J,gitdir:W,message:V=""}){let{stashCommit:Y}=await yK({fs:Q,dir:J,gitdir:W,message:V});return Y}async function hK({fs:Q,dir:J,gitdir:W,refIdx:V=0}){let X=await new v1({fs:Q,dir:J,gitdir:W}).readStashCommit(V),{parent:q=null}=X.commit?X.commit:{};if(!q||!Array.isArray(q))return;for(let K=0;K<q.length-1;K++){let $=(await w1({fs:Q,cache:{},gitdir:W,oid:q[K+1]})).commit.message.startsWith("stash-Index");await R2({fs:Q,dir:J,gitdir:W,stashCommit:q[K+1],parentCommit:q[K],wasStaged:$})}}async function gK({fs:Q,dir:J,gitdir:W,refIdx:V=0}){let Y=new v1({fs:Q,dir:J,gitdir:W});if(!(await Y.readStashCommit(V)).commit)return;let q=Y.refStashPath;await r6(q,async()=>{if(await Q.exists(q))await Q.rm(q)});let K=await Y.readStashReflogs({parsed:!1});if(!K.length)return;K.splice(V,1);let z=Y.refLogsStashPath;await r6({reflogEntries:K,stashReflogPath:z,stashMgr:Y},async()=>{if(K.length){await Q.write(z,K.reverse().join(`
|
|
120
|
+
`)+`
|
|
121
|
+
`,"utf8");let $=K[K.length-1].split(" ")[1];await Y.writeStashRef($)}else await Q.rm(z)})}async function bI({fs:Q,dir:J,gitdir:W}){return new v1({fs:Q,dir:J,gitdir:W}).readStashReflogs({parsed:!0})}async function _I({fs:Q,dir:J,gitdir:W}){let V=new v1({fs:Q,dir:J,gitdir:W}),Y=[V.refStashPath,V.refLogsStashPath];await r6(Y,async()=>{await Promise.all(Y.map(async(X)=>{if(await Q.exists(X))return Q.rm(X)}))})}async function yI({fs:Q,dir:J,gitdir:W,refIdx:V=0}){await hK({fs:Q,dir:J,gitdir:W,refIdx:V}),await gK({fs:Q,dir:J,gitdir:W,refIdx:V})}async function pK({fs:Q,dir:J,gitdir:W=S(J,".git"),op:V="push",message:Y="",refIdx:X=0}){w("fs",Q),w("dir",J),w("gitdir",W),w("op",V);let q={push:kI,apply:hK,drop:gK,list:bI,clear:_I,pop:yI,create:xI},K=["apply","drop","pop"];try{let z=new y(Q),$=await h({fsp:z,dotgit:W});["refs","logs","logs/refs"].map((H)=>S($,H)).forEach(async(H)=>{if(!await z.exists(H))await z.mkdir(H)});let U=q[V];if(U){if(K.includes(V)&&X<0)throw new K1(`stash@${X}`,"number that is in range of [0, num of stash pushed]");return await U({fs:z,dir:J,gitdir:$,message:Y,refIdx:X})}throw Error(`To be implemented: ${V}`)}catch(z){throw z.caller="git.stash",z}}async function uK({fs:Q,dir:J,gitdir:W=S(J,".git"),filepath:V,cache:Y={}}){try{w("fs",Q),w("gitdir",W),w("filepath",V);let X=new y(Q),q=await h({fsp:X,dotgit:W});if(await w6.isIgnored({fs:X,gitdir:q,dir:J,filepath:V}))return"ignored";let z=await hI({fs:X,cache:Y,gitdir:q}),$=await mK({fs:X,cache:Y,gitdir:q,tree:z,path:V}),Z=await $0.acquire({fs:X,gitdir:q,cache:Y},async function(I){for(let L of I)if(L.path===V)return L;return null}),U=await X.lstat(S(J,V)),H=$!==null,B=Z!==null,j=U!==null,F=async()=>{if(B&&!I9(Z,U))return Z.oid;else{let I=await X.read(S(J,V)),L=await vK({gitdir:q,type:"blob",object:I});if(B&&Z.oid===L){if(U.size!==-1)$0.acquire({fs:X,gitdir:q,cache:Y},async function(N){N.insert({filepath:V,stats:U,oid:L})})}return L}};if(!H&&!j&&!B)return"absent";if(!H&&!j&&B)return"*absent";if(!H&&j&&!B)return"*added";if(!H&&j&&B)return await F()===Z.oid?"added":"*added";if(H&&!j&&!B)return"deleted";if(H&&!j&&B)return $===Z.oid?"*deleted":"*deleted";if(H&&j&&!B)return await F()===$?"*undeleted":"*undeletemodified";if(H&&j&&B){let I=await F();if(I===$)return I===Z.oid?"unmodified":"*unmodified";else return I===Z.oid?"modified":"*modified"}}catch(X){throw X.caller="git.status",X}}async function mK({fs:Q,cache:J,gitdir:W,tree:V,path:Y}){if(typeof Y==="string")Y=Y.split("/");let X=Y.shift();for(let q of V)if(q.path===X){if(Y.length===0)return q.oid;let{type:K,object:z}=await Q0({fs:Q,cache:J,gitdir:W,oid:q.oid});if(K==="tree"){let $=b0.from(z);return mK({fs:Q,cache:J,gitdir:W,tree:$,path:Y})}if(K==="blob")throw new R0(q.oid,K,"blob",Y.join("/"))}return null}async function hI({fs:Q,cache:J,gitdir:W}){let V;try{V=await v.resolve({fs:Q,gitdir:W,ref:"HEAD"})}catch(X){if(X instanceof r)return[]}let{tree:Y}=await V8({fs:Q,cache:J,gitdir:W,oid:V});return Y}async function fK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V="HEAD",filepaths:Y=["."],filter:X,cache:q={},ignored:K=!1}){try{w("fs",Q),w("gitdir",W),w("ref",V);let z=new y(Q),$=await h({fsp:z,dotgit:W});return await l1({fs:z,cache:q,dir:J,gitdir:$,trees:[d0({ref:V}),W8(),D6()],map:async function(Z,[U,H,B]){if(!U&&!B&&H){if(!K){if(await w6.isIgnored({fs:z,dir:J,filepath:Z}))return null}}if(!Y.some((D)=>O2(Z,D)))return null;if(X){if(!X(Z))return}let[j,F,I]=await Promise.all([U&&U.type(),H&&H.type(),B&&B.type()]),L=[j,F,I].includes("blob");if((j==="tree"||j==="special")&&!L)return;if(j==="commit")return null;if((F==="tree"||F==="special")&&!L)return;if(I==="commit")return null;if((I==="tree"||I==="special")&&!L)return;let N=j==="blob"?await U.oid():void 0,O=I==="blob"?await B.oid():void 0,A;if(j!=="blob"&&F==="blob"&&I!=="blob")A="42";else if(F==="blob")A=await H.oid();let P=[void 0,N,A,O],T=P.map((D)=>P.indexOf(D));return T.shift(),[Z,...T]}})}catch(z){throw z.caller="git.statusMatrix",z}}async function cK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,object:Y,force:X=!1}){try{w("fs",Q),w("gitdir",W),w("ref",V);let q=new y(Q);if(V===void 0)throw new x0("ref");V=V.startsWith("refs/tags/")?V:`refs/tags/${V}`;let K=await h({fsp:q,dotgit:W}),z=await v.resolve({fs:q,gitdir:K,ref:Y||"HEAD"});if(!X&&await v.exists({fs:q,gitdir:K,ref:V}))throw new Z1("tag",V);await v.writeRef({fs:q,gitdir:K,ref:V,value:z})}catch(q){throw q.caller="git.tag",q}}async function dK({fs:Q,dir:J,gitdir:W=S(J,".git"),cache:V={},filepath:Y,oid:X,mode:q,add:K,remove:z,force:$}){try{w("fs",Q),w("gitdir",W),w("filepath",Y);let Z=new y(Q),U=await h({fsp:Z,dotgit:W});if(z)return await $0.acquire({fs:Z,gitdir:U,cache:V},async function(B){if(!$){let j=await Z.lstat(S(J,Y));if(j){if(j.isDirectory())throw new d1("directory");return}}if(B.has({filepath:Y}))B.delete({filepath:Y})});let H;if(!X){if(H=await Z.lstat(S(J,Y)),!H)throw new r(`file at "${Y}" on disk and "remove" not set`);if(H.isDirectory())throw new d1("directory")}return await $0.acquire({fs:Z,gitdir:U,cache:V},async function(B){if(!K&&!B.has({filepath:Y}))throw new r(`file at "${Y}" in index and "add" not set`);let j;if(!X){j=H;let F=j.isSymbolicLink()?await Z.readlink(S(J,Y)):await Z.read(S(J,Y));X=await _0({fs:Z,gitdir:U,type:"blob",format:"content",object:F})}else j={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:q,uid:0,gid:0,size:0};return B.insert({filepath:Y,oid:X,stats:j}),X})}catch(Z){throw Z.caller="git.updateIndex",Z}}function lK(){try{return T9.version}catch(Q){throw Q.caller="git.version",Q}}async function nK({fs:Q,dir:J,gitdir:W=S(J,".git"),trees:V,map:Y,reduce:X,iterate:q,cache:K={}}){try{w("fs",Q),w("gitdir",W),w("trees",V);let z=new y(Q),$=await h({fsp:z,dotgit:W});return await l1({fs:z,cache:K,dir:J,gitdir:$,trees:V,map:Y,reduce:X,iterate:q})}catch(z){throw z.caller="git.walk",z}}async function oK({fs:Q,dir:J,gitdir:W=S(J,".git"),blob:V}){try{w("fs",Q),w("gitdir",W),w("blob",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await _0({fs:Y,gitdir:X,type:"blob",object:V,format:"content"})}catch(Y){throw Y.caller="git.writeBlob",Y}}async function aK({fs:Q,dir:J,gitdir:W=S(J,".git"),commit:V}){try{w("fs",Q),w("gitdir",W),w("commit",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await _K({fs:Y,gitdir:X,commit:V})}catch(Y){throw Y.caller="git.writeCommit",Y}}async function iK({fs:Q,dir:J,gitdir:W=S(J,".git"),type:V,object:Y,format:X="parsed",oid:q,encoding:K=void 0}){try{let z=new y(Q),$=await h({fsp:z,dotgit:W});if(X==="parsed"){switch(V){case"commit":Y=V0.from(Y).toObject();break;case"tree":Y=b0.from(Y).toObject();break;case"blob":Y=Buffer.from(Y,K);break;case"tag":Y=C0.from(Y).toObject();break;default:throw new R0(q||"",V,"blob|commit|tag|tree")}X="content"}return q=await _0({fs:z,gitdir:$,type:V,object:Y,oid:q,format:X}),q}catch(z){throw z.caller="git.writeObject",z}}async function sK({fs:Q,dir:J,gitdir:W=S(J,".git"),ref:V,value:Y,force:X=!1,symbolic:q=!1}){try{w("fs",Q),w("gitdir",W),w("ref",V),w("value",Y);let K=new y(Q);if(!d8(V,!0))throw new K1(V,f8.clean(V));let z=await h({fsp:K,dotgit:W});if(!X&&await v.exists({fs:K,gitdir:z,ref:V}))throw new Z1("ref",V);if(q)await v.writeSymbolicRef({fs:K,gitdir:z,ref:V,value:Y});else Y=await v.resolve({fs:K,gitdir:z,ref:Y}),await v.writeRef({fs:K,gitdir:z,ref:V,value:Y})}catch(K){throw K.caller="git.writeRef",K}}async function gI({fs:Q,gitdir:J,tag:W}){let V=C0.from(W).toObject();return await _0({fs:Q,gitdir:J,type:"tag",object:V,format:"content"})}async function rK({fs:Q,dir:J,gitdir:W=S(J,".git"),tag:V}){try{w("fs",Q),w("gitdir",W),w("tag",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await gI({fs:Y,gitdir:X,tag:V})}catch(Y){throw Y.caller="git.writeTag",Y}}async function tK({fs:Q,dir:J,gitdir:W=S(J,".git"),tree:V}){try{w("fs",Q),w("gitdir",W),w("tree",V);let Y=new y(Q),X=await h({fsp:Y,dotgit:W});return await U5({fs:Y,gitdir:X,tree:V})}catch(Y){throw Y.caller="git.writeTree",Y}}var pI={Errors:K2,STAGE:D6,TREE:d0,WORKDIR:W8,add:F2,abortMerge:H2,addNote:w2,addRemote:M2,annotatedTag:P2,branch:A2,cherryPick:T2,checkout:eQ,clone:x2,commit:b2,getConfig:i2,getConfigAll:s2,setConfig:bK,currentBranch:_2,deleteBranch:y2,deleteRef:h2,deleteRemote:g2,deleteTag:p2,expandOid:u2,expandRef:m2,fastForward:d2,fetch:l2,findMergeBase:n2,findRoot:a2,getRemoteInfo:r2,getRemoteInfo2:e2,hashBlob:QK,indexPack:JK,init:WK,isDescendent:YK,isIgnored:XK,listBranches:qK,listFiles:ZK,listNotes:$K,listRefs:zK,listRemotes:UK,listServerRefs:HK,listTags:BK,log:FK,merge:DK,packObjects:IK,pull:GK,push:wK,readBlob:PK,readCommit:VJ,readNote:AK,readObject:OK,readTag:CK,readTree:RK,remove:TK,removeNote:SK,renameBranch:EK,resetIndex:kK,updateIndex:dK,resolveRef:xK,status:uK,statusMatrix:fK,tag:cK,version:lK,walk:nK,writeBlob:oK,writeCommit:aK,writeObject:iK,writeRef:sK,writeTag:rK,writeTree:tK,stash:pK};eK.Errors=K2;eK.STAGE=D6;eK.TREE=d0;eK.WORKDIR=W8;eK.abortMerge=H2;eK.add=F2;eK.addNote=w2;eK.addRemote=M2;eK.annotatedTag=P2;eK.branch=A2;eK.checkout=eQ;eK.cherryPick=T2;eK.clone=x2;eK.commit=b2;eK.currentBranch=_2;eK.default=pI;eK.deleteBranch=y2;eK.deleteRef=h2;eK.deleteRemote=g2;eK.deleteTag=p2;eK.expandOid=u2;eK.expandRef=m2;eK.fastForward=d2;eK.fetch=l2;eK.findMergeBase=n2;eK.findRoot=a2;eK.getConfig=i2;eK.getConfigAll=s2;eK.getRemoteInfo=r2;eK.getRemoteInfo2=e2;eK.hashBlob=QK;eK.indexPack=JK;eK.init=WK;eK.isDescendent=YK;eK.isIgnored=XK;eK.listBranches=qK;eK.listFiles=ZK;eK.listNotes=$K;eK.listRefs=zK;eK.listRemotes=UK;eK.listServerRefs=HK;eK.listTags=BK;eK.log=FK;eK.merge=DK;eK.packObjects=IK;eK.pull=GK;eK.push=wK;eK.readBlob=PK;eK.readCommit=VJ;eK.readNote=AK;eK.readObject=OK;eK.readTag=CK;eK.readTree=RK;eK.remove=TK;eK.removeNote=SK;eK.renameBranch=EK;eK.resetIndex=kK;eK.resolveRef=xK;eK.setConfig=bK;eK.stash=pK;eK.status=uK;eK.statusMatrix=fK;eK.tag=cK;eK.updateIndex=dK;eK.version=lK;eK.walk=nK;eK.writeBlob=oK;eK.writeCommit=aK;eK.writeObject=iK;eK.writeRef=sK;eK.writeTag=rK;eK.writeTree=tK});var WZ=k((uR,JZ)=>{var Y8=1000,X8=Y8*60,q8=X8*60,L6=q8*24,Yw=L6*7,Xw=L6*365.25;JZ.exports=function(Q,J){J=J||{};var W=typeof Q;if(W==="string"&&Q.length>0)return qw(Q);else if(W==="number"&&isFinite(Q))return J.long?Zw(Q):Kw(Q);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(Q))};function qw(Q){if(Q=String(Q),Q.length>100)return;var J=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(Q);if(!J)return;var W=parseFloat(J[1]),V=(J[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return W*Xw;case"weeks":case"week":case"w":return W*Yw;case"days":case"day":case"d":return W*L6;case"hours":case"hour":case"hrs":case"hr":case"h":return W*q8;case"minutes":case"minute":case"mins":case"min":case"m":return W*X8;case"seconds":case"second":case"secs":case"sec":case"s":return W*Y8;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return W;default:return}}function Kw(Q){var J=Math.abs(Q);if(J>=L6)return Math.round(Q/L6)+"d";if(J>=q8)return Math.round(Q/q8)+"h";if(J>=X8)return Math.round(Q/X8)+"m";if(J>=Y8)return Math.round(Q/Y8)+"s";return Q+"ms"}function Zw(Q){var J=Math.abs(Q);if(J>=L6)return S9(Q,J,L6,"day");if(J>=q8)return S9(Q,J,q8,"hour");if(J>=X8)return S9(Q,J,X8,"minute");if(J>=Y8)return S9(Q,J,Y8,"second");return Q+" ms"}function S9(Q,J,W,V){var Y=J>=W*1.5;return Math.round(Q/W)+" "+V+(Y?"s":"")}});var YJ=k((mR,VZ)=>{function $w(Q){W.debug=W,W.default=W,W.coerce=z,W.disable=q,W.enable=Y,W.enabled=K,W.humanize=WZ(),W.destroy=$,Object.keys(Q).forEach((Z)=>{W[Z]=Q[Z]}),W.names=[],W.skips=[],W.formatters={};function J(Z){let U=0;for(let H=0;H<Z.length;H++)U=(U<<5)-U+Z.charCodeAt(H),U|=0;return W.colors[Math.abs(U)%W.colors.length]}W.selectColor=J;function W(Z){let U,H=null,B,j;function F(...I){if(!F.enabled)return;let L=F,N=Number(new Date),O=N-(U||N);if(L.diff=O,L.prev=U,L.curr=N,U=N,I[0]=W.coerce(I[0]),typeof I[0]!=="string")I.unshift("%O");let A=0;I[0]=I[0].replace(/%([a-zA-Z%])/g,(T,D)=>{if(T==="%%")return"%";A++;let M=W.formatters[D];if(typeof M==="function"){let G=I[A];T=M.call(L,G),I.splice(A,1),A--}return T}),W.formatArgs.call(L,I),(L.log||W.log).apply(L,I)}if(F.namespace=Z,F.useColors=W.useColors(),F.color=W.selectColor(Z),F.extend=V,F.destroy=W.destroy,Object.defineProperty(F,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(H!==null)return H;if(B!==W.namespaces)B=W.namespaces,j=W.enabled(Z);return j},set:(I)=>{H=I}}),typeof W.init==="function")W.init(F);return F}function V(Z,U){let H=W(this.namespace+(typeof U>"u"?":":U)+Z);return H.log=this.log,H}function Y(Z){W.save(Z),W.namespaces=Z,W.names=[],W.skips=[];let U=(typeof Z==="string"?Z:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let H of U)if(H[0]==="-")W.skips.push(H.slice(1));else W.names.push(H)}function X(Z,U){let H=0,B=0,j=-1,F=0;while(H<Z.length)if(B<U.length&&(U[B]===Z[H]||U[B]==="*"))if(U[B]==="*")j=B,F=H,B++;else H++,B++;else if(j!==-1)B=j+1,F++,H=F;else return!1;while(B<U.length&&U[B]==="*")B++;return B===U.length}function q(){let Z=[...W.names,...W.skips.map((U)=>"-"+U)].join(",");return W.enable(""),Z}function K(Z){for(let U of W.skips)if(X(Z,U))return!1;for(let U of W.names)if(X(Z,U))return!0;return!1}function z(Z){if(Z instanceof Error)return Z.stack||Z.message;return Z}function $(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return W.enable(W.load()),W}VZ.exports=$w});var XZ=k((YZ,E9)=>{YZ.formatArgs=Uw;YZ.save=Hw;YZ.load=Bw;YZ.useColors=zw;YZ.storage=jw();YZ.destroy=(()=>{let Q=!1;return()=>{if(!Q)Q=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();YZ.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function zw(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let Q;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(Q=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(Q[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Uw(Q){if(Q[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+Q[0]+(this.useColors?"%c ":" ")+"+"+E9.exports.humanize(this.diff),!this.useColors)return;let J="color: "+this.color;Q.splice(1,0,J,"color: inherit");let W=0,V=0;Q[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(W++,Y==="%c")V=W}),Q.splice(V,0,J)}YZ.log=console.debug||console.log||(()=>{});function Hw(Q){try{if(Q)YZ.storage.setItem("debug",Q);else YZ.storage.removeItem("debug")}catch(J){}}function Bw(){let Q;try{Q=YZ.storage.getItem("debug")||YZ.storage.getItem("DEBUG")}catch(J){}if(!Q&&typeof process<"u"&&"env"in process)Q=process.env.DEBUG;return Q}function jw(){try{return localStorage}catch(Q){}}E9.exports=YJ()(YZ);var{formatters:Fw}=E9.exports;Fw.j=function(Q){try{return JSON.stringify(Q)}catch(J){return"[UnexpectedJSONParseError]: "+J.message}}});var KZ=k((cR,qZ)=>{qZ.exports=(Q,J=process.argv)=>{let W=Q.startsWith("-")?"":Q.length===1?"-":"--",V=J.indexOf(W+Q),Y=J.indexOf("--");return V!==-1&&(Y===-1||V<Y)}});var zZ=k((dR,$Z)=>{var Pw=e1("os"),ZZ=e1("tty"),e0=KZ(),{env:N0}=process,i1;if(e0("no-color")||e0("no-colors")||e0("color=false")||e0("color=never"))i1=0;else if(e0("color")||e0("colors")||e0("color=true")||e0("color=always"))i1=1;if("FORCE_COLOR"in N0)if(N0.FORCE_COLOR==="true")i1=1;else if(N0.FORCE_COLOR==="false")i1=0;else i1=N0.FORCE_COLOR.length===0?1:Math.min(parseInt(N0.FORCE_COLOR,10),3);function XJ(Q){if(Q===0)return!1;return{level:Q,hasBasic:!0,has256:Q>=2,has16m:Q>=3}}function qJ(Q,J){if(i1===0)return 0;if(e0("color=16m")||e0("color=full")||e0("color=truecolor"))return 3;if(e0("color=256"))return 2;if(Q&&!J&&i1===void 0)return 0;let W=i1||0;if(N0.TERM==="dumb")return W;if(process.platform==="win32"){let V=Pw.release().split(".");if(Number(V[0])>=10&&Number(V[2])>=10586)return Number(V[2])>=14931?3:2;return 1}if("CI"in N0){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((V)=>(V in N0))||N0.CI_NAME==="codeship")return 1;return W}if("TEAMCITY_VERSION"in N0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(N0.TEAMCITY_VERSION)?1:0;if(N0.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in N0){let V=parseInt((N0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(N0.TERM_PROGRAM){case"iTerm.app":return V>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(N0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(N0.TERM))return 1;if("COLORTERM"in N0)return 1;return W}function Aw(Q){let J=qJ(Q,Q&&Q.isTTY);return XJ(J)}$Z.exports={supportsColor:Aw,stdout:XJ(qJ(!0,ZZ.isatty(1))),stderr:XJ(qJ(!0,ZZ.isatty(2)))}});var jZ=k((HZ,k9)=>{var Ow=e1("tty"),v9=e1("util");HZ.init=kw;HZ.log=Sw;HZ.formatArgs=Rw;HZ.save=Ew;HZ.load=vw;HZ.useColors=Cw;HZ.destroy=v9.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");HZ.colors=[6,2,3,4,5,1];try{let Q=zZ();if(Q&&(Q.stderr||Q).level>=2)HZ.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(Q){}HZ.inspectOpts=Object.keys(process.env).filter((Q)=>{return/^debug_/i.test(Q)}).reduce((Q,J)=>{let W=J.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,X)=>{return X.toUpperCase()}),V=process.env[J];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return Q[W]=V,Q},{});function Cw(){return"colors"in HZ.inspectOpts?Boolean(HZ.inspectOpts.colors):Ow.isatty(process.stderr.fd)}function Rw(Q){let{namespace:J,useColors:W}=this;if(W){let V=this.color,Y="\x1B[3"+(V<8?V:"8;5;"+V),X=` ${Y};1m${J} \x1B[0m`;Q[0]=X+Q[0].split(`
|
|
122
|
+
`).join(`
|
|
123
|
+
`+X),Q.push(Y+"m+"+k9.exports.humanize(this.diff)+"\x1B[0m")}else Q[0]=Tw()+J+" "+Q[0]}function Tw(){if(HZ.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Sw(...Q){return process.stderr.write(v9.formatWithOptions(HZ.inspectOpts,...Q)+`
|
|
124
|
+
`)}function Ew(Q){if(Q)process.env.DEBUG=Q;else delete process.env.DEBUG}function vw(){return process.env.DEBUG}function kw(Q){Q.inspectOpts={};let J=Object.keys(HZ.inspectOpts);for(let W=0;W<J.length;W++)Q.inspectOpts[J[W]]=HZ.inspectOpts[J[W]]}k9.exports=YJ()(HZ);var{formatters:UZ}=k9.exports;UZ.o=function(Q){return this.inspectOpts.colors=this.useColors,v9.inspect(Q,this.inspectOpts).split(`
|
|
125
|
+
`).map((J)=>J.trim()).join(" ")};UZ.O=function(Q){return this.inspectOpts.colors=this.useColors,v9.inspect(Q,this.inspectOpts)}});var ZJ=k((nR,KJ)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)KJ.exports=XZ();else KJ.exports=jZ()});var FZ=k((l0)=>{var uw=l0&&l0.__importDefault||function(Q){return Q&&Q.__esModule?Q:{default:Q}};Object.defineProperty(l0,"__esModule",{value:!0});var mw=e1("fs"),fw=uw(ZJ()),K8=fw.default("@kwsites/file-exists");function cw(Q,J,W){K8("checking %s",Q);try{let V=mw.statSync(Q);if(V.isFile()&&J)return K8("[OK] path represents a file"),!0;if(V.isDirectory()&&W)return K8("[OK] path represents a directory"),!0;return K8("[FAIL] path represents something other than a file or directory"),!1}catch(V){if(V.code==="ENOENT")return K8("[FAIL] path is not accessible: %o",V),!1;throw K8("[FATAL] %o",V),V}}function dw(Q,J=l0.READABLE){return cw(Q,(J&l0.FILE)>0,(J&l0.FOLDER)>0)}l0.exists=dw;l0.FILE=1;l0.FOLDER=2;l0.READABLE=l0.FILE+l0.FOLDER});var DZ=k(($J)=>{function lw(Q){for(var J in Q)if(!$J.hasOwnProperty(J))$J[J]=Q[J]}Object.defineProperty($J,"__esModule",{value:!0});lw(FZ())});var UJ=k((NZ)=>{Object.defineProperty(NZ,"__esModule",{value:!0});NZ.createDeferred=NZ.deferred=void 0;function zJ(){let Q,J,W="pending";return{promise:new Promise((Y,X)=>{Q=Y,J=X}),done(Y){if(W==="pending")W="resolved",Q(Y)},fail(Y){if(W==="pending")W="rejected",J(Y)},get fulfilled(){return W!=="pending"},get status(){return W}}}NZ.deferred=zJ;NZ.createDeferred=zJ;NZ.default=zJ});import{Buffer as tw}from"node:buffer";import{spawn as bL}from"child_process";import{normalize as tM}from"node:path";import{EventEmitter as tP}from"node:events";function IJ(...Q){let J=new String(Q);return f9.set(J,Q),J}function N5(Q){return Q instanceof String&&f9.has(Q)}function GZ(Q){return f9.get(Q)||[]}function eZ(Q){if(typeof Q!=="function")return O6;return Q}function Q$(Q){return typeof Q==="function"&&Q!==O6}function J$(Q,J){let W=Q.indexOf(J);if(W<=0)return[Q,""];return[Q.substr(0,W),Q.substr(W+1)]}function W$(Q,J=0){return V$(Q)&&Q.length>J?Q[J]:void 0}function A6(Q,J=0){if(V$(Q)&&Q.length>J)return Q[Q.length-1-J]}function V$(Q){return o9(Q)}function L5(Q="",J=!0,W=`
|
|
126
|
+
`){return Q.split(W).reduce((V,Y)=>{let X=J?Y.trim():Y;if(X)V.push(X);return V},[])}function _J(Q,J){return L5(Q,!0).map((W)=>J(W))}function yJ(Q){return c9.exists(Q,c9.FOLDER)}function Q1(Q,J){if(Array.isArray(Q)){if(!Q.includes(J))Q.push(J)}else Q.add(J);return J}function Y$(Q,J){if(Array.isArray(Q)&&!Q.includes(J))Q.push(J);return Q}function d9(Q,J){if(Array.isArray(Q)){let W=Q.indexOf(J);if(W>=0)Q.splice(W,1)}else Q.delete(J);return J}function M1(Q){return Array.isArray(Q)?Q:[Q]}function X$(Q){return Q.replace(/[\s-]+(.)/g,(J,W)=>{return W.toUpperCase()})}function H8(Q){return M1(Q).map((J)=>{return J instanceof String?J:String(J)})}function t(Q,J=0){if(Q==null)return J;let W=parseInt(Q,10);return Number.isNaN(W)?J:W}function I5(Q,J){let W=[];for(let V=0,Y=Q.length;V<Y;V++)W.push(J,Q[V]);return W}function G5(Q){return(Array.isArray(Q)?tw.concat(Q):Q).toString("utf-8")}function q$(Q,J){let W={};return J.forEach((V)=>{if(Q[V]!==void 0)W[V]=Q[V]}),W}function GJ(Q=0){return new Promise((J)=>setTimeout(J,Q))}function wJ(Q){if(Q===!1)return;return Q}function L0(Q,J,W){if(J(Q))return Q;return arguments.length>2?W:void 0}function LJ(Q,J){let W=N5(Q)?"string":typeof Q;return/number|string|boolean/.test(W)&&(!J||!J.includes(W))}function n9(Q){return!!Q&&M5(Q)==="[object Object]"}function K$(Q){return typeof Q==="function"}function JL(){throw Error("LineParser:useMatches not implemented")}function $$(...Q){let J=process.cwd(),W=Object.assign({baseDir:J,...z$},...Q.filter((V)=>typeof V==="object"&&V));return W.baseDir=W.baseDir||J,W.trimmed=W.trimmed===!0,W}function gJ(Q,J=[]){if(!n9(Q))return J;return Object.keys(Q).reduce((W,V)=>{let Y=Q[V];if(N5(Y))W.push(Y);else if(LJ(Y,["boolean"]))W.push(V+"="+Y);else if(Array.isArray(Y)){for(let X of Y)if(!LJ(X,["string","number"]))W.push(V+"="+X)}else W.push(V);return W},J)}function T0(Q,J=0,W=!1){let V=[];for(let Y=0,X=J<0?Q.length:J;Y<X;Y++)if("string|number".includes(typeof Q[Y]))V.push(String(Q[Y]));if(gJ(pJ(Q),V),!W)V.push(...YL(Q));return V}function YL(Q){let J=typeof A6(Q)==="function";return H8(L0(A6(Q,J?1:0),P5,[]))}function pJ(Q){let J=K$(A6(Q));return L0(A6(Q,J?1:0),n9)}function Y0(Q,J=!0){let W=eZ(A6(Q));return J||Q$(W)?W:void 0}function PJ(Q,J){return Q(J.stdOut,J.stdErr)}function h0(Q,J,W,V=!0){return M1(W).forEach((Y)=>{for(let X=L5(Y,V),q=0,K=X.length;q<K;q++){let z=($=0)=>{if(q+$>=K)return;return X[q+$]};J.some(({parse:$})=>$(z,Q))}}),Q}function KL(Q){switch(Q){case"bare":return j$();case"root":return B$()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:a9,parser:uJ}}function B$(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:a9,parser(J){return/^\.(git)?$/.test(J.trim())}}}function j$(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:a9,parser:uJ}}function ZL(Q){return/(Not a git repository|Kein Git-Repository)/i.test(String(Q))}function $L(Q,J){let W=new D$(Q),V=Q?I$:N$;return L5(J).forEach((Y)=>{let X=Y.replace(V,"");W.paths.push(X),(G$.test(X)?W.folders:W.files).push(X)}),W}function w$(Q){return{commands:i9,format:"empty",parser:Q}}function y0(Q){return{commands:i9,format:"empty",parser(){throw typeof Q==="string"?new rZ(Q):Q}}}function S0(Q,J=!1){return{commands:Q,format:"utf-8",parser(W){return J?String(W).trim():W}}}function L$(Q){return{commands:Q,format:"buffer",parser(J){return J}}}function M$(Q){return Q.format==="buffer"}function P$(Q){return Q.format==="empty"||!Q.commands.length}function UL(Q,J){let{cleanMode:W,options:V,valid:Y}=BL(Q);if(!W)return y0(fJ);if(!Y.options)return y0(cJ+JSON.stringify(Q));if(V.push(...J),V.some(DL))return y0(mJ);return O$(W,V)}function O$(Q,J){return{commands:["clean",`-${Q}`,...J],format:"utf-8",parser(V){return $L(Q==="n",V)}}}function HL(Q){return Array.isArray(Q)&&Q.every((J)=>dJ.has(J))}function BL(Q){let J,W=[],V={cleanMode:!1,options:!0};return Q.replace(/[^a-z]i/g,"").split("").forEach((Y)=>{if(jL(Y))J=Y,V.cleanMode=!0;else V.options=V.options&&FL(W[W.length]=`-${Y}`)}),{cleanMode:J,options:W,valid:V}}function jL(Q){return Q==="f"||Q==="n"}function FL(Q){return/^-[a-z]$/i.test(Q)&&dJ.has(Q.charAt(1))}function DL(Q){if(/^-[^\-]/.test(Q))return Q.indexOf("i")>0;return Q==="--interactive"}function NL(Q){let J=new T$;for(let W of R$(Q))J.addValue(W.file,String(W.key),W.value);return J}function IL(Q,J){let W=null,V=[],Y=new Map;for(let X of R$(Q,J)){if(X.key!==J)continue;if(V.push(W=X.value),!Y.has(X.file))Y.set(X.file,[]);Y.get(X.file).push(W)}return{key:J,paths:Array.from(Y.keys()),scopes:Y,value:W,values:V}}function GL(Q){return Q.replace(/^(file):/,"")}function*R$(Q,J=null){let W=Q.split("\x00");for(let V=0,Y=W.length-1;V<Y;){let X=GL(W[V++]),q=W[V++],K=J;if(q.includes(`
|
|
127
|
+
`)){let z=J$(q,`
|
|
128
|
+
`);K=z[0],q=z[1]}yield{file:X,key:K,value:q}}}function HJ(Q,J){if(typeof Q==="string"&&Object.hasOwn(CJ,Q))return Q;return J}function LL(Q,J,W,V){let Y=["config",`--${V}`];if(W)Y.push("--add");return Y.push(Q,J),{commands:Y,format:"utf-8",parser(X){return X}}}function ML(Q,J){let W=["config","--null","--show-origin","--get-all",Q];if(J)W.splice(1,0,`--${J}`);return{commands:W,format:"utf-8",parser(V){return IL(V,Q)}}}function PL(Q){let J=["config","--list","--show-origin","--null"];if(Q)J.push(`--${Q}`);return{commands:J,format:"utf-8",parser(W){return NL(W)}}}function AL(){return{addConfig(Q,J,...W){return this._runTask(LL(Q,J,W[0]===!0,HJ(W[1],"local")),Y0(arguments))},getConfig(Q,J){return this._runTask(ML(Q,HJ(J,void 0)),Y0(arguments))},listConfig(...Q){return this._runTask(PL(HJ(Q[0],void 0)),Y0(arguments))}}}function OL(Q){return E$.has(Q)}function CL(...Q){return new x$().param(...Q)}function RL(Q){let J=new Set,W={};return _J(Q,(V)=>{let[Y,X,q]=V.split($8);J.add(Y),(W[Y]=W[Y]||[]).push({line:t(X),path:Y,preview:q})}),{paths:J,results:W}}function TL(){return{grep(Q){let J=Y0(arguments),W=T0(arguments);for(let Y of k$)if(W.includes(Y))return this._runTask(y0(`git.grep: use of "${Y}" is not supported.`),J);if(typeof Q==="string")Q=CL().param(Q);let V=["grep","--null","-n","--full-name",...W,...Q];return this._runTask({commands:V,format:"utf-8",parser(Y){return RL(Y)}},J)}}}function SL(Q,J){let W=["reset"];if(y$(Q))W.push(`--${Q}`);return W.push(...J),S0(W)}function EL(Q){if(y$(Q))return Q;switch(typeof Q){case"string":case"undefined":return"soft"}return}function y$(Q){return typeof Q==="string"&&h$.includes(Q)}function vL(){return u9.default("simple-git")}function LZ(Q,J,W){if(!J||!String(J).replace(/\s*/,""))return!W?Q:(V,...Y)=>{Q(V,...Y),W(V,...Y)};return(V,...Y)=>{if(Q(`%s ${V}`,J,...Y),W)W(V,...Y)}}function kL(Q,J,{namespace:W}){if(typeof Q==="string")return Q;let V=J&&J.namespace||"";if(V.startsWith(W))return V.substr(W.length+1);return V||W}function lJ(Q,J,W,V=vL()){let Y=Q&&`[${Q}]`||"",X=[],q=typeof J==="string"?V.extend(J):J,K=kL(L0(J,q0),q,V);return $(W);function z(Z,U){return Q1(X,lJ(Q,K.replace(/^[^:]+/,Z),U,V))}function $(Z){let U=Z&&`[${Z}]`||"",H=q&&LZ(q,U)||O6,B=LZ(V,`${Y} ${U}`,H);return Object.assign(q?H:B,{label:Q,sibling:z,info:B,step:$})}}function P6(Q,J){return{method:W$(Q.commands)||"",commands:J}}function _L(Q,J){return(W)=>{J("[ERROR] child process exception %o",W),Q.push(Buffer.from(String(W.stack),"ascii"))}}function MZ(Q,J,W,V){return(Y)=>{W("%s received %L bytes",J,Y),V("%B",Y),Q.push(Y)}}function gL(Q,J,W=O6){let V=(X)=>{W(null,X)},Y=(X)=>{if(X?.task===Q)W(X instanceof w5?pL(X):X,void 0)};J.then(V,Y)}function pL(Q){let J=(V)=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${V} should be GitResponseError.git.${V}, this will no longer be available in version 3`),J=O6};return Object.create(Q,Object.getOwnPropertyNames(Q.git).reduce(W,{}));function W(V,Y){if(Y in Q)return V;return V[Y]={enumerable:!1,configurable:!1,get(){return J(Y),Q.git[Y]}},V}}function PZ(Q,J){return w$((W)=>{if(!yJ(Q))throw Error(`Git.cwd: cannot change to non-directory "${Q}"`);return(J||W).cwd=Q})}function jJ(Q){let J=["checkout",...Q];if(J[1]==="-b"&&J.includes("-B"))J[1]=d9(J,"-B");return S0(J)}function fL(){return{checkout(){return this._runTask(jJ(T0(arguments,1)),Y0(arguments))},checkoutBranch(Q,J){return this._runTask(jJ(["-b",Q,J,...T0(arguments)]),Y0(arguments))},checkoutLocalBranch(Q){return this._runTask(jJ(["-b",Q,...T0(arguments)]),Y0(arguments))}}}function dL(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function lL(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(Q){return h0(dL(),[c$],Q)}})}}}function oL(Q){return h0({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},d$,Q)}function iL(Q,J,W){return{commands:["-c","core.abbrev=40","commit",...I5(Q,"-m"),...J,...W],format:"utf-8",parser:oL}}function sL(){return{commit(J,...W){let V=Y0(arguments),Y=Q(J)||iL(M1(J),M1(L0(W[0],g9,[])),[...H8(L0(W[1],P5,[])),...T0(arguments,0,!0)]);return this._runTask(Y,V)}};function Q(J){return!g9(J)&&y0("git.commit: requires the commit message to be supplied as a string/string[]")}}function tL(){return{firstCommit(){return this._runTask(S0(["rev-list","--max-parents=0","HEAD"],!0),Y0(arguments))}}}function QM(Q,J){let W=["hash-object",Q];if(J)W.push("-w");return S0(W,!0)}function WM(Q,J,W){let V=String(W).trim(),Y;if(Y=l$.exec(V))return new y9(Q,J,!1,Y[1]);if(Y=n$.exec(V))return new y9(Q,J,!0,Y[1]);let X="",q=V.split(" ");while(q.length)if(q.shift()==="in"){X=q.join(" ");break}return new y9(Q,J,/^re/i.test(V),X)}function YM(Q){return Q.includes(nJ)}function XM(Q=!1,J,W){let V=["init",...W];if(Q&&!YM(V))V.splice(1,0,nJ);return{commands:V,format:"utf-8",parser(Y){return WM(V.includes("--bare"),J,Y)}}}function oJ(Q){for(let J=0;J<Q.length;J++){let W=aJ.exec(Q[J]);if(W)return`--${W[1]}`}return""}function KM(Q){return aJ.test(Q)}function a$(Q=""){let J=i$[Q];return(W)=>h0(new o$,J,W,!1)}function $M(Q,J){return J.reduce((W,V,Y)=>{return W[V]=Q[Y]||"",W},Object.create({diff:null}))}function r$(Q=rJ,J=t$,W=""){let V=a$(W);return function(Y){let X=L5(Y.trim(),!1,iJ).map(function(q){let K=q.split(sJ),z=$M(K[0].split(Q),J);if(K.length>1&&!!K[1].trim())z.diff=V(K[1]);return z});return{all:X,latest:X.length&&X[0]||null,total:X.length}}}function zM(Q){let J=oJ(Q),W=["diff"];if(J==="")J="--stat",W.push("--stat=4096");return W.push(...Q),s9(W)||{commands:W,format:"utf-8",parser:a$(J)}}function s9(Q){let J=Q.filter(KM);if(J.length>1)return y0(`Summary flags are mutually exclusive - pick one of ${J.join(",")}`);if(J.length&&Q.includes("-z"))return y0(`Summary flag ${J} parsing is not compatible with null termination option '-z'`)}function UM(Q,J){let W=[],V=[];return Object.keys(Q).forEach((Y)=>{W.push(Y),V.push(String(Q[Y]))}),[W,V.join(J)]}function HM(Q){return Object.keys(Q).reduce((J,W)=>{if(!(W in TJ))J[W]=Q[W];return J},{})}function Jz(Q={},J=[]){let W=L0(Q.splitter,q0,rJ),V=n9(Q.format)?Q.format:{hash:"%H",date:Q.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:Q.multiLine?"%B":"%b",author_name:Q.mailMap!==!1?"%aN":"%an",author_email:Q.mailMap!==!1?"%aE":"%ae"},[Y,X]=UM(V,W),q=[],K=[`--pretty=format:${iJ}${X}${sJ}`,...J],z=Q.n||Q["max-count"]||Q.maxCount;if(z)K.push(`--max-count=${z}`);if(Q.from||Q.to){let $=Q.symmetric!==!1?"...":"..";q.push(`${Q.from||""}${$}${Q.to||""}`)}if(q0(Q.file))K.push("--follow",IJ(Q.file));return gJ(HM(Q),K),{fields:Y,splitter:W,commands:[...K,...q]}}function BM(Q,J,W){let V=r$(Q,J,oJ(W));return{commands:["log",...W],format:"utf-8",parser:V}}function jM(){return{log(...W){let V=Y0(arguments),Y=Jz(pJ(arguments),H8(L0(arguments[0],P5,[]))),X=J(...W)||s9(Y.commands)||Q(Y);return this._runTask(X,V)}};function Q(W){return BM(W.splitter,W.fields,W.commands)}function J(W,V){return q0(W)&&q0(V)&&y0("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}function DJ(Q){return Q.objects=Q.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function RZ(Q){let J=/^\s*(\d+)/.exec(Q),W=/delta (\d+)/i.exec(Q);return{count:t(J&&J[1]||"0"),delta:t(W&&W[1]||"0")}}function qz(Q,J){return h0({remoteMessages:new Zz},Kz,J)}function IM(Q,J){let W=h0(new Yz,zz,[Q,J]);return W.message&&W}function _Z(Q){if(!Q.length)return y0("Git.merge requires at least one option");return{commands:["merge",...Q],format:"utf-8",parser(J,W){let V=Hz(J,W);if(V.failed)throw new w5(V);return V}}}function LM(Q,J,W){let V=W.includes("deleted"),Y=W.includes("tag")||/^refs\/tags/.test(Q),X=!W.includes("new");return{deleted:V,tag:Y,branch:!Y,new:!X,alreadyUpdated:X,local:Q,remote:J}}function PM(Q={},J){return Q1(J,"--tags"),QW(Q,J)}function QW(Q={},J){let W=["push",...J];if(Q.branch)W.splice(1,0,Q.branch);if(Q.remote)W.splice(1,0,Q.remote);return d9(W,"-v"),Q1(W,"--verbose"),Q1(W,"--porcelain"),{commands:W,format:"utf-8",parser:Bz}}function AM(){return{showBuffer(){let Q=["show",...T0(arguments,1)];if(!Q.includes("--binary"))Q.splice(1,0,"--binary");return this._runTask(L$(Q),Y0(arguments))},show(){let Q=["show",...T0(arguments,1)];return this._runTask(S0(Q),Y0(arguments))}}}function pZ(Q){let[J,W]=Q.split($8);return{from:W||J,to:J}}function n0(Q,J,W){return[`${Q}${J}`,W]}function NJ(Q,...J){return J.map((W)=>n0(Q,W,(V,Y)=>V.conflicted.push(Y)))}function RM(Q,J){let W=J.trim();switch(" "){case W.charAt(2):return V(W.charAt(0),W.charAt(1),W.slice(3));case W.charAt(1):return V(" ",W.charAt(0),W.slice(2));default:return}function V(Y,X,q){let K=`${Y}${X}`,z=Nz.get(K);if(z)z(Q,q);if(K!=="##"&&K!=="!!")Q.files.push(new Dz(q,Y,X))}}function SM(Q){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...Q.filter((W)=>!Gz.includes(W))],parser(W){return Iz(W)}}}function m9(Q=0,J=0,W=0,V="",Y=!0){return Object.defineProperty({major:Q,minor:J,patch:W,agent:V,installed:Y},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function vM(){return m9(0,0,0,"",!1)}function kM(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:xM,onError(Q,J,W,V){if(Q.exitCode===-2)return W(Buffer.from(JW));V(J)}})}}}function xM(Q){if(Q===JW)return vM();return h0(m9(0,0,0,Q),wz,Q)}function mZ(Q,J,W,...V){if(!q0(W))return y0(`git.${Q}() requires a string 'repoPath'`);return J(W,L0(V[0],q0),T0(arguments))}function _M(){return{clone(Q,...J){return this._runTask(mZ("clone",EJ,L0(Q,q0),...J),Y0(arguments))},mirror(Q,...J){return this._runTask(mZ("mirror",Lz,L0(Q,q0),...J),Y0(arguments))}}}function pM(Q,J){return S0(["apply",...J,...Q])}function mM(Q,J){return{branch:Q,hash:J,success:!0}}function fM(Q){return{branch:Q,hash:null,success:!1}}function Tz(Q,J){return J===1&&kJ.test(Q)}function lZ(Q){return Q?Q.charAt(0):""}function Ez(Q,J=!1){return h0(new Sz,J?[kz]:vz,Q)}function bz(Q){let J=["-d","-D","--delete"];return Q.some((W)=>J.includes(W))}function oM(Q){let J=bz(Q),W=Q.includes("--show-current"),V=["branch",...Q];if(V.length===1)V.push("-a");if(!V.includes("-v"))V.splice(1,0,"-v");return{format:"utf-8",commands:V,parser(Y,X){if(J)return r9(Y,X).all[0];return Ez(Y,W)}}}function aM(){return{format:"utf-8",commands:["branch","-v"],parser(Q){return Ez(Q)}}}function iM(Q,J=!1){return{format:"utf-8",commands:["branch","-v",J?"-D":"-d",...Q],parser(W,V){return r9(W,V)},onError({exitCode:W,stdOut:V},Y,X,q){if(!Tz(String(Y),W))return q(Y);X(V)}}}function sM(Q,J=!1){let W={format:"utf-8",commands:["branch","-v",J?"-D":"-d",Q],parser(V,Y){return r9(V,Y).branches[Q]},onError({exitCode:V,stdErr:Y,stdOut:X},q,K,z){if(!Tz(String(q),V))return z(q);throw new w5(W.parser(G5(X),G5(Y)),String(q))}};return W}function eM(Q){let J=Q.trim().replace(/^["']|["']$/g,"");return J&&tM(J)}function JP(Q){return{commands:["check-ignore",...Q],format:"utf-8",parser:_z}}function VP(Q,J){return h0({raw:Q,remote:null,branches:[],tags:[],updated:[],deleted:[]},hz,[Q,J])}function XP(Q){return/^--upload-pack(=|$)/.test(Q)}function qP(Q,J,W){let V=["fetch",...W];if(Q&&J)V.push(Q,J);if(V.find(XP))return y0("git.fetch: potential exploit argument blocked.");return{commands:V,format:"utf-8",parser:VP}}function ZP(Q){return h0({moves:[]},pz,Q)}function zP(Q,J){return{commands:["mv","-v",...M1(Q),J],format:"utf-8",parser:ZP}}function HP(Q,J,W){let V=["pull",...W];if(Q&&J)V.splice(1,0,Q,J);return{commands:V,format:"utf-8",parser(Y,X){return eJ(Y,X)},onError(Y,X,q,K){let z=IM(G5(Y.stdOut),G5(Y.stdErr));if(z)return K(new w5(z));K(X)}}}function jP(Q){let J={};return fz(Q,([W])=>J[W]={name:W}),Object.values(J)}function FP(Q){let J={};return fz(Q,([W,V,Y])=>{if(!Object.hasOwn(J,W))J[W]={name:W,refs:{fetch:"",push:""}};if(Y&&V)J[W].refs[Y.replace(/[^a-z]/g,"")]=V}),Object.values(J)}function fz(Q,J){_J(Q,(W)=>J(W.split(/\s+/)))}function NP(Q,J,W){return S0(["remote","add",...W,Q,J])}function IP(Q){let J=["remote"];if(Q)J.push("-v");return{commands:J,format:"utf-8",parser:Q?FP:jP}}function GP(Q){let J=[...Q];if(J[0]!=="ls-remote")J.unshift("ls-remote");return S0(J)}function wP(Q){let J=[...Q];if(J[0]!=="remote")J.unshift("remote");return S0(J)}function LP(Q){return S0(["remote","remove",Q])}function PP(Q={},J){let W=Jz(Q),V=["stash","list",...W.commands,...J],Y=r$(W.splitter,W.fields,oJ(V));return s9(V)||{commands:V,format:"utf-8",parser:Y}}function OP(Q,J){return t9(["add",Q,J])}function CP(Q){return t9(["init",...Q])}function t9(Q){let J=[...Q];if(J[0]!=="submodule")J.unshift("submodule");return S0(J)}function RP(Q){return t9(["update",...Q])}function SP(Q,J){let W=Number.isNaN(Q),V=Number.isNaN(J);if(W!==V)return W?1:-1;return W?nz(Q,J):0}function nz(Q,J){return Q===J?0:Q>J?1:-1}function EP(Q){return Q.trim()}function x9(Q){if(typeof Q==="string")return parseInt(Q.replace(/^\D+/g,""),10)||0;return 0}function kP(Q=[]){let J=Q.some((W)=>/^--sort=/.test(W));return{format:"utf-8",commands:["tag","-l",...Q],parser(W){return oz(W,J)}}}function xP(Q){return{format:"utf-8",commands:["tag",Q],parser(){return{name:Q}}}}function bP(Q,J){return{format:"utf-8",commands:["tag","-a","-m",J,Q],parser(){return{name:Q}}}}function gP(Q){if(!Q)return;return[{type:"spawn.before",action(V,Y){if(Q.aborted)Y.kill(new k1(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(V,Y){function X(){Y.kill(new k1(void 0,"abort","Abort signal received"))}Q.addEventListener("abort",X),Y.spawned.on("close",()=>Q.removeEventListener("abort",X))}}]}function pP(Q){return typeof Q==="string"&&Q.trim().toLowerCase()==="-c"}function uP(Q,J){if(typeof J!=="string"||!J.includes(Q))return!1;let W=J.trim().replace(/\0/g,"");return/^(--no)?-{1,2}[\dlsqvnobucj]+(\s|$)/.test(W)}function D5(Q,J,W=String(Q)){let V=typeof Q==="string"?new RegExp(`\\s*${Q}`,"i"):Q;return function(X,q,K){if(X[J]!==!0&&pP(q)&&V.test(K))throw new k1(void 0,"unsafe",`Configuring ${W} is not permitted without enabling ${J}`)}}function fP(Q,J){if(/^\s*--(upload|receive)-pack/.test(Q))throw new k1(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(J==="clone"&&uP("u",Q))throw new k1(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(J==="push"&&/^\s*--exec\b/.test(Q))throw new k1(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function cP({allowUnsafePack:Q=!1,...J}={}){return{type:"spawn.args",action(W,V){return W.forEach((Y,X)=>{let q=X<W.length?W[X+1]:"";Q||fP(Y,V.method),mP.forEach((K)=>K(J,Y,q))}),W}}}function dP(Q){let J=I5(Q,"-c");return{type:"spawn.args",action(W){return[...J,...W]}}}function lP({onClose:Q=!0,onExit:J=50}={}){function W(){let Y=-1,X={close:Z8.deferred(),closeTimeout:Z8.deferred(),exit:Z8.deferred(),exitTimeout:Z8.deferred()},q=Promise.race([Q===!1?oZ:X.closeTimeout.promise,J===!1?oZ:X.exitTimeout.promise]);return V(Q,X.close,X.closeTimeout),V(J,X.exit,X.exitTimeout),{close(K){Y=K,X.close.done()},exit(K){Y=K,X.exit.done()},get exitCode(){return Y},result:q}}function V(Y,X,q){if(Y===!1)return;(Y===!0?X.promise:X.promise.then(()=>GJ(Y))).then(q.done)}return{type:"spawn.after",async action(Y,{spawned:X,close:q}){let K=W(),z=!0,$=()=>void(z=!1);X.stdout?.on("data",$),X.stderr?.on("data",$),X.on("error",$),X.on("close",(Z)=>K.close(Z)),X.on("exit",(Z)=>K.exit(Z));try{if(await K.result,z)await GJ(50);q(K.exitCode)}catch(Z){q(K.exitCode,Z)}}}}function oP(Q){return!Q||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(Q)}function iZ(Q,J){if(Q.length<1||Q.length>2)throw new k1(void 0,"binary",nP);if(Q.some(oP))if(J)console.warn(aZ);else throw new k1(void 0,"binary",aZ);let[V,Y]=Q;return{binary:V,prefix:Y}}function aP(Q,J=["git"],W=!1){let V=iZ(M1(J),W);Q.on("binary",(Y)=>{V=iZ(M1(Y),W)}),Q.append("spawn.binary",()=>{return V.binary}),Q.append("spawn.args",(Y)=>{return V.prefix?[V.prefix,...Y]:Y})}function iP(Q){return!!(Q.exitCode&&Q.stdErr.length)}function sP(Q){return Buffer.concat([...Q.stdOut,...Q.stdErr])}function rP(Q=!1,J=iP,W=sP){return(V,Y)=>{if(!Q&&V||!J(Y))return V;return W(Y)}}function sZ(Q){return{type:"task.error",action(J,W){let V=Q(J.error,{stdErr:W.stdErr,stdOut:W.stdOut,exitCode:W.exitCode});if(Buffer.isBuffer(V))return{error:new x1(void 0,V.toString("utf-8"))};return{error:V}}}}function QA(Q){let W=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(X,q){if(!W.includes(q.method))return X;return Y$(X,"--progress")}},{type:"spawn.after",action(X,q){if(!q.commands.includes("--progress"))return;q.spawned.stderr?.on("data",(K)=>{let z=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(K.toString("utf8"));if(!z)return;Q({method:q.method,stage:JA(z[1]),progress:t(z[2]),processed:t(z[3]),total:t(z[4])})})}}]}function JA(Q){return String(Q.toLowerCase().split(" ",1))||"unknown"}function WA(Q){let J=q$(Q,["uid","gid"]);return{type:"spawn.options",action(W){return{...J,...W}}}}function VA({block:Q,stdErr:J=!0,stdOut:W=!0}){if(Q>0)return{type:"spawn.after",action(V,Y){let X;function q(){X&&clearTimeout(X),X=setTimeout(z,Q)}function K(){Y.spawned.stdout?.off("data",q),Y.spawned.stderr?.off("data",q),Y.spawned.off("exit",K),Y.spawned.off("close",K),X&&clearTimeout(X)}function z(){K(),Y.kill(new k1(void 0,"timeout","block timeout reached"))}W&&Y.spawned.stdout?.on("data",q),J&&Y.spawned.stderr?.on("data",q),Y.spawned.on("exit",K),Y.spawned.on("close",K),q()}}}function YA(){return{type:"spawn.args",action(Q){let J=[],W;function V(Y){(W=W||[]).push(...Y)}for(let Y=0;Y<Q.length;Y++){let X=Q[Y];if(N5(X)){V(GZ(X));continue}if(X==="--"){V(Q.slice(Y+1).flatMap((q)=>N5(q)&&GZ(q)||q));break}J.push(X)}return!W?J:[...J,"--",...W.map(String)]}}}function qA(Q,J){let W=new eP,V=$$(Q&&(typeof Q==="string"?{baseDir:Q}:Q)||{},J);if(!yJ(V.baseDir))throw new hP(V,"Cannot use simple-git on a directory that does not exist");if(Array.isArray(V.config))W.add(dP(V.config));return W.add(cP(V.unsafe)),W.add(lP(V.completion)),V.abort&&W.add(gP(V.abort)),V.progress&&W.add(QA(V.progress)),V.timeout&&W.add(VA(V.timeout)),V.spawnOptions&&W.add(WA(V.spawnOptions)),W.add(YA()),W.add(sZ(rP(!0))),V.errors&&W.add(sZ(V.errors)),aP(W,V.binary,V.unsafe?.allowUnsafeCustomBinary),new XA(V,W)}var c9,u9,Az,Z8,xJ,aw,bJ,iw,b=(Q,J)=>function(){return Q&&(J=(0,Q[bJ(Q)[0]])(Q=0)),J},sw=(Q,J)=>function(){return J||(0,Q[bJ(Q)[0]])((J={exports:{}}).exports,J),J.exports},B0=(Q,J)=>{for(var W in J)xJ(Q,W,{get:J[W],enumerable:!0})},rw=(Q,J,W,V)=>{if(J&&typeof J==="object"||typeof J==="function"){for(let Y of bJ(J))if(!iw.call(Q,Y)&&Y!==W)xJ(Q,Y,{get:()=>J[Y],enumerable:!(V=aw(J,Y))||V.enumerable})}return Q},U0=(Q)=>rw(xJ({},"__esModule",{value:!0}),Q),f9,z8,x1,r1,w5,U8,rZ,tZ,$8,O6,M5,l9,P5,Z$,q0,g9,o9,hJ,MJ,ew,p9,QL,c,s1,WL,z$,VL,XL,qL,U$,f,H$,AJ,a9,uJ,F$,D$,N$,I$,G$,zL,OJ,i9,H0,A$,mJ,fJ,cJ,b9,dJ,C$,T$,wL,CJ,S$,BJ,E$,v$,k$,F5,wZ,x$,b$,_$,_9,h$,g$,p$,u$,xL,RJ,yL,m$,f$,hL,uL,mL,cL,c$,nL,d$,aL,rL,eL,JM,y9,l$,n$,VM,nJ,qM,aJ,A5,o$,ZM,FJ,AZ,OZ,CZ,i$,s$,iJ,sJ,rJ,t$,e$,Qz,tJ,TJ,Wz,h9,Vz,FM,SJ,Yz,DM,Xz,NM,Kz,Zz,$z,TZ,SZ,EZ,vZ,zz,kZ,eJ,Uz,xZ,Hz,bZ,GM,wM,yZ,Bz,hZ,MM,jz,Fz,OM,gZ,Dz,CM,uZ,Nz,Iz,TM,Gz,EM,JW,wz,bM,EJ,Lz,yM,Mz,vJ,hM,Pz,fZ,Oz,gM,Cz,uM,Rz,cM,cZ,kJ,dZ,r9,dM,Sz,lM,vz,kz,nM,xz,rM,_z,QP,yz,WP,hz,YP,gz,KP,pz,$P,uz,UP,mz,BP,DP,cz,MP,dz,AP,lz,TP,nZ,oz,vP,az,_P,yP,hP,k1,mP,oZ,nP="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",aZ="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option",eP=class{constructor(){this.plugins=new Set,this.events=new tP}on(Q,J){this.events.on(Q,J)}reconfigure(Q,J){this.events.emit(Q,J)}append(Q,J){let W=Q1(this.plugins,{type:Q,action:J});return()=>this.plugins.delete(W)}add(Q){let J=[];return M1(Q).forEach((W)=>W&&this.plugins.add(Q1(J,W))),()=>{J.forEach((W)=>this.plugins.delete(W))}}exec(Q,J,W){let V=J,Y=Object.freeze(Object.create(W));for(let X of this.plugins)if(X.type===Q)V=X.action(V,Y);return V}},XA,iz;var sz=$1(()=>{c9=F8(DZ(),1),u9=F8(ZJ(),1),Az=F8(UJ(),1),Z8=F8(UJ(),1),xJ=Object.defineProperty,aw=Object.getOwnPropertyDescriptor,bJ=Object.getOwnPropertyNames,iw=Object.prototype.hasOwnProperty;z8=b({"src/lib/args/pathspec.ts"(){f9=new WeakMap}}),r1=b({"src/lib/errors/git-error.ts"(){x1=class extends Error{constructor(Q,J){super(J);this.task=Q,Object.setPrototypeOf(this,new.target.prototype)}}}}),U8=b({"src/lib/errors/git-response-error.ts"(){r1(),w5=class extends x1{constructor(Q,J){super(void 0,J||String(Q));this.git=Q}}}}),tZ=b({"src/lib/errors/task-configuration-error.ts"(){r1(),rZ=class extends x1{constructor(Q){super(void 0,Q)}}}});l9=b({"src/lib/utils/util.ts"(){hJ(),$8="\x00",O6=()=>{},M5=Object.prototype.toString.call.bind(Object.prototype.toString)}});hJ=b({"src/lib/utils/argument-filters.ts"(){z8(),l9(),P5=(Q)=>{return Array.isArray(Q)},Z$=(Q)=>{return typeof Q==="number"},q0=(Q)=>{return typeof Q==="string"||N5(Q)},g9=(Q)=>{return q0(Q)||Array.isArray(Q)&&Q.every(q0)},o9=(Q)=>{if(Q==null||"number|boolean|function".includes(typeof Q))return!1;return typeof Q.length==="number"}}}),ew=b({"src/lib/utils/exit-codes.ts"(){MJ=((Q)=>{return Q[Q.SUCCESS=0]="SUCCESS",Q[Q.ERROR=1]="ERROR",Q[Q.NOT_FOUND=-2]="NOT_FOUND",Q[Q.UNCLEAN=128]="UNCLEAN",Q})(MJ||{})}}),QL=b({"src/lib/utils/git-output-streams.ts"(){p9=class Q{constructor(J,W){this.stdOut=J,this.stdErr=W}asStrings(){return new Q(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});WL=b({"src/lib/utils/line-parser.ts"(){c=class{constructor(Q,J){if(this.matches=[],this.useMatches=JL,this.parse=(W,V)=>{if(this.resetMatches(),!this._regExp.every((Y,X)=>this.addMatch(Y,X,W(X))))return!1;return this.useMatches(V,this.prepareMatches())!==!1},this._regExp=Array.isArray(Q)?Q:[Q],J)this.useMatches=J}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(Q,J,W){let V=W&&Q.exec(W);if(V)this.pushMatch(J,V);return!!V}pushMatch(Q,J){this.matches.push(...J.slice(1))}},s1=class extends c{addMatch(Q,J,W){return/^remote:\s/.test(String(W))&&super.addMatch(Q,J,W)}pushMatch(Q,J){if(Q>0||J.length>1)super.pushMatch(Q,J)}}}});VL=b({"src/lib/utils/simple-git-options.ts"(){z$={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});XL=b({"src/lib/utils/task-options.ts"(){hJ(),l9(),z8()}});qL=b({"src/lib/utils/task-parser.ts"(){l9()}}),U$={};B0(U$,{ExitCodes:()=>MJ,GitOutputStreams:()=>p9,LineParser:()=>c,NOOP:()=>O6,NULL:()=>$8,RemoteLineParser:()=>s1,append:()=>Q1,appendTaskOptions:()=>gJ,asArray:()=>M1,asCamelCase:()=>X$,asFunction:()=>eZ,asNumber:()=>t,asStringArray:()=>H8,bufferToString:()=>G5,callTaskParser:()=>PJ,createInstanceConfig:()=>$$,delay:()=>GJ,filterArray:()=>P5,filterFunction:()=>K$,filterHasLength:()=>o9,filterNumber:()=>Z$,filterPlainObject:()=>n9,filterPrimitives:()=>LJ,filterString:()=>q0,filterStringOrStringArray:()=>g9,filterType:()=>L0,first:()=>W$,folderExists:()=>yJ,forEachLineWithContent:()=>_J,getTrailingOptions:()=>T0,including:()=>Y$,isUserFunction:()=>Q$,last:()=>A6,objectToString:()=>M5,orVoid:()=>wJ,parseStringResponse:()=>h0,pick:()=>q$,prefixedArray:()=>I5,remove:()=>d9,splitOn:()=>J$,toLinesWithContent:()=>L5,trailingFunctionArgument:()=>Y0,trailingOptionsArgument:()=>pJ});f=b({"src/lib/utils/index.ts"(){hJ(),ew(),QL(),WL(),VL(),XL(),qL(),l9()}}),H$={};B0(H$,{CheckRepoActions:()=>AJ,checkIsBareRepoTask:()=>j$,checkIsRepoRootTask:()=>B$,checkIsRepoTask:()=>KL});F$=b({"src/lib/tasks/check-is-repo.ts"(){f(),AJ=((Q)=>{return Q.BARE="bare",Q.IN_TREE="tree",Q.IS_REPO_ROOT="root",Q})(AJ||{}),a9=({exitCode:Q},J,W,V)=>{if(Q===128&&ZL(J))return W(Buffer.from("false"));V(J)},uJ=(Q)=>{return Q.trim()==="true"}}});zL=b({"src/lib/responses/CleanSummary.ts"(){f(),D$=class{constructor(Q){this.dryRun=Q,this.paths=[],this.files=[],this.folders=[]}},N$=/^[a-z]+\s*/i,I$=/^[a-z]+\s+[a-z]+\s*/i,G$=/\/$/}}),OJ={};B0(OJ,{EMPTY_COMMANDS:()=>i9,adhocExecTask:()=>w$,configurationErrorTask:()=>y0,isBufferTask:()=>M$,isEmptyTask:()=>P$,straightThroughBufferTask:()=>L$,straightThroughStringTask:()=>S0});H0=b({"src/lib/tasks/task.ts"(){tZ(),i9=[]}}),A$={};B0(A$,{CONFIG_ERROR_INTERACTIVE_MODE:()=>mJ,CONFIG_ERROR_MODE_REQUIRED:()=>fJ,CONFIG_ERROR_UNKNOWN_OPTION:()=>cJ,CleanOptions:()=>b9,cleanTask:()=>O$,cleanWithOptionsTask:()=>UL,isCleanOptionsArray:()=>HL});C$=b({"src/lib/tasks/clean.ts"(){zL(),f(),H0(),mJ="Git clean interactive mode is not supported",fJ='Git clean mode parameter ("n" or "f") is required',cJ="Git clean unknown option found in: ",b9=((Q)=>{return Q.DRY_RUN="n",Q.FORCE="f",Q.IGNORED_INCLUDED="x",Q.IGNORED_ONLY="X",Q.EXCLUDING="e",Q.QUIET="q",Q.RECURSIVE="d",Q})(b9||{}),dJ=new Set(["i",...H8(Object.values(b9))])}});wL=b({"src/lib/responses/ConfigList.ts"(){f(),T$=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){if(!this._all)this._all=this.files.reduce((Q,J)=>{return Object.assign(Q,this.values[J])},{});return this._all}addFile(Q){if(!(Q in this.values)){let J=A6(this.files);this.values[Q]=J?Object.create(this.values[J]):{},this.files.push(Q)}return this.values[Q]}addValue(Q,J,W){let V=this.addFile(Q);if(!Object.hasOwn(V,J))V[J]=W;else if(Array.isArray(V[J]))V[J].push(W);else V[J]=[V[J],W];this._all=void 0}}}});S$=b({"src/lib/tasks/config.ts"(){wL(),f(),CJ=((Q)=>{return Q.system="system",Q.global="global",Q.local="local",Q.worktree="worktree",Q})(CJ||{})}});v$=b({"src/lib/tasks/diff-name-status.ts"(){BJ=((Q)=>{return Q.ADDED="A",Q.COPIED="C",Q.DELETED="D",Q.MODIFIED="M",Q.RENAMED="R",Q.CHANGED="T",Q.UNMERGED="U",Q.UNKNOWN="X",Q.BROKEN="B",Q})(BJ||{}),E$=new Set(Object.values(BJ))}});b$=b({"src/lib/tasks/grep.ts"(){f(),H0(),k$=["-h"],F5=Symbol("grepQuery"),x$=class{constructor(){this[wZ]=[]}*[(wZ=F5,Symbol.iterator)](){for(let Q of this[F5])yield Q}and(...Q){return Q.length&&this[F5].push("--and","(",...I5(Q,"-e"),")"),this}param(...Q){return this[F5].push(...I5(Q,"-e")),this}}}}),_$={};B0(_$,{ResetMode:()=>_9,getResetMode:()=>EL,resetTask:()=>SL});g$=b({"src/lib/tasks/reset.ts"(){f(),H0(),_9=((Q)=>{return Q.MIXED="mixed",Q.SOFT="soft",Q.HARD="hard",Q.MERGE="merge",Q.KEEP="keep",Q})(_9||{}),h$=H8(Object.values(_9))}});p$=b({"src/lib/git-logger.ts"(){f(),u9.default.formatters.L=(Q)=>String(o9(Q)?Q.length:"-"),u9.default.formatters.B=(Q)=>{if(Buffer.isBuffer(Q))return Q.toString("utf8");return M5(Q)}}}),xL=b({"src/lib/runners/tasks-pending-queue.ts"(){r1(),p$(),u$=class Q{constructor(J="GitExecutor"){this.logLabel=J,this._queue=new Map}withProgress(J){return this._queue.get(J)}createProgress(J){let W=Q.getName(J.commands[0]),V=lJ(this.logLabel,W);return{task:J,logger:V,name:W}}push(J){let W=this.createProgress(J);return W.logger("Adding task to the queue, commands = %o",J.commands),this._queue.set(J,W),W}fatal(J){for(let[W,{logger:V}]of Array.from(this._queue.entries())){if(W===J.task)V.info("Failed %o",J),V("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted");else V.info("A fatal exception occurred in a previous task, the queue has been purged: %o",J.message);this.complete(W)}if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(J){if(this.withProgress(J))this._queue.delete(J)}attempt(J){let W=this.withProgress(J);if(!W)throw new x1(void 0,"TasksPendingQueue: attempt called for an unknown task");return W.logger("Starting task"),W}static getName(J="empty"){return`task:${J}:${++Q.counter}`}static{this.counter=0}}}});yL=b({"src/lib/runners/git-executor-chain.ts"(){r1(),H0(),f(),xL(),RJ=class{constructor(Q,J,W){this._executor=Q,this._scheduler=J,this._plugins=W,this._chain=Promise.resolve(),this._queue=new u$}get cwd(){return this._cwd||this._executor.cwd}set cwd(Q){this._cwd=Q}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(Q){return this._queue.push(Q),this._chain=this._chain.then(()=>this.attemptTask(Q))}async attemptTask(Q){let J=await this._scheduler.next(),W=()=>this._queue.complete(Q);try{let{logger:V}=this._queue.attempt(Q);return await(P$(Q)?this.attemptEmptyTask(Q,V):this.attemptRemoteTask(Q,V))}catch(V){throw this.onFatalException(Q,V)}finally{W(),J()}}onFatalException(Q,J){let W=J instanceof x1?Object.assign(J,{task:Q}):new x1(Q,J&&String(J));return this._chain=Promise.resolve(),this._queue.fatal(W),W}async attemptRemoteTask(Q,J){let W=this._plugins.exec("spawn.binary","",P6(Q,Q.commands)),V=this._plugins.exec("spawn.args",[...Q.commands],P6(Q,Q.commands)),Y=await this.gitResponse(Q,W,V,this.outputHandler,J.step("SPAWN")),X=await this.handleTaskData(Q,V,Y,J.step("HANDLE"));if(J("passing response to task's parser as a %s",Q.format),M$(Q))return PJ(Q.parser,X);return PJ(Q.parser,X.asStrings())}async attemptEmptyTask(Q,J){return J("empty task bypassing child process to call to task's parser"),Q.parser(this)}handleTaskData(Q,J,W,V){let{exitCode:Y,rejection:X,stdOut:q,stdErr:K}=W;return new Promise((z,$)=>{V("Preparing to handle process response exitCode=%d stdOut=",Y);let{error:Z}=this._plugins.exec("task.error",{error:X},{...P6(Q,J),...W});if(Z&&Q.onError)return V.info("exitCode=%s handling with custom error handler"),Q.onError(W,Z,(U)=>{V.info("custom error handler treated as success"),V("custom error returned a %s",M5(U)),z(new p9(Array.isArray(U)?Buffer.concat(U):U,Buffer.concat(K)))},$);if(Z)return V.info("handling as error: exitCode=%s stdErr=%s rejection=%o",Y,K.length,X),$(Z);V.info("retrieving task output complete"),z(new p9(Buffer.concat(q),Buffer.concat(K)))})}async gitResponse(Q,J,W,V,Y){let X=Y.sibling("output"),q=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},P6(Q,Q.commands));return new Promise((K)=>{let z=[],$=[];Y.info("%s %o",J,W),Y("%O",q);let Z=this._beforeSpawn(Q,W);if(Z)return K({stdOut:z,stdErr:$,exitCode:9901,rejection:Z});this._plugins.exec("spawn.before",void 0,{...P6(Q,W),kill(H){Z=H||Z}});let U=bL(J,W,q);if(U.stdout.on("data",MZ(z,"stdOut",Y,X.step("stdOut"))),U.stderr.on("data",MZ($,"stdErr",Y,X.step("stdErr"))),U.on("error",_L($,Y)),V)Y("Passing child process stdOut/stdErr to custom outputHandler"),V(J,U.stdout,U.stderr,[...W]);this._plugins.exec("spawn.after",void 0,{...P6(Q,W),spawned:U,close(H,B){K({stdOut:z,stdErr:$,exitCode:H,rejection:Z||B})},kill(H){if(U.killed)return;Z=H,U.kill("SIGINT")}})})}_beforeSpawn(Q,J){let W;return this._plugins.exec("spawn.before",void 0,{...P6(Q,J),kill(V){W=V||W}}),W}}}}),m$={};B0(m$,{GitExecutor:()=>f$});hL=b({"src/lib/runners/git-executor.ts"(){yL(),f$=class{constructor(Q,J,W){this.cwd=Q,this._scheduler=J,this._plugins=W,this._chain=new RJ(this,this._scheduler,this._plugins)}chain(){return new RJ(this,this._scheduler,this._plugins)}push(Q){return this._chain.push(Q)}}}});uL=b({"src/lib/task-callback.ts"(){U8(),f()}});mL=b({"src/lib/tasks/change-working-directory.ts"(){f(),H0()}});cL=b({"src/lib/tasks/checkout.ts"(){f(),H0()}});nL=b({"src/lib/tasks/count-objects.ts"(){f(),c$=new c(/([a-z-]+): (\d+)$/,(Q,[J,W])=>{let V=X$(J);if(Object.hasOwn(Q,V))Q[V]=t(W)})}});aL=b({"src/lib/parsers/parse-commit.ts"(){f(),d$=[new c(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(Q,[J,W,V])=>{Q.branch=J,Q.commit=V,Q.root=!!W}),new c(/\s*Author:\s(.+)/i,(Q,[J])=>{let W=J.split("<"),V=W.pop();if(!V||!V.includes("@"))return;Q.author={email:V.substr(0,V.length-1),name:W.join("<").trim()}}),new c(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(Q,[J,W,V])=>{Q.summary.changes=parseInt(J,10)||0,Q.summary.insertions=parseInt(W,10)||0,Q.summary.deletions=parseInt(V,10)||0}),new c(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(Q,[J,W,V])=>{Q.summary.changes=parseInt(J,10)||0;let Y=parseInt(W,10)||0;if(V==="-")Q.summary.deletions=Y;else if(V==="+")Q.summary.insertions=Y})]}});rL=b({"src/lib/tasks/commit.ts"(){aL(),f(),H0()}});eL=b({"src/lib/tasks/first-commit.ts"(){f(),H0()}});JM=b({"src/lib/tasks/hash-object.ts"(){H0()}});VM=b({"src/lib/responses/InitSummary.ts"(){y9=class{constructor(Q,J,W,V){this.bare=Q,this.path=J,this.existing=W,this.gitDir=V}},l$=/^Init.+ repository in (.+)$/,n$=/^Rein.+ in (.+)$/}});qM=b({"src/lib/tasks/init.ts"(){VM(),nJ="--bare"}});A5=b({"src/lib/args/log-format.ts"(){aJ=/^--(stat|numstat|name-only|name-status)(=|$)/}}),ZM=b({"src/lib/responses/DiffSummary.ts"(){o$=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});s$=b({"src/lib/parsers/parse-diff-summary.ts"(){A5(),ZM(),v$(),f(),FJ=[new c(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(Q,[J,W,V=""])=>{Q.files.push({file:J.trim(),changes:t(W),insertions:V.replace(/[^+]/g,"").length,deletions:V.replace(/[^-]/g,"").length,binary:!1})}),new c(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(Q,[J,W,V])=>{Q.files.push({file:J.trim(),before:t(W),after:t(V),binary:!0})}),new c(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(Q,[J,W])=>{let V=/(\d+) i/.exec(W),Y=/(\d+) d/.exec(W);Q.changed=t(J),Q.insertions=t(V?.[1]),Q.deletions=t(Y?.[1])})],AZ=[new c(/(\d+)\t(\d+)\t(.+)$/,(Q,[J,W,V])=>{let Y=t(J),X=t(W);Q.changed++,Q.insertions+=Y,Q.deletions+=X,Q.files.push({file:V,changes:Y+X,insertions:Y,deletions:X,binary:!1})}),new c(/-\t-\t(.+)$/,(Q,[J])=>{Q.changed++,Q.files.push({file:J,after:0,before:0,binary:!0})})],OZ=[new c(/(.+)$/,(Q,[J])=>{Q.changed++,Q.files.push({file:J,changes:0,insertions:0,deletions:0,binary:!1})})],CZ=[new c(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(Q,[J,W,V,Y,X])=>{Q.changed++,Q.files.push({file:X??V,changes:0,insertions:0,deletions:0,binary:!1,status:wJ(OL(J)&&J),from:wJ(!!X&&V!==X&&V),similarity:t(W)})})],i$={[""]:FJ,["--stat"]:FJ,["--numstat"]:AZ,["--name-status"]:CZ,["--name-only"]:OZ}}});e$=b({"src/lib/parsers/parse-list-log-summary.ts"(){f(),s$(),A5(),iJ="òòòòòò ",sJ=" òò",rJ=" ò ",t$=["hash","date","message","refs","author_name","author_email"]}}),Qz={};B0(Qz,{diffSummaryTask:()=>zM,validateLogFormatConfig:()=>s9});tJ=b({"src/lib/tasks/diff.ts"(){A5(),s$(),H0()}});Wz=b({"src/lib/tasks/log.ts"(){A5(),z8(),e$(),f(),H0(),tJ(),TJ=((Q)=>{return Q[Q["--pretty"]=0]="--pretty",Q[Q["max-count"]=1]="max-count",Q[Q.maxCount=2]="maxCount",Q[Q.n=3]="n",Q[Q.file=4]="file",Q[Q.format=5]="format",Q[Q.from=6]="from",Q[Q.to=7]="to",Q[Q.splitter=8]="splitter",Q[Q.symmetric=9]="symmetric",Q[Q.mailMap=10]="mailMap",Q[Q.multiLine=11]="multiLine",Q[Q.strictDate=12]="strictDate",Q})(TJ||{})}}),FM=b({"src/lib/responses/MergeSummary.ts"(){h9=class{constructor(Q,J=null,W){this.reason=Q,this.file=J,this.meta=W}toString(){return`${this.file}:${this.reason}`}},Vz=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){if(this.conflicts.length)return`CONFLICTS: ${this.conflicts.join(", ")}`;return"OK"}}}}),DM=b({"src/lib/responses/PullSummary.ts"(){SJ=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Yz=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});NM=b({"src/lib/parsers/parse-remote-objects.ts"(){f(),Xz=[new s1(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(Q,[J,W])=>{let V=J.toLowerCase(),Y=DJ(Q.remoteMessages);Object.assign(Y,{[V]:t(W)})}),new s1(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(Q,[J,W])=>{let V=J.toLowerCase(),Y=DJ(Q.remoteMessages);Object.assign(Y,{[V]:t(W)})}),new s1(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(Q,[J,W,V])=>{let Y=DJ(Q.remoteMessages);Y.total=RZ(J),Y.reused=RZ(W),Y.packReused=t(V)})]}});$z=b({"src/lib/parsers/parse-remote-messages.ts"(){f(),NM(),Kz=[new s1(/^remote:\s*(.+)$/,(Q,[J])=>{return Q.remoteMessages.all.push(J.trim()),!1}),...Xz,new s1([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(Q,[J])=>{Q.remoteMessages.pullRequestUrl=J}),new s1([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(Q,[J,W,V])=>{Q.remoteMessages.vulnerabilities={count:t(J),summary:W,url:V}})],Zz=class{constructor(){this.all=[]}}}});Uz=b({"src/lib/parsers/parse-pull.ts"(){DM(),f(),$z(),TZ=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,SZ=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,EZ=/^(create|delete) mode \d+ (.+)/,vZ=[new c(TZ,(Q,[J,W,V])=>{if(Q.files.push(J),W)Q.insertions[J]=W.length;if(V)Q.deletions[J]=V.length}),new c(SZ,(Q,[J,,W,,V])=>{if(W!==void 0||V!==void 0)return Q.summary.changes=+J||0,Q.summary.insertions=+W||0,Q.summary.deletions=+V||0,!0;return!1}),new c(EZ,(Q,[J,W])=>{Q1(Q.files,W),Q1(J==="create"?Q.created:Q.deleted,W)})],zz=[new c(/^from\s(.+)$/i,(Q,[J])=>void(Q.remote=J)),new c(/^fatal:\s(.+)$/,(Q,[J])=>void(Q.message=J)),new c(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(Q,[J,W,V,Y])=>{Q.branch.local=V,Q.hash.local=J,Q.branch.remote=Y,Q.hash.remote=W})],kZ=(Q,J)=>{return h0(new SJ,vZ,[Q,J])},eJ=(Q,J)=>{return Object.assign(new SJ,kZ(Q,J),qz(Q,J))}}}),GM=b({"src/lib/parsers/parse-merge.ts"(){FM(),f(),Uz(),xZ=[new c(/^Auto-merging\s+(.+)$/,(Q,[J])=>{Q.merges.push(J)}),new c(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(Q,[J,W])=>{Q.conflicts.push(new h9(J,W))}),new c(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(Q,[J,W,V])=>{Q.conflicts.push(new h9(J,W,{deleteRef:V}))}),new c(/^CONFLICT\s+\((.+)\):/,(Q,[J])=>{Q.conflicts.push(new h9(J,null))}),new c(/^Automatic merge failed;\s+(.+)$/,(Q,[J])=>{Q.result=J})],Hz=(Q,J)=>{return Object.assign(bZ(Q,J),eJ(Q,J))},bZ=(Q)=>{return h0(new Vz,xZ,Q)}}});wM=b({"src/lib/tasks/merge.ts"(){U8(),GM(),H0()}});MM=b({"src/lib/parsers/parse-push.ts"(){f(),$z(),yZ=[new c(/^Pushing to (.+)$/,(Q,[J])=>{Q.repo=J}),new c(/^updating local tracking ref '(.+)'/,(Q,[J])=>{Q.ref={...Q.ref||{},local:J}}),new c(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(Q,[J,W,V])=>{Q.pushed.push(LM(J,W,V))}),new c(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(Q,[J,W,V])=>{Q.branch={...Q.branch||{},local:J,remote:W,remoteName:V}}),new c(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(Q,[J,W,V,Y])=>{Q.update={head:{local:J,remote:W},hash:{from:V,to:Y}}})],Bz=(Q,J)=>{let W=hZ(Q,J),V=qz(Q,J);return{...W,...V}},hZ=(Q,J)=>{return h0({pushed:[]},yZ,[Q,J])}}}),jz={};B0(jz,{pushTagsTask:()=>PM,pushTask:()=>QW});Fz=b({"src/lib/tasks/push.ts"(){MM(),f()}});OM=b({"src/lib/tasks/show.ts"(){f(),H0()}}),CM=b({"src/lib/responses/FileStatusSummary.ts"(){gZ=/^(.+)\0(.+)$/,Dz=class{constructor(Q,J,W){if(this.path=Q,this.index=J,this.working_dir=W,J==="R"||W==="R"){let V=gZ.exec(Q)||[null,Q,Q];this.from=V[2]||"",this.path=V[1]||""}}}}});TM=b({"src/lib/responses/StatusSummary.ts"(){f(),CM(),uZ=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>{return!this.files.length}}},Nz=new Map([n0(" ","A",(Q,J)=>Q.created.push(J)),n0(" ","D",(Q,J)=>Q.deleted.push(J)),n0(" ","M",(Q,J)=>Q.modified.push(J)),n0("A"," ",(Q,J)=>{Q.created.push(J),Q.staged.push(J)}),n0("A","M",(Q,J)=>{Q.created.push(J),Q.staged.push(J),Q.modified.push(J)}),n0("D"," ",(Q,J)=>{Q.deleted.push(J),Q.staged.push(J)}),n0("M"," ",(Q,J)=>{Q.modified.push(J),Q.staged.push(J)}),n0("M","M",(Q,J)=>{Q.modified.push(J),Q.staged.push(J)}),n0("R"," ",(Q,J)=>{Q.renamed.push(pZ(J))}),n0("R","M",(Q,J)=>{let W=pZ(J);Q.renamed.push(W),Q.modified.push(W.to)}),n0("!","!",(Q,J)=>{(Q.ignored=Q.ignored||[]).push(J)}),n0("?","?",(Q,J)=>Q.not_added.push(J)),...NJ("A","A","U"),...NJ("D","D","U"),...NJ("U","A","D","U"),["##",(Q,J)=>{let W=/ahead (\d+)/,V=/behind (\d+)/,Y=/^(.+?(?=(?:\.{3}|\s|$)))/,X=/\.{3}(\S*)/,q=/\son\s(\S+?)(?=\.{3}|$)/,K=W.exec(J);if(Q.ahead=K&&+K[1]||0,K=V.exec(J),Q.behind=K&&+K[1]||0,K=Y.exec(J),Q.current=L0(K?.[1],q0,null),K=X.exec(J),Q.tracking=L0(K?.[1],q0,null),K=q.exec(J),K)Q.current=L0(K?.[1],q0,Q.current);Q.detached=/\(no branch\)/.test(J)}]]),Iz=function(Q){let J=Q.split($8),W=new uZ;for(let V=0,Y=J.length;V<Y;){let X=J[V++].trim();if(!X)continue;if(X.charAt(0)==="R")X+=$8+(J[V++]||"");RM(W,X)}return W}}});EM=b({"src/lib/tasks/status.ts"(){TM(),Gz=["--null","-z"]}});bM=b({"src/lib/tasks/version.ts"(){f(),JW="installed=false",wz=[new c(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(Q,[J,W,V,Y=""])=>{Object.assign(Q,m9(t(J),t(W),t(V),Y))}),new c(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(Q,[J,W,V,Y=""])=>{Object.assign(Q,m9(t(J),t(W),V,Y))})]}});yM=b({"src/lib/tasks/clone.ts"(){H0(),f(),z8(),EJ=(Q,J,W)=>{let V=["clone",...W];return q0(Q)&&V.push(IJ(Q)),q0(J)&&V.push(IJ(J)),S0(V)},Lz=(Q,J,W)=>{return Q1(W,"--mirror"),EJ(Q,J,W)}}}),Mz={};B0(Mz,{SimpleGitApi:()=>vJ});hM=b({"src/lib/simple-git-api.ts"(){uL(),mL(),cL(),nL(),rL(),S$(),eL(),b$(),JM(),qM(),Wz(),wM(),Fz(),OM(),EM(),H0(),bM(),f(),yM(),vJ=class{constructor(Q){this._executor=Q}_runTask(Q,J){let W=this._executor.chain(),V=W.push(Q);if(J)gL(Q,V,J);return Object.create(this,{then:{value:V.then.bind(V)},catch:{value:V.catch.bind(V)},_executor:{value:W}})}add(Q){return this._runTask(S0(["add",...M1(Q)]),Y0(arguments))}cwd(Q){let J=Y0(arguments);if(typeof Q==="string")return this._runTask(PZ(Q,this._executor),J);if(typeof Q?.path==="string")return this._runTask(PZ(Q.path,Q.root&&this._executor||void 0),J);return this._runTask(y0("Git.cwd: workingDirectory must be supplied as a string"),J)}hashObject(Q,J){return this._runTask(QM(Q,J===!0),Y0(arguments))}init(Q){return this._runTask(XM(Q===!0,this._executor.cwd,T0(arguments)),Y0(arguments))}merge(){return this._runTask(_Z(T0(arguments)),Y0(arguments))}mergeFromTo(Q,J){if(!(q0(Q)&&q0(J)))return this._runTask(y0("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"));return this._runTask(_Z([Q,J,...T0(arguments)]),Y0(arguments,!1))}outputHandler(Q){return this._executor.outputHandler=Q,this}push(){let Q=QW({remote:L0(arguments[0],q0),branch:L0(arguments[1],q0)},T0(arguments));return this._runTask(Q,Y0(arguments))}stash(){return this._runTask(S0(["stash",...T0(arguments)]),Y0(arguments))}status(){return this._runTask(SM(T0(arguments)),Y0(arguments))}},Object.assign(vJ.prototype,fL(),_M(),sL(),AL(),lL(),tL(),TL(),jM(),AM(),kM())}}),Pz={};B0(Pz,{Scheduler:()=>Oz});gM=b({"src/lib/runners/scheduler.ts"(){f(),p$(),fZ=(()=>{let Q=0;return()=>{Q++;let{promise:J,done:W}=Az.createDeferred();return{promise:J,done:W,id:Q}}})(),Oz=class{constructor(Q=2){this.concurrency=Q,this.logger=lJ("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",Q)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let Q=Q1(this.running,this.pending.shift());this.logger("Attempting id=%s",Q.id),Q.done(()=>{this.logger("Completing id=",Q.id),d9(this.running,Q),this.schedule()})}next(){let{promise:Q,id:J}=Q1(this.pending,fZ());return this.logger("Scheduling id=%s",J),this.schedule(),Q}}}}),Cz={};B0(Cz,{applyPatchTask:()=>pM});uM=b({"src/lib/tasks/apply-patch.ts"(){H0()}});cM=b({"src/lib/responses/BranchDeleteSummary.ts"(){Rz=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});dM=b({"src/lib/parsers/parse-branch-delete.ts"(){cM(),f(),cZ=/(\S+)\s+\(\S+\s([^)]+)\)/,kJ=/^error[^']+'([^']+)'/m,dZ=[new c(cZ,(Q,[J,W])=>{let V=mM(J,W);Q.all.push(V),Q.branches[J]=V}),new c(kJ,(Q,[J])=>{let W=fM(J);Q.errors.push(W),Q.all.push(W),Q.branches[J]=W})],r9=(Q,J)=>{return h0(new Rz,dZ,[Q,J])}}}),lM=b({"src/lib/responses/BranchSummary.ts"(){Sz=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(Q,J,W,V,Y){if(Q==="*")this.detached=J,this.current=W;this.all.push(W),this.branches[W]={current:Q==="*",linkedWorkTree:Q==="+",name:W,commit:V,label:Y}}}}});nM=b({"src/lib/parsers/parse-branch.ts"(){lM(),f(),vz=[new c(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(Q,[J,W,V,Y])=>{Q.push(lZ(J),!0,W,V,Y)}),new c(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(Q,[J,W,V,Y])=>{Q.push(lZ(J),!1,W,V,Y)})],kz=new c(/^(\S+)$/s,(Q,[J])=>{Q.push("*",!1,J,"","")})}}),xz={};B0(xz,{branchLocalTask:()=>aM,branchTask:()=>oM,containsDeleteBranchCommand:()=>bz,deleteBranchTask:()=>sM,deleteBranchesTask:()=>iM});rM=b({"src/lib/tasks/branch.ts"(){U8(),dM(),nM(),f()}});QP=b({"src/lib/responses/CheckIgnore.ts"(){_z=(Q)=>{return Q.split(/\n/g).map(eM).filter(Boolean)}}}),yz={};B0(yz,{checkIgnoreTask:()=>JP});WP=b({"src/lib/tasks/check-ignore.ts"(){QP()}});YP=b({"src/lib/parsers/parse-fetch.ts"(){f(),hz=[new c(/From (.+)$/,(Q,[J])=>{Q.remote=J}),new c(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(Q,[J,W])=>{Q.branches.push({name:J,tracking:W})}),new c(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(Q,[J,W])=>{Q.tags.push({name:J,tracking:W})}),new c(/- \[deleted]\s+\S+\s*-> (.+)$/,(Q,[J])=>{Q.deleted.push({tracking:J})}),new c(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(Q,[J,W,V,Y])=>{Q.updated.push({name:V,tracking:Y,to:W,from:J})})]}}),gz={};B0(gz,{fetchTask:()=>qP});KP=b({"src/lib/tasks/fetch.ts"(){YP(),H0()}});$P=b({"src/lib/parsers/parse-move.ts"(){f(),pz=[new c(/^Renaming (.+) to (.+)$/,(Q,[J,W])=>{Q.moves.push({from:J,to:W})})]}}),uz={};B0(uz,{moveTask:()=>zP});UP=b({"src/lib/tasks/move.ts"(){$P(),f()}}),mz={};B0(mz,{pullTask:()=>HP});BP=b({"src/lib/tasks/pull.ts"(){U8(),Uz(),f()}});DP=b({"src/lib/responses/GetRemoteSummary.ts"(){f()}}),cz={};B0(cz,{addRemoteTask:()=>NP,getRemotesTask:()=>IP,listRemotesTask:()=>GP,remoteTask:()=>wP,removeRemoteTask:()=>LP});MP=b({"src/lib/tasks/remote.ts"(){DP(),H0()}}),dz={};B0(dz,{stashListTask:()=>PP});AP=b({"src/lib/tasks/stash-list.ts"(){A5(),e$(),tJ(),Wz()}}),lz={};B0(lz,{addSubModuleTask:()=>OP,initSubModuleTask:()=>CP,subModuleTask:()=>t9,updateSubModuleTask:()=>RP});TP=b({"src/lib/tasks/sub-module.ts"(){H0()}});vP=b({"src/lib/responses/TagList.ts"(){nZ=class{constructor(Q,J){this.all=Q,this.latest=J}},oz=function(Q,J=!1){let W=Q.split(`
|
|
129
|
+
`).map(EP).filter(Boolean);if(!J)W.sort(function(Y,X){let q=Y.split("."),K=X.split(".");if(q.length===1||K.length===1)return SP(x9(q[0]),x9(K[0]));for(let z=0,$=Math.max(q.length,K.length);z<$;z++){let Z=nz(x9(q[z]),x9(K[z]));if(Z)return Z}return 0});let V=J?W[0]:[...W].reverse().find((Y)=>Y.indexOf(".")>=0);return new nZ(W,V)}}}),az={};B0(az,{addAnnotatedTagTask:()=>bP,addTagTask:()=>xP,tagListTask:()=>kP});_P=b({"src/lib/tasks/tag.ts"(){vP()}}),yP=sw({"src/git.js"(Q,J){var{GitExecutor:W}=(hL(),U0(m$)),{SimpleGitApi:V}=(hM(),U0(Mz)),{Scheduler:Y}=(gM(),U0(Pz)),{adhocExecTask:X,configurationErrorTask:q}=(H0(),U0(OJ)),{asArray:K,filterArray:z,filterPrimitives:$,filterString:Z,filterStringOrStringArray:U,filterType:H,getTrailingOptions:B,trailingFunctionArgument:j,trailingOptionsArgument:F}=(f(),U0(U$)),{applyPatchTask:I}=(uM(),U0(Cz)),{branchTask:L,branchLocalTask:N,deleteBranchesTask:O,deleteBranchTask:A}=(rM(),U0(xz)),{checkIgnoreTask:P}=(WP(),U0(yz)),{checkIsRepoTask:T}=(F$(),U0(H$)),{cleanWithOptionsTask:D,isCleanOptionsArray:M}=(C$(),U0(A$)),{diffSummaryTask:G}=(tJ(),U0(Qz)),{fetchTask:R}=(KP(),U0(gz)),{moveTask:C}=(UP(),U0(uz)),{pullTask:x}=(BP(),U0(mz)),{pushTagsTask:g}=(Fz(),U0(jz)),{addRemoteTask:m,getRemotesTask:s,listRemotesTask:o0,remoteTask:v0,removeRemoteTask:g0}=(MP(),U0(cz)),{getResetMode:B8,resetTask:j8}=(g$(),U0(_$)),{stashListTask:M0}=(AP(),U0(dz)),{addSubModuleTask:e,initSubModuleTask:a0,subModuleTask:F0,updateSubModuleTask:t1}=(TP(),U0(lz)),{addAnnotatedTagTask:A1,addTagTask:K0,tagListTask:Q7}=(_P(),U0(az)),{straightThroughBufferTask:C6,straightThroughStringTask:p0}=(H0(),U0(OJ));function p(E,_){this._plugins=_,this._executor=new W(E.baseDir,new Y(E.maxConcurrentProcesses),_),this._trimmed=E.trimmed}(p.prototype=Object.create(V.prototype)).constructor=p,p.prototype.customBinary=function(E){return this._plugins.reconfigure("binary",E),this},p.prototype.env=function(E,_){if(arguments.length===1&&typeof E==="object")this._executor.env=E;else(this._executor.env=this._executor.env||{})[E]=_;return this},p.prototype.stashList=function(E){return this._runTask(M0(F(arguments)||{},z(E)&&E||[]),j(arguments))},p.prototype.mv=function(E,_){return this._runTask(C(E,_),j(arguments))},p.prototype.checkoutLatestTag=function(E){var _=this;return this.pull(function(){_.tags(function(l,J0){_.checkout(J0.latest,E)})})},p.prototype.pull=function(E,_,l,J0){return this._runTask(x(H(E,Z),H(_,Z),B(arguments)),j(arguments))},p.prototype.fetch=function(E,_){return this._runTask(R(H(E,Z),H(_,Z),B(arguments)),j(arguments))},p.prototype.silent=function(E){return this._runTask(X(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},p.prototype.tags=function(E,_){return this._runTask(Q7(B(arguments)),j(arguments))},p.prototype.rebase=function(){return this._runTask(p0(["rebase",...B(arguments)]),j(arguments))},p.prototype.reset=function(E){return this._runTask(j8(B8(E),B(arguments)),j(arguments))},p.prototype.revert=function(E){let _=j(arguments);if(typeof E!=="string")return this._runTask(q("Commit must be a string"),_);return this._runTask(p0(["revert",...B(arguments,0,!0),E]),_)},p.prototype.addTag=function(E){let _=typeof E==="string"?K0(E):q("Git.addTag requires a tag name");return this._runTask(_,j(arguments))},p.prototype.addAnnotatedTag=function(E,_){return this._runTask(A1(E,_),j(arguments))},p.prototype.deleteLocalBranch=function(E,_,l){return this._runTask(A(E,typeof _==="boolean"?_:!1),j(arguments))},p.prototype.deleteLocalBranches=function(E,_,l){return this._runTask(O(E,typeof _==="boolean"?_:!1),j(arguments))},p.prototype.branch=function(E,_){return this._runTask(L(B(arguments)),j(arguments))},p.prototype.branchLocal=function(E){return this._runTask(N(),j(arguments))},p.prototype.raw=function(E){let _=!Array.isArray(E),l=[].slice.call(_?arguments:E,0);for(let P0=0;P0<l.length&&_;P0++)if(!$(l[P0])){l.splice(P0,l.length-P0);break}l.push(...B(arguments,0,!0));var J0=j(arguments);if(!l.length)return this._runTask(q("Raw: must supply one or more command to execute"),J0);return this._runTask(p0(l,this._trimmed),J0)},p.prototype.submoduleAdd=function(E,_,l){return this._runTask(e(E,_),j(arguments))},p.prototype.submoduleUpdate=function(E,_){return this._runTask(t1(B(arguments,!0)),j(arguments))},p.prototype.submoduleInit=function(E,_){return this._runTask(a0(B(arguments,!0)),j(arguments))},p.prototype.subModule=function(E,_){return this._runTask(F0(B(arguments)),j(arguments))},p.prototype.listRemote=function(){return this._runTask(o0(B(arguments)),j(arguments))},p.prototype.addRemote=function(E,_,l){return this._runTask(m(E,_,B(arguments)),j(arguments))},p.prototype.removeRemote=function(E,_){return this._runTask(g0(E),j(arguments))},p.prototype.getRemotes=function(E,_){return this._runTask(s(E===!0),j(arguments))},p.prototype.remote=function(E,_){return this._runTask(v0(B(arguments)),j(arguments))},p.prototype.tag=function(E,_){let l=B(arguments);if(l[0]!=="tag")l.unshift("tag");return this._runTask(p0(l),j(arguments))},p.prototype.updateServerInfo=function(E){return this._runTask(p0(["update-server-info"]),j(arguments))},p.prototype.pushTags=function(E,_){let l=g({remote:H(E,Z)},B(arguments));return this._runTask(l,j(arguments))},p.prototype.rm=function(E){return this._runTask(p0(["rm","-f",...K(E)]),j(arguments))},p.prototype.rmKeepLocal=function(E){return this._runTask(p0(["rm","--cached",...K(E)]),j(arguments))},p.prototype.catFile=function(E,_){return this._catFile("utf-8",arguments)},p.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},p.prototype._catFile=function(E,_){var l=j(_),J0=["cat-file"],P0=_[0];if(typeof P0==="string")return this._runTask(q("Git.catFile: options must be supplied as an array of strings"),l);if(Array.isArray(P0))J0.push.apply(J0,P0);let O1=E==="buffer"?C6(J0):p0(J0);return this._runTask(O1,l)},p.prototype.diff=function(E,_){let l=Z(E)?q("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):p0(["diff",...B(arguments)]);return this._runTask(l,j(arguments))},p.prototype.diffSummary=function(){return this._runTask(G(B(arguments,1)),j(arguments))},p.prototype.applyPatch=function(E){let _=!U(E)?q("git.applyPatch requires one or more string patches as the first argument"):I(K(E),B([].slice.call(arguments,1)));return this._runTask(_,j(arguments))},p.prototype.revparse=function(){let E=["rev-parse",...B(arguments,!0)];return this._runTask(p0(E,!0),j(arguments))},p.prototype.clean=function(E,_,l){let J0=M(E),P0=J0&&E.join("")||H(E,Z)||"",O1=B([].slice.call(arguments,J0?1:0));return this._runTask(D(P0,O1),j(arguments))},p.prototype.exec=function(E){let _={commands:[],format:"utf-8",parser(){if(typeof E==="function")E()}};return this._runTask(_)},p.prototype.clearQueue=function(){return this._runTask(X(()=>console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},p.prototype.checkIgnore=function(E,_){return this._runTask(P(K(H(E,U,[]))),j(arguments))},p.prototype.checkIsRepo=function(E,_){return this._runTask(T(H(E,Z)),j(arguments))},J.exports=p}});z8();r1();hP=class extends x1{constructor(Q,J){super(void 0,J);this.config=Q}};r1();r1();k1=class extends x1{constructor(Q,J,W){super(Q,W);this.task=Q,this.plugin=J,Object.setPrototypeOf(this,new.target.prototype)}};U8();tZ();F$();C$();S$();v$();b$();g$();mP=[D5(/^\s*protocol(.[a-z]+)?.allow/i,"allowUnsafeProtocolOverride","protocol.allow"),D5("core.sshCommand","allowUnsafeSshCommand"),D5("core.gitProxy","allowUnsafeGitProxy"),D5("core.hooksPath","allowUnsafeHooksPath"),D5("diff.external","allowUnsafeDiffExternal")];f();f();oZ=Z8.deferred().promise;f();r1();f();f();f();z8();f();XA=yP();U8();iz=qA});import*as P1 from"node:fs";import*as e9 from"node:path";import ZA from"node:os";class WW{log;tempDir;g;constructor(Q){this.log=Q?.withPrefix("GitOrLocalFs"),this.tempDir=P1.mkdtempSync(e9.join(ZA.tmpdir(),"fs-client-")),this.g=(J)=>iz(J).env({...process.env}),process.on("exit",()=>{P1.rmdirSync(this.tempDir,{recursive:!0})})}isGitUri(Q){return Q.scheme==="git"||Q.scheme.startsWith("git+")||Q.scheme.startsWith("http")&&Q.toString().includes(".git")}parseGitUri(Q){let J=Q.toString(),W=J.indexOf(".git");if(W!==-1){let V=J.substring(0,W+4);if(V.startsWith("git+"))V=V.substring(4);else if(V.startsWith("git://"))V="https://"+V.substring(6);let Y=J.substring(W+4),X=e9.join(this.tempDir,Buffer.from(V).toString("hex"));return{repoUrl:V,repoDir:X,filePath:e9.join(X,Y)}}throw Error(`Invalid git URI format: ${J}`)}async ensureRepoUpdated(Q,J){if(this.log?.info(`Checking repo status at ${Q}`),!P1.existsSync(Q))this.log?.info(`${J} is not available - cloning`),await P1.promises.mkdir(Q),await this.g(Q).clone(J,Q,["--single-branch","--depth","1"]);else this.log?.info(`refreshing ${J}`),await this.g(Q).pull()}async readFile(Q){if(this.isGitUri(Q)){let{repoUrl:J,repoDir:W,filePath:V}=this.parseGitUri(Q);return await this.ensureRepoUpdated(W,J),this.log?.info(`Reading from up-to-date repo path "${V}"`),P1.promises.readFile(V,"utf-8")}else return P1.promises.readFile(Q.fsPath,"utf-8")}async write(Q,J){if(this.isGitUri(Q)){let{repoUrl:W,repoDir:V,filePath:Y}=this.parseGitUri(Q);await this.ensureRepoUpdated(V,W),this.log?.info(`Writing file to commit at "${Y}"`);let X=await Bun.write(Y,J);return this.log?.info(`Adding and committing "${Y}"`),await this.g(V).add([Y]),await this.g(V).commit(`Update ${Y.substring(Y.lastIndexOf("/")+1)}`,Y),this.log?.info(`Pushing "${W}"`),await this.g(V).push(),this.log?.info("Completed push"),X}else return Bun.write(Q.fsPath,J)}}var rz=$1(()=>{sz()});var VU={};C5(VU,{default:()=>DA,Register:()=>JU,Description:()=>QU,Action:()=>WU});import{createKumoriServices as $A}from"@kumori/kdsl-lsp/language/kumori.js";import{NodeFileSystem as zA}from"langium/node";import{ModuleContext as UA}from"@kumori/kdsl-lsp/module/context.js";import{URI as O5}from"langium";import E0 from"path";import{Result as tz}from"@kumori/kdsl-lsp/util/result.js";import{RegistryManager as HA}from"@kumori/kdsl-lsp/module/registry/manager.js";import{CalculateChecksum as BA}from"@kumori/kdsl-lsp/module/integrity/checksum.js";import jA from"fs";function JU(Q,J){return Q.command("create").option("--module <module>","Path to the module to generate the index entry for. It can be either a relative or absolute path. Defaults to the current directory.").option("--meta <meta>","Path to the metadata file (_index.json). It can be either a relative or absolute path. Defaults to _index.json in the module's root directory.").option("--index <index>","Path to the index file to append the new entry to. It can be either a relative or absolute path. If not provided, the entry will be printed to standard output.").option("--locationOverride <location>","Path to the module's source when included in the index file. Defaults to the module's git remote URL").summary(FA).description(QU).helpOption(!0).showHelpAfterError(!0).action(WU(J))}function WU(Q){return async(J,W)=>{let V=W?.optsWithGlobals()?.config,Y=$A(zA,V).Kumori,X=Y.shared.workspace.FileSystemProvider,q=process.cwd();if(J.module){if(J.module[0]==="."||E0.isAbsolute(J.module))q=E0.isAbsolute(J.module)?J.module:E0.resolve(process.cwd(),J.module)}let K=await UA(X,O5.file(q),V);if(tz.isErr(K))throw Error(K.err);await T6(Q,Y,K.value);let z=E0.join(q,"_index.json");if(J.meta)if(J.meta[0]==="."||E0.isAbsolute(J.meta))z=E0.isAbsolute(J.meta)?J.meta:E0.resolve(process.cwd(),J.meta);else z=E0.resolve(process.cwd(),J.meta);Q.info(`Loading metadata from ${z}`);let $;try{let N=await X.readFile(O5.file(z));if($=JSON.parse(N),$.location!=null)Q.warn("Explicit locations in '_index.json' are deprecated. use the argument '--locationOverride' to manually set");$.location=J.locationOverride||await ez.default.getConfig({fs:jA,dir:q,path:"remote.origin.url"})||$.location}catch(N){throw Error(`Failed to read or parse metadata file at ${z}: ${N}`)}if(!$.location)throw Error("Module must be configured as a git repository with a remote URL present or have it specified with '--locationOverride'");if(!$.artifacts||!Array.isArray($.artifacts))throw Error(`Metadata file at ${z} must contain an "artifacts" array`);for(let N of $.artifacts)if(!N?.type||!N?.name||!N?.location)throw Error(`Each artifact in ${z} must contain "type", "name" and "location" fields`);let Z=null,U=new WW(Q);if(J.index)if(U.isGitUri(O5.parse(J.index)))Z=O5.parse(J.index+"/index.json");else{if(J.index[0]==="."||E0.isAbsolute(J.index))Z=E0.isAbsolute(J.index)?J.index:E0.resolve(process.cwd(),J.index);else Z=E0.resolve(process.cwd(),J.index);Z=O5.parse(Z)}let H=null;if(Z)try{let N=null;try{N=await U.readFile(Z)}catch{N=""}if(N===null||N===""){H={modules:[]},Q.info(`Index file at ${Z} is either missing or empty. A new one will be created.`);try{await U.write(Z,JSON.stringify(H,null,2)),Q.info(`Created new index file at ${Z}`)}catch(P){Q.error(`Failed to create new index file at ${Z}: ${P}`);return}}try{N=await U.readFile(Z),H=await JSON.parse(N)}catch(P){throw Error(`Failed to parse index file at ${Z}: ${P}`)}if(!new HA(W?.optsWithGlobals()?.config).validateIndexSchema(H))throw Error(`Index schema validation failed for ${Z}`)}catch(N){Q.error(`Failed to read index file at ${Z}: ${N}`);return}let B=void 0;if(H?.modules)B=H.modules.find((N)=>N.domain===K.value.Current.Manifest.module&&N.version===K.value.Current.Manifest.version);if(B)Q.warn(`Module ${B.domain} version ${B.version} already exists in the index file at ${Z}. Proceeding will override the current entry.`),Q.warn("Overriding existing entry without prompting.");let j=K.value.Current.Manifest,F=await BA(q),I=new Date().toISOString().split("T")[0],L={domain:j.module,version:j.version,location:$.location,checksum:F,releaseDate:I,artifacts:[]};for(let N of $.artifacts){Q.info(`Processing artifact ${N.name} (${N.type})`);let O=await v5(Y,K.value,N.location,N.name);if(tz.isErr(O))throw Error(`Failed to generate JSON Schema for artifact ${N.name} in package ${N.location}: ${O.err}`);let A=eW(Y,K.value,N),P=A?tW(Y,A):[],T=N.location,D,M;if(N.type==="component"){let s=F7(Y,K.value,N.name,N.location);if(s)D=s.cpu,M=s.memory}else if(N.type==="service"){let s=D7(Y,K.value,N.name,N.location);if(s)D=s.cpu,M=s.memory}let G=D??1,R=M??1,C=$.defaults||{},x=N.marketplace??C.marketplace??!0,g=N.categories??C.categories??[],m=N.tags??C.tags??[];L.artifacts.push({name:N.name,description:N.description||"",requirements:{cpu:G,memory:R},location:T,type:N.type,roles:P,marketplace:x,schema:O.value,icon:N.icon||"",categories:g,tags:m})}if(Z&&H)if(!B){H.modules.push(L);let N=JSON.stringify(H,null,2);await U.write(Z,N),Q.info(`Appended new module entry to index file at ${Z}`)}else{H.modules=H.modules.map((O)=>{if(O.domain===B.domain&&O.version===B.version)return L;return O});let N=JSON.stringify(H,null,2);await U.write(Z,N),Q.info(`Updated module entry in index file at ${Z}`)}else console.log(JSON.stringify({modules:[L]},null,2))}}var ez,FA="Creates an index file",QU,DA;var YU=$1(()=>{iW();$7();JV();rz();ez=F8(QZ(),1),QU=`
|
|
130
|
+
Creates a new index file entry for the current module using metadata from _index.json.
|
|
131
|
+
|
|
132
|
+
The metadata file (_index.json) should be located in the module's root directory and contains
|
|
133
|
+
pre-filled information about the module and its artifacts, including descriptions, requirements,
|
|
134
|
+
marketplace settings, and more.
|
|
135
|
+
|
|
136
|
+
This command will generate the entry for the current module:
|
|
137
|
+
kdsl index create
|
|
138
|
+
|
|
139
|
+
Or you can provide a module location to generate the entry for:
|
|
140
|
+
kdsl index create --module path/to/module
|
|
141
|
+
|
|
142
|
+
You can specify a custom metadata file location:
|
|
143
|
+
kdsl index create --meta path/to/custom/_index.json
|
|
144
|
+
|
|
145
|
+
The generated index entry will be printed to the standard output. However, you can directly add
|
|
146
|
+
the new entry onto an existing index file by providing the --index option:
|
|
147
|
+
kdsl index create --index path/to/index/file.json
|
|
148
|
+
|
|
149
|
+
If the index file is empty, a new index file will be created with just the new entry. Otherwise,
|
|
150
|
+
if the index file already contains entries, the new entry will be appended to the existing ones.
|
|
151
|
+
`.trim(),DA={Register:JU}});var d=function(Q){return Q.info="info",Q.warn="warn",Q.error="error",Q.debug="debug",Q.trace="trace",Q.fatal="fatal",Q}({}),R5={[d.trace]:10,[d.debug]:20,[d.info]:30,[d.warn]:40,[d.error]:50,[d.fatal]:60},BU={10:d.trace,20:d.debug,30:d.info,40:d.warn,50:d.error,60:d.fatal};var w0=function(Q){return Q.transformLogLevel="transformLogLevel",Q.onBeforeDataOut="onBeforeDataOut",Q.shouldSendToLogger="shouldSendToLogger",Q.onMetadataCalled="onMetadataCalled",Q.onBeforeMessageOut="onBeforeMessageOut",Q.onContextCalled="onContextCalled",Q}({});var XW=class Q{context={};hasContext=!1;setContext(J){if(!J){this.context={},this.hasContext=!1;return}this.context=J,this.hasContext=!0}appendContext(J){this.context={...this.context,...J},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(J){if(J===void 0){this.context={},this.hasContext=!1;return}let W=Array.isArray(J)?J:[J];for(let V of W)delete this.context[V];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:J,childContextManager:W}){if(J.hasContextData()){let V=J.getContext();W.setContext({...V})}}clone(){let J=new Q;return J.setContext({...this.context}),J.hasContext=this.hasContext,J}},qW=class Q{setContext(J){}appendContext(J){}getContext(){return{}}hasContextData(){return!1}clearContext(J){}onChildLoggerCreated(J){}clone(){return new Q}};var KW=class Q{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(J){let W=R5[J];for(let V of Object.values(d)){let Y=V,X=R5[V];this.logLevelEnabledStatus[Y]=X>=W}}enableIndividualLevel(J){let W=J;if(W in this.logLevelEnabledStatus)this.logLevelEnabledStatus[W]=!0}disableIndividualLevel(J){let W=J;if(W in this.logLevelEnabledStatus)this.logLevelEnabledStatus[W]=!1}isLevelEnabled(J){let W=J;return this.logLevelEnabledStatus[W]}enableLogging(){for(let J of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[J]=!0}disableLogging(){for(let J of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[J]=!1}onChildLoggerCreated({parentLogLevelManager:J,childLogLevelManager:W}){let V=J.logLevelEnabledStatus;if(W instanceof Q)W.logLevelEnabledStatus={...V}}clone(){let J=new Q;return J.logLevelEnabledStatus={...this.logLevelEnabledStatus},J}},ZW=class Q{setLevel(J){}enableIndividualLevel(J){}disableIndividualLevel(J){}isLevelEnabled(J){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(J){}clone(){return new Q}};var jU=[w0.onBeforeDataOut,w0.onMetadataCalled,w0.onBeforeMessageOut,w0.transformLogLevel,w0.shouldSendToLogger,w0.onContextCalled],$W=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(Q){this.idToPlugin={},this.mapPlugins(Q),this.indexPlugins()}mapPlugins(Q){for(let J of Q){if(!J.id)J.id=Date.now().toString()+Math.random().toString();if(this.idToPlugin[J.id])throw Error(`[LogLayer] Plugin with id ${J.id} already exists.`);J.registeredAt=Date.now(),this.idToPlugin[J.id]=J}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let Q=Object.values(this.idToPlugin).sort((J,W)=>J.registeredAt-W.registeredAt);for(let J of Q){if(J.disabled)return;for(let W of jU)if(J[W]&&J.id)this[W].push(J.id)}}hasPlugins(Q){return this[Q].length>0}countPlugins(Q){if(Q)return this[Q].length;return Object.keys(this.idToPlugin).length}addPlugins(Q){this.mapPlugins(Q),this.indexPlugins()}enablePlugin(Q){let J=this.idToPlugin[Q];if(J)J.disabled=!1;this.indexPlugins()}disablePlugin(Q){let J=this.idToPlugin[Q];if(J)J.disabled=!0;this.indexPlugins()}removePlugin(Q){delete this.idToPlugin[Q],this.indexPlugins()}runTransformLogLevel(Q,J){let W=null;for(let V of this.transformLogLevel){let Y=this.idToPlugin[V];if(Y.transformLogLevel){let X=Y.transformLogLevel({data:Q.data,logLevel:Q.logLevel,messages:Q.messages,error:Q.error,metadata:Q.metadata,context:Q.context},J);if(X!==null&&X!==void 0&&X!==!1)W=X}}return W!==null&&W!==void 0&&W!==!1?W:Q.logLevel}runOnBeforeDataOut(Q,J){let W={...Q};for(let V of this.onBeforeDataOut){let Y=this.idToPlugin[V];if(Y.onBeforeDataOut){let X=Y.onBeforeDataOut({data:W.data,logLevel:W.logLevel,error:W.error,metadata:W.metadata,context:W.context},J);if(X){if(!W.data)W.data={};Object.assign(W.data,X)}}}return W.data}runShouldSendToLogger(Q,J){return!this.shouldSendToLogger.some((W)=>{return!this.idToPlugin[W].shouldSendToLogger?.(Q,J)})}runOnMetadataCalled(Q,J){let W={...Q};for(let V of this.onMetadataCalled){let Y=this.idToPlugin[V].onMetadataCalled?.(W,J);if(Y)W=Y;else return null}return W}runOnBeforeMessageOut(Q,J){let W=[...Q.messages];for(let V of this.onBeforeMessageOut){let Y=this.idToPlugin[V].onBeforeMessageOut?.({messages:W,logLevel:Q.logLevel},J);if(Y)W=Y}return W}runOnContextCalled(Q,J){let W={...Q};for(let V of this.onContextCalled){let Y=this.idToPlugin[V].onContextCalled?.(W,J);if(Y)W=Y;else return null}return W}},HW=class Q{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_config;constructor(J){if(this._config={...J,enabled:J.enabled??!0},this.contextManager=new XW,this.logLevelManager=new KW,!this._config.enabled)this.disableLogging();if(this.pluginManager=new $W([...J.plugins||[],...D8.pluginsToInit]),!this._config.errorFieldName)this._config.errorFieldName="err";if(!this._config.copyMsgOnOnlyError)this._config.copyMsgOnOnlyError=!1;if(this._initializeTransports(this._config.transport),D8.logLayerHandlers.length>0)D8.logLayerHandlers.forEach((W)=>{if(W.onConstruct)W.onConstruct(this,J)})}withContextManager(J){if(this.contextManager&&typeof this.contextManager[Symbol.dispose]==="function")this.contextManager[Symbol.dispose]();return this.contextManager=J,this}getContextManager(){return this.contextManager}withLogLevelManager(J){if(this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==="function")this.logLevelManager[Symbol.dispose]();return this.logLevelManager=J,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(J){if(this.idToTransport){for(let W in this.idToTransport)if(this.idToTransport[W]&&typeof this.idToTransport[W][Symbol.dispose]==="function")this.idToTransport[W][Symbol.dispose]()}if(this.hasMultipleTransports=Array.isArray(J)&&J.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(J)?J[0]:J,Array.isArray(J))this.idToTransport=J.reduce((W,V)=>{return W[V.id]=V,W},{});else this.idToTransport={[J.id]:J}}withPrefix(J){let W=this.child();return W._config.prefix=J,W}withContext(J){let W=J;if(!J){if(this._config.consoleDebug)console.debug("[LogLayer] withContext was called with no context; dropping.");return this}if(this.pluginManager.hasPlugins(w0.onContextCalled)){if(W=this.pluginManager.runOnContextCalled(J,this),!W){if(this._config.consoleDebug)console.debug("[LogLayer] Context was dropped due to plugin returning falsy value.");return this}}return this.contextManager.appendContext(W),this}clearContext(J){return this.contextManager.clearContext(J),this}getContext(){return this.contextManager.getContext()}addPlugins(J){this.pluginManager.addPlugins(J)}enablePlugin(J){this.pluginManager.enablePlugin(J)}disablePlugin(J){this.pluginManager.disablePlugin(J)}removePlugin(J){this.pluginManager.removePlugin(J)}withMetadata(J){return new UW(this).withMetadata(J)}withError(J){return new UW(this).withError(J)}child(){let J=new Q({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:J.contextManager,parentLogger:this,childLogger:J}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:J.logLevelManager,parentLogger:this,childLogger:J}),J}withFreshTransports(J){return this._config.transport=J,this._initializeTransports(J),this}addTransport(J){let W=Array.isArray(J)?J:[J],V=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],Y=new Set(W.map((q)=>q.id));for(let q of W){let K=this.idToTransport[q.id];if(K&&typeof K[Symbol.dispose]==="function")K[Symbol.dispose]()}let X=[...V.filter((q)=>!Y.has(q.id)),...W];this._config.transport=X;for(let q of W)this.idToTransport[q.id]=q;return this.hasMultipleTransports=X.length>1,this.singleTransport=this.hasMultipleTransports?null:X[0],this}removeTransport(J){let W=this.idToTransport[J];if(!W)return!1;if(typeof W[Symbol.dispose]==="function")W[Symbol.dispose]();delete this.idToTransport[J];let V=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter((Y)=>Y.id!==J);return this._config.transport=V.length===1?V[0]:V,this.hasMultipleTransports=V.length>1,this.singleTransport=this.hasMultipleTransports?null:V[0]||null,!0}withFreshPlugins(J){return this._config.plugins=J,this.pluginManager=new $W(J),this}withPluginManager(J){return this.pluginManager=J,this}errorOnly(J,W){let V=W?.logLevel||d.error;if(!this.isLevelEnabled(V))return;let{copyMsgOnOnlyError:Y}=this._config,X={logLevel:V,err:J};if((Y&&W?.copyMsg!==!1||W?.copyMsg===!0)&&J?.message)X.params=[J.message];this._formatLog(X)}metadataOnly(J,W=d.info){if(!this.isLevelEnabled(W))return;let{muteMetadata:V,consoleDebug:Y}=this._config;if(V)return;if(!J){if(Y)console.debug("[LogLayer] metadataOnly was called with no metadata; dropping.");return}let X=J;if(this.pluginManager.hasPlugins(w0.onMetadataCalled)){if(X=this.pluginManager.runOnMetadataCalled(J,this),!X){if(Y)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return}}let q={logLevel:W,metadata:X};this._formatLog(q)}info(...J){if(!this.isLevelEnabled(d.info))return;this._formatMessage(J),this._formatLog({logLevel:d.info,params:J})}warn(...J){if(!this.isLevelEnabled(d.warn))return;this._formatMessage(J),this._formatLog({logLevel:d.warn,params:J})}error(...J){if(!this.isLevelEnabled(d.error))return;this._formatMessage(J),this._formatLog({logLevel:d.error,params:J})}debug(...J){if(!this.isLevelEnabled(d.debug))return;this._formatMessage(J),this._formatLog({logLevel:d.debug,params:J})}trace(...J){if(!this.isLevelEnabled(d.trace))return;this._formatMessage(J),this._formatLog({logLevel:d.trace,params:J})}fatal(...J){if(!this.isLevelEnabled(d.fatal))return;this._formatMessage(J),this._formatLog({logLevel:d.fatal,params:J})}raw(J){if(!this.isLevelEnabled(J.logLevel))return;let W={logLevel:J.logLevel,params:J.messages,metadata:J.metadata,err:J.error,context:J.context};this._formatMessage(J.messages),this._formatLog(W)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(J){return this.logLevelManager.enableIndividualLevel(J),this}disableIndividualLevel(J){return this.logLevelManager.disableIndividualLevel(J),this}setLevel(J){return this.logLevelManager.setLevel(J),this}isLevelEnabled(J){return this.logLevelManager.isLevelEnabled(J)}formatContext(J){let{contextFieldName:W,muteContext:V}=this._config;if(J&&Object.keys(J).length>0&&!V){if(W)return{[W]:{...J}};return{...J}}return{}}formatMetadata(J=null){let{metadataFieldName:W,muteMetadata:V}=this._config;if(J&&!V){if(W)return{[W]:{...J}};return{...J}}return{}}getLoggerInstance(J){let W=this.idToTransport[J];if(!W)return;return W.getLoggerInstance()}_formatMessage(J=[]){let{prefix:W}=this._config;if(W&&typeof J[0]==="string")J[0]=`${W} ${J[0]}`}_formatLog({logLevel:J,params:W=[],metadata:V=null,err:Y,context:X=null}){let{errorSerializer:q,errorFieldInMetadata:K,muteContext:z,contextFieldName:$,metadataFieldName:Z,errorFieldName:U}=this._config,H=X!==null?X:this.contextManager.getContext(),B=!!V||(z?!1:X!==null?Object.keys(X).length>0:this.contextManager.hasContextData()),j={};if(B)if($&&$===Z){let F=this.formatContext(H)[$],I=this.formatMetadata(V)[Z];j={[$]:{...F,...I}}}else j={...this.formatContext(H),...this.formatMetadata(V)};if(Y){let F=q?q(Y):Y;if(K&&V&&Z)if(j?.[Z])j[Z][U]=F;else j={...j,[Z]:{[U]:F}};else if(K&&!V&&Z)j={...j,[Z]:{[U]:F}};else j={...j,[U]:F};B=!0}if(this.pluginManager.hasPlugins(w0.onBeforeDataOut)){if(j=this.pluginManager.runOnBeforeDataOut({data:B?j:void 0,logLevel:J,error:Y,metadata:V,context:H},this),j&&!B)B=!0}if(this.pluginManager.hasPlugins(w0.onBeforeMessageOut))W=this.pluginManager.runOnBeforeMessageOut({messages:[...W],logLevel:J},this);if(this.pluginManager.hasPlugins(w0.transformLogLevel))J=this.pluginManager.runTransformLogLevel({data:B?j:void 0,logLevel:J,messages:[...W],error:Y,metadata:V,context:H},this);if(this.hasMultipleTransports){let F=this._config.transport.filter((I)=>I.enabled).map(async(I)=>{let L=J;if(this.pluginManager.hasPlugins(w0.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...W],data:B?j:void 0,logLevel:L,transportId:I.id,error:Y,metadata:V,context:H},this))return}return I._sendToLogger({logLevel:L,messages:[...W],data:B?j:void 0,hasData:B,error:Y,metadata:V,context:H})});Promise.all(F).catch((I)=>{if(this._config.consoleDebug)console.error("[LogLayer] Error executing transports:",I)})}else{if(!this.singleTransport?.enabled)return;if(this.pluginManager.hasPlugins(w0.shouldSendToLogger)){if(!this.pluginManager.runShouldSendToLogger({messages:[...W],data:B?j:void 0,logLevel:J,transportId:this.singleTransport.id,error:Y,metadata:V,context:H},this))return}this.singleTransport._sendToLogger({logLevel:J,messages:[...W],data:B?j:void 0,hasData:B,error:Y,metadata:V,context:H})}}},zW=class{debug(...Q){}error(...Q){}info(...Q){}trace(...Q){}warn(...Q){}fatal(...Q){}enableLogging(){return this}disableLogging(){return this}withMetadata(Q){return this}withError(Q){return this}},SA=class{mockLogBuilder=new zW;mockContextManager=new qW;mockLogLevelManager=new ZW;info(...Q){}warn(...Q){}error(...Q){}debug(...Q){}trace(...Q){}fatal(...Q){}raw(Q){}getLoggerInstance(Q){}errorOnly(Q,J){}metadataOnly(Q,J){}addPlugins(Q){}removePlugin(Q){}enablePlugin(Q){}disablePlugin(Q){}withPrefix(Q){return this}withContext(Q){return this}withError(Q){return this.mockLogBuilder.withError(Q)}withMetadata(Q){return this.mockLogBuilder.withMetadata(Q)}getContext(){return{}}clearContext(Q){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(Q){return this}addTransport(Q){return this}removeTransport(Q){return!0}withFreshPlugins(Q){return this}withContextManager(Q){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(Q){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(Q){this.mockLogBuilder=Q}enableIndividualLevel(Q){return this}disableIndividualLevel(Q){return this}setLevel(Q){return this}isLevelEnabled(Q){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new zW}};var D8={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var UW=class{err;metadata;structuredLogger;hasMetadata;pluginManager;constructor(Q){if(this.err=null,this.metadata={},this.structuredLogger=Q,this.hasMetadata=!1,this.pluginManager=Q.pluginManager,D8.logBuilderHandlers.length>0)D8.logBuilderHandlers.forEach((J)=>{if(J.onConstruct)J.onConstruct(this,Q)})}withMetadata(Q){let{pluginManager:J,structuredLogger:{_config:{consoleDebug:W}}}=this;if(!Q){if(W)console.debug("[LogLayer] withMetadata was called with no metadata; dropping.");return this}let V=Q;if(J.hasPlugins(w0.onMetadataCalled)){if(V=J.runOnMetadataCalled(Q,this.structuredLogger),!V){if(W)console.debug("[LogLayer] Metadata was dropped due to plugin returning falsy value.");return this}}return this.metadata={...this.metadata,...V},this.hasMetadata=!0,this}withError(Q){return this.err=Q,this}info(...Q){if(!this.structuredLogger.isLevelEnabled(d.info))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.info,Q)}warn(...Q){if(!this.structuredLogger.isLevelEnabled(d.warn))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.warn,Q)}error(...Q){if(!this.structuredLogger.isLevelEnabled(d.error))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.error,Q)}debug(...Q){if(!this.structuredLogger.isLevelEnabled(d.debug))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.debug,Q)}trace(...Q){if(!this.structuredLogger.isLevelEnabled(d.trace))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.trace,Q)}fatal(...Q){if(!this.structuredLogger.isLevelEnabled(d.fatal))return;this.structuredLogger._formatMessage(Q),this.formatLog(d.fatal,Q)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(Q,J){let{muteMetadata:W}=this.structuredLogger._config,V=W?!1:this.hasMetadata;this.structuredLogger._formatLog({logLevel:Q,params:J,metadata:V?this.metadata:null,err:this.err})}};function FU(){return new HW({transport:{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}})}function BW(Q){return Q??FU()}import{Ok as NA,Err as XU}from"@kumori/kdsl-lsp/util/result.js";async function lT(Q){let J=BW(Q.logger);if(!Q.interactive)return XU(["Index create command requires interactive mode. Set interactive: true to use this command programmatically with prompts, or use the CLI directly: kdsl index create"]);try{let{Action:W}=await Promise.resolve().then(() => (YU(),VU));return await W(J)({module:Q.module??void 0,index:Q.indexFile??void 0}),NA(void 0)}catch(W){return XU([String(W)])}}export{lT as indexCreate};
|