@aku11i/phantom 6.3.0-3 → 6.3.0-5
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/app/server/{app-BLBOjh4e.mjs → app-CYTfYqUa.mjs} +3801 -227
- package/app/server/app-CYTfYqUa.mjs.map +1 -0
- package/app/server/index.mjs +1 -1
- package/app/server/start.mjs +1 -1
- package/app/web/assets/index-2tOj0_vn.js +52 -0
- package/app/web/assets/index-CwcMZa7-.css +2 -0
- package/app/web/index.html +3 -3
- package/app/web/manifest.webmanifest +1 -1
- package/package.json +1 -1
- package/phantom.js +3177 -6
- package/app/server/app-BLBOjh4e.mjs.map +0 -1
- package/app/web/assets/index-DfF5Sezp.css +0 -2
- package/app/web/assets/index-IIn3YvIM.js +0 -52
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
import { createReadStream, existsSync, statSync } from "fs";
|
|
4
|
-
import fs, { copyFile, mkdir, mkdtemp, readFile, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
|
-
import path, { basename, dirname, extname, isAbsolute, join as join$1, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { createReadStream, existsSync, lstatSync, readdir, readdirSync, readlinkSync, realpathSync, statSync } from "fs";
|
|
4
|
+
import fs, { copyFile, lstat, mkdir, mkdtemp, readFile, readdir as readdir$1, readlink, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import path, { basename, dirname, extname, isAbsolute, join as join$1, posix, relative, resolve, sep, win32 } from "node:path";
|
|
6
6
|
import { inflateSync } from "node:zlib";
|
|
7
7
|
import { execFile, spawn } from "node:child_process";
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import * as xi from "node:fs";
|
|
9
11
|
import { existsSync as existsSync$1 } from "node:fs";
|
|
12
|
+
import { EventEmitter } from "node:events";
|
|
13
|
+
import Pe from "node:stream";
|
|
14
|
+
import { StringDecoder } from "node:string_decoder";
|
|
10
15
|
import { homedir, tmpdir } from "node:os";
|
|
11
16
|
import readline from "node:readline";
|
|
12
|
-
import { fileURLToPath } from "node:url";
|
|
13
17
|
import { versions } from "process";
|
|
14
18
|
import { Readable } from "stream";
|
|
15
19
|
//#region \0rolldown/runtime.js
|
|
@@ -3708,6 +3712,97 @@ function handleIntersectionResults(result, left, right) {
|
|
|
3708
3712
|
result.value = merged.data;
|
|
3709
3713
|
return result;
|
|
3710
3714
|
}
|
|
3715
|
+
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3716
|
+
$ZodType.init(inst, def);
|
|
3717
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3718
|
+
const input = payload.value;
|
|
3719
|
+
if (!isPlainObject$2(input)) {
|
|
3720
|
+
payload.issues.push({
|
|
3721
|
+
expected: "record",
|
|
3722
|
+
code: "invalid_type",
|
|
3723
|
+
input,
|
|
3724
|
+
inst
|
|
3725
|
+
});
|
|
3726
|
+
return payload;
|
|
3727
|
+
}
|
|
3728
|
+
const proms = [];
|
|
3729
|
+
const values = def.keyType._zod.values;
|
|
3730
|
+
if (values) {
|
|
3731
|
+
payload.value = {};
|
|
3732
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
3733
|
+
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
3734
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
3735
|
+
const result = def.valueType._zod.run({
|
|
3736
|
+
value: input[key],
|
|
3737
|
+
issues: []
|
|
3738
|
+
}, ctx);
|
|
3739
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
3740
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3741
|
+
payload.value[key] = result.value;
|
|
3742
|
+
}));
|
|
3743
|
+
else {
|
|
3744
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3745
|
+
payload.value[key] = result.value;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
let unrecognized;
|
|
3749
|
+
for (const key in input) if (!recordKeys.has(key)) {
|
|
3750
|
+
unrecognized = unrecognized ?? [];
|
|
3751
|
+
unrecognized.push(key);
|
|
3752
|
+
}
|
|
3753
|
+
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
3754
|
+
code: "unrecognized_keys",
|
|
3755
|
+
input,
|
|
3756
|
+
inst,
|
|
3757
|
+
keys: unrecognized
|
|
3758
|
+
});
|
|
3759
|
+
} else {
|
|
3760
|
+
payload.value = {};
|
|
3761
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
3762
|
+
if (key === "__proto__") continue;
|
|
3763
|
+
let keyResult = def.keyType._zod.run({
|
|
3764
|
+
value: key,
|
|
3765
|
+
issues: []
|
|
3766
|
+
}, ctx);
|
|
3767
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3768
|
+
if (typeof key === "string" && number$2.test(key) && keyResult.issues.length) {
|
|
3769
|
+
const retryResult = def.keyType._zod.run({
|
|
3770
|
+
value: Number(key),
|
|
3771
|
+
issues: []
|
|
3772
|
+
}, ctx);
|
|
3773
|
+
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3774
|
+
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
3775
|
+
}
|
|
3776
|
+
if (keyResult.issues.length) {
|
|
3777
|
+
if (def.mode === "loose") payload.value[key] = input[key];
|
|
3778
|
+
else payload.issues.push({
|
|
3779
|
+
code: "invalid_key",
|
|
3780
|
+
origin: "record",
|
|
3781
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
3782
|
+
input: key,
|
|
3783
|
+
path: [key],
|
|
3784
|
+
inst
|
|
3785
|
+
});
|
|
3786
|
+
continue;
|
|
3787
|
+
}
|
|
3788
|
+
const result = def.valueType._zod.run({
|
|
3789
|
+
value: input[key],
|
|
3790
|
+
issues: []
|
|
3791
|
+
}, ctx);
|
|
3792
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
3793
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3794
|
+
payload.value[keyResult.value] = result.value;
|
|
3795
|
+
}));
|
|
3796
|
+
else {
|
|
3797
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3798
|
+
payload.value[keyResult.value] = result.value;
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
3803
|
+
return payload;
|
|
3804
|
+
};
|
|
3805
|
+
});
|
|
3711
3806
|
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
3712
3807
|
$ZodType.init(inst, def);
|
|
3713
3808
|
const values = getEnumValues(def.entries);
|
|
@@ -4978,6 +5073,39 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
4978
5073
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
4979
5074
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4980
5075
|
};
|
|
5076
|
+
const recordProcessor = (schema, ctx, _json, params) => {
|
|
5077
|
+
const json = _json;
|
|
5078
|
+
const def = schema._zod.def;
|
|
5079
|
+
json.type = "object";
|
|
5080
|
+
const keyType = def.keyType;
|
|
5081
|
+
const patterns = keyType._zod.bag?.patterns;
|
|
5082
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
5083
|
+
const valueSchema = process$1(def.valueType, ctx, {
|
|
5084
|
+
...params,
|
|
5085
|
+
path: [
|
|
5086
|
+
...params.path,
|
|
5087
|
+
"patternProperties",
|
|
5088
|
+
"*"
|
|
5089
|
+
]
|
|
5090
|
+
});
|
|
5091
|
+
json.patternProperties = {};
|
|
5092
|
+
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
5093
|
+
} else {
|
|
5094
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$1(def.keyType, ctx, {
|
|
5095
|
+
...params,
|
|
5096
|
+
path: [...params.path, "propertyNames"]
|
|
5097
|
+
});
|
|
5098
|
+
json.additionalProperties = process$1(def.valueType, ctx, {
|
|
5099
|
+
...params,
|
|
5100
|
+
path: [...params.path, "additionalProperties"]
|
|
5101
|
+
});
|
|
5102
|
+
}
|
|
5103
|
+
const keyValues = keyType._zod.values;
|
|
5104
|
+
if (keyValues) {
|
|
5105
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
5106
|
+
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
5107
|
+
}
|
|
5108
|
+
};
|
|
4981
5109
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4982
5110
|
const def = schema._zod.def;
|
|
4983
5111
|
const inner = process$1(def.innerType, ctx, params);
|
|
@@ -5470,6 +5598,21 @@ function intersection(left, right) {
|
|
|
5470
5598
|
right
|
|
5471
5599
|
});
|
|
5472
5600
|
}
|
|
5601
|
+
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
5602
|
+
$ZodRecord.init(inst, def);
|
|
5603
|
+
ZodType.init(inst, def);
|
|
5604
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
5605
|
+
inst.keyType = def.keyType;
|
|
5606
|
+
inst.valueType = def.valueType;
|
|
5607
|
+
});
|
|
5608
|
+
function record(keyType, valueType, params) {
|
|
5609
|
+
return new ZodRecord({
|
|
5610
|
+
type: "record",
|
|
5611
|
+
keyType,
|
|
5612
|
+
valueType,
|
|
5613
|
+
...normalizeParams(params)
|
|
5614
|
+
});
|
|
5615
|
+
}
|
|
5473
5616
|
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
5474
5617
|
$ZodEnum.init(inst, def);
|
|
5475
5618
|
ZodType.init(inst, def);
|
|
@@ -5800,12 +5943,12 @@ function z() {
|
|
|
5800
5943
|
walkTokens: null
|
|
5801
5944
|
};
|
|
5802
5945
|
}
|
|
5803
|
-
var T = z();
|
|
5804
|
-
function G(l) {
|
|
5805
|
-
T = l;
|
|
5946
|
+
var T$1 = z();
|
|
5947
|
+
function G$1(l) {
|
|
5948
|
+
T$1 = l;
|
|
5806
5949
|
}
|
|
5807
|
-
var _ = { exec: () => null };
|
|
5808
|
-
function k(l, e = "") {
|
|
5950
|
+
var _$1 = { exec: () => null };
|
|
5951
|
+
function k$1(l, e = "") {
|
|
5809
5952
|
let t = typeof l == "string" ? l : l.source, n = {
|
|
5810
5953
|
replace: (s, r) => {
|
|
5811
5954
|
let i = typeof r == "string" ? r : r.source;
|
|
@@ -5815,7 +5958,7 @@ function k(l, e = "") {
|
|
|
5815
5958
|
};
|
|
5816
5959
|
return n;
|
|
5817
5960
|
}
|
|
5818
|
-
var Re = ((l = "") => {
|
|
5961
|
+
var Re$1 = ((l = "") => {
|
|
5819
5962
|
try {
|
|
5820
5963
|
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
5821
5964
|
} catch {
|
|
@@ -5878,95 +6021,95 @@ var Re = ((l = "") => {
|
|
|
5878
6021
|
headingBeginRegex: (l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`),
|
|
5879
6022
|
htmlBeginRegex: (l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i"),
|
|
5880
6023
|
blockquoteBeginRegex: (l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}>`)
|
|
5881
|
-
}, Te = /^(?:[ \t]*(?:\n|$))+/, Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = k(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Pe = k(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Se = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Le = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae = k(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), K = {
|
|
5882
|
-
blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(),
|
|
5883
|
-
code: Oe,
|
|
5884
|
-
def: $e,
|
|
5885
|
-
fences: we,
|
|
5886
|
-
heading: ye,
|
|
5887
|
-
hr: I,
|
|
5888
|
-
html: _e,
|
|
5889
|
-
lheading: oe,
|
|
5890
|
-
list: Le,
|
|
5891
|
-
newline: Te,
|
|
5892
|
-
paragraph: ae,
|
|
5893
|
-
table: _,
|
|
5894
|
-
text: Se
|
|
5895
|
-
}, re = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), ze = {
|
|
5896
|
-
...K,
|
|
5897
|
-
lheading: Pe,
|
|
6024
|
+
}, Te$1 = /^(?:[ \t]*(?:\n|$))+/, Oe$1 = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, we$1 = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I$1 = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ye$1 = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q$1 = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ie$1 = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe$1 = k$1(ie$1).replace(/bull/g, Q$1).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Pe$1 = k$1(ie$1).replace(/bull/g, Q$1).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j$1 = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Se$1 = /^[^\n]+/, F$1 = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, $e$1 = k$1(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F$1).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Le$1 = k$1(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q$1).getRegex(), v$1 = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U$1 = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e$1 = k$1("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U$1).replace("tag", v$1).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae$1 = k$1(j$1).replace("hr", I$1).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v$1).getRegex(), K$1 = {
|
|
6025
|
+
blockquote: k$1(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae$1).getRegex(),
|
|
6026
|
+
code: Oe$1,
|
|
6027
|
+
def: $e$1,
|
|
6028
|
+
fences: we$1,
|
|
6029
|
+
heading: ye$1,
|
|
6030
|
+
hr: I$1,
|
|
6031
|
+
html: _e$1,
|
|
6032
|
+
lheading: oe$1,
|
|
6033
|
+
list: Le$1,
|
|
6034
|
+
newline: Te$1,
|
|
6035
|
+
paragraph: ae$1,
|
|
6036
|
+
table: _$1,
|
|
6037
|
+
text: Se$1
|
|
6038
|
+
}, re = k$1("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I$1).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v$1).getRegex(), ze$1 = {
|
|
6039
|
+
...K$1,
|
|
6040
|
+
lheading: Pe$1,
|
|
5898
6041
|
table: re,
|
|
5899
|
-
paragraph: k(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
|
|
5900
|
-
}, Ee = {
|
|
5901
|
-
...K,
|
|
5902
|
-
html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
6042
|
+
paragraph: k$1(j$1).replace("hr", I$1).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v$1).getRegex()
|
|
6043
|
+
}, Ee$1 = {
|
|
6044
|
+
...K$1,
|
|
6045
|
+
html: k$1(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U$1).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
5903
6046
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
5904
6047
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
5905
|
-
fences: _,
|
|
6048
|
+
fences: _$1,
|
|
5906
6049
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
5907
|
-
paragraph: k(j).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
5908
|
-
]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
5909
|
-
}, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, le = /^( {2,}|\\)\n(?!\s*$)/, Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, E = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), ue = /(?!~)[\p{P}\p{S}]/u, De = /(?!~)[\s\p{P}\p{S}]/u, qe = /(?:[^\s\p{P}\p{S}]|~)/u, ve = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), pe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, He = k(pe, "u").replace(/punct/g, E).getRegex(), Ze = k(pe, "u").replace(/punct/g, ue).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ge = k(ce, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), Ne = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, ue).getRegex(), Qe = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), je = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex(), Ue = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), Ke = k(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(), We = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Xe = k(U).replace("(?:-->|$)", "-->").getRegex(), Je = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Xe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ve = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ye = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex(), se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = {
|
|
5910
|
-
_backpedal: _,
|
|
5911
|
-
anyPunctuation: Ke,
|
|
5912
|
-
autolink: We,
|
|
5913
|
-
blockSkip: ve,
|
|
5914
|
-
br: le,
|
|
5915
|
-
code: Ce,
|
|
5916
|
-
del: _,
|
|
5917
|
-
delLDelim: _,
|
|
5918
|
-
delRDelim: _,
|
|
5919
|
-
emStrongLDelim: He,
|
|
5920
|
-
emStrongRDelimAst: Ge,
|
|
5921
|
-
emStrongRDelimUnd: Qe,
|
|
5922
|
-
escape: Ae,
|
|
5923
|
-
link: Ve,
|
|
5924
|
-
nolink: ke,
|
|
5925
|
-
punctuation: Be,
|
|
5926
|
-
reflink: he,
|
|
5927
|
-
reflinkSearch: Ye,
|
|
5928
|
-
tag: Je,
|
|
5929
|
-
text: Ie,
|
|
5930
|
-
url: _
|
|
5931
|
-
}, et = {
|
|
5932
|
-
...X,
|
|
5933
|
-
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
5934
|
-
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
5935
|
-
}, N = {
|
|
5936
|
-
...X,
|
|
5937
|
-
emStrongRDelimAst: Ne,
|
|
5938
|
-
emStrongLDelim: Ze,
|
|
5939
|
-
delLDelim: je,
|
|
5940
|
-
delRDelim: Ue,
|
|
5941
|
-
url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
6050
|
+
paragraph: k$1(j$1).replace("hr", I$1).replace("heading", ` *#{1,6} *[^
|
|
6051
|
+
]`).replace("lheading", oe$1).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
6052
|
+
}, Ae$1 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce$1 = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, le$1 = /^( {2,}|\\)\n(?!\s*$)/, Ie$1 = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, E = /[\p{P}\p{S}]/u, H$1 = /[\s\p{P}\p{S}]/u, W$1 = /[^\s\p{P}\p{S}]/u, Be$1 = k$1(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H$1).getRegex(), ue$1 = /(?!~)[\p{P}\p{S}]/u, De$1 = /(?!~)[\s\p{P}\p{S}]/u, qe$1 = /(?:[^\s\p{P}\p{S}]|~)/u, ve$1 = k$1(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re$1 ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), pe$1 = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, He$1 = k$1(pe$1, "u").replace(/punct/g, E).getRegex(), Ze$1 = k$1(pe$1, "u").replace(/punct/g, ue$1).getRegex(), ce$1 = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ge$1 = k$1(ce$1, "gu").replace(/notPunctSpace/g, W$1).replace(/punctSpace/g, H$1).replace(/punct/g, E).getRegex(), Ne$1 = k$1(ce$1, "gu").replace(/notPunctSpace/g, qe$1).replace(/punctSpace/g, De$1).replace(/punct/g, ue$1).getRegex(), Qe$1 = k$1("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W$1).replace(/punctSpace/g, H$1).replace(/punct/g, E).getRegex(), je$1 = k$1(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex(), Ue$1 = k$1("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, W$1).replace(/punctSpace/g, H$1).replace(/punct/g, E).getRegex(), Ke$1 = k$1(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(), We$1 = k$1(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Xe$1 = k$1(U$1).replace("(?:-->|$)", "-->").getRegex(), Je$1 = k$1("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Xe$1).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q$1 = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ve$1 = k$1(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q$1).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he$1 = k$1(/^!?\[(label)\]\[(ref)\]/).replace("label", q$1).replace("ref", F$1).getRegex(), ke$1 = k$1(/^!?\[(ref)\](?:\[\])?/).replace("ref", F$1).getRegex(), Ye$1 = k$1("reflink|nolink(?!\\()", "g").replace("reflink", he$1).replace("nolink", ke$1).getRegex(), se$1 = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X$1 = {
|
|
6053
|
+
_backpedal: _$1,
|
|
6054
|
+
anyPunctuation: Ke$1,
|
|
6055
|
+
autolink: We$1,
|
|
6056
|
+
blockSkip: ve$1,
|
|
6057
|
+
br: le$1,
|
|
6058
|
+
code: Ce$1,
|
|
6059
|
+
del: _$1,
|
|
6060
|
+
delLDelim: _$1,
|
|
6061
|
+
delRDelim: _$1,
|
|
6062
|
+
emStrongLDelim: He$1,
|
|
6063
|
+
emStrongRDelimAst: Ge$1,
|
|
6064
|
+
emStrongRDelimUnd: Qe$1,
|
|
6065
|
+
escape: Ae$1,
|
|
6066
|
+
link: Ve$1,
|
|
6067
|
+
nolink: ke$1,
|
|
6068
|
+
punctuation: Be$1,
|
|
6069
|
+
reflink: he$1,
|
|
6070
|
+
reflinkSearch: Ye$1,
|
|
6071
|
+
tag: Je$1,
|
|
6072
|
+
text: Ie$1,
|
|
6073
|
+
url: _$1
|
|
6074
|
+
}, et$1 = {
|
|
6075
|
+
...X$1,
|
|
6076
|
+
link: k$1(/^!?\[(label)\]\((.*?)\)/).replace("label", q$1).getRegex(),
|
|
6077
|
+
reflink: k$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q$1).getRegex()
|
|
6078
|
+
}, N$1 = {
|
|
6079
|
+
...X$1,
|
|
6080
|
+
emStrongRDelimAst: Ne$1,
|
|
6081
|
+
emStrongLDelim: Ze$1,
|
|
6082
|
+
delLDelim: je$1,
|
|
6083
|
+
delRDelim: Ue$1,
|
|
6084
|
+
url: k$1(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se$1).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
5942
6085
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
5943
6086
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
5944
|
-
text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex()
|
|
5945
|
-
}, tt = {
|
|
5946
|
-
...N,
|
|
5947
|
-
br: k(le).replace("{2,}", "*").getRegex(),
|
|
5948
|
-
text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
5949
|
-
}, B = {
|
|
5950
|
-
normal: K,
|
|
5951
|
-
gfm: ze,
|
|
5952
|
-
pedantic: Ee
|
|
5953
|
-
}, A = {
|
|
5954
|
-
normal: X,
|
|
5955
|
-
gfm: N,
|
|
5956
|
-
breaks: tt,
|
|
5957
|
-
pedantic: et
|
|
6087
|
+
text: k$1(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se$1).getRegex()
|
|
6088
|
+
}, tt$1 = {
|
|
6089
|
+
...N$1,
|
|
6090
|
+
br: k$1(le$1).replace("{2,}", "*").getRegex(),
|
|
6091
|
+
text: k$1(N$1.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
6092
|
+
}, B$1 = {
|
|
6093
|
+
normal: K$1,
|
|
6094
|
+
gfm: ze$1,
|
|
6095
|
+
pedantic: Ee$1
|
|
6096
|
+
}, A$1 = {
|
|
6097
|
+
normal: X$1,
|
|
6098
|
+
gfm: N$1,
|
|
6099
|
+
breaks: tt$1,
|
|
6100
|
+
pedantic: et$1
|
|
5958
6101
|
};
|
|
5959
|
-
var nt = {
|
|
6102
|
+
var nt$1 = {
|
|
5960
6103
|
"&": "&",
|
|
5961
6104
|
"<": "<",
|
|
5962
6105
|
">": ">",
|
|
5963
6106
|
"\"": """,
|
|
5964
6107
|
"'": "'"
|
|
5965
|
-
}, de = (l) => nt[l];
|
|
5966
|
-
function O(l, e) {
|
|
6108
|
+
}, de$1 = (l) => nt$1[l];
|
|
6109
|
+
function O$1(l, e) {
|
|
5967
6110
|
if (e) {
|
|
5968
|
-
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, de);
|
|
5969
|
-
} else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, de);
|
|
6111
|
+
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, de$1);
|
|
6112
|
+
} else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, de$1);
|
|
5970
6113
|
return l;
|
|
5971
6114
|
}
|
|
5972
6115
|
function J(l) {
|
|
@@ -5977,7 +6120,7 @@ function J(l) {
|
|
|
5977
6120
|
}
|
|
5978
6121
|
return l;
|
|
5979
6122
|
}
|
|
5980
|
-
function V(l, e) {
|
|
6123
|
+
function V$1(l, e) {
|
|
5981
6124
|
let n = l.replace(m.findPipe, (r, i, o) => {
|
|
5982
6125
|
let u = !1, a = i;
|
|
5983
6126
|
for (; --a >= 0 && o[a] === "\\";) u = !u;
|
|
@@ -6000,14 +6143,14 @@ function $(l, e, t) {
|
|
|
6000
6143
|
}
|
|
6001
6144
|
return l.slice(0, n - s);
|
|
6002
6145
|
}
|
|
6003
|
-
function Y(l) {
|
|
6146
|
+
function Y$1(l) {
|
|
6004
6147
|
let e = l.split(`
|
|
6005
6148
|
`), t = e.length - 1;
|
|
6006
6149
|
for (; t >= 0 && m.blankLine.test(e[t]);) t--;
|
|
6007
6150
|
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
6008
6151
|
`);
|
|
6009
6152
|
}
|
|
6010
|
-
function ge(l, e) {
|
|
6153
|
+
function ge$1(l, e) {
|
|
6011
6154
|
if (l.indexOf(e[1]) === -1) return -1;
|
|
6012
6155
|
let t = 0;
|
|
6013
6156
|
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;
|
|
@@ -6015,7 +6158,7 @@ function ge(l, e) {
|
|
|
6015
6158
|
else if (l[n] === e[1] && (t--, t < 0)) return n;
|
|
6016
6159
|
return t > 0 ? -2 : -1;
|
|
6017
6160
|
}
|
|
6018
|
-
function fe(l, e = 0) {
|
|
6161
|
+
function fe$1(l, e = 0) {
|
|
6019
6162
|
let t = e, n = "";
|
|
6020
6163
|
for (let s of l) if (s === " ") {
|
|
6021
6164
|
let r = 4 - t % 4;
|
|
@@ -6023,7 +6166,7 @@ function fe(l, e = 0) {
|
|
|
6023
6166
|
} else n += s, t++;
|
|
6024
6167
|
return n;
|
|
6025
6168
|
}
|
|
6026
|
-
function me(l, e, t, n, s) {
|
|
6169
|
+
function me$1(l, e, t, n, s) {
|
|
6027
6170
|
let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
6028
6171
|
n.state.inLink = !0;
|
|
6029
6172
|
let u = {
|
|
@@ -6036,7 +6179,7 @@ function me(l, e, t, n, s) {
|
|
|
6036
6179
|
};
|
|
6037
6180
|
return n.state.inLink = !1, u;
|
|
6038
6181
|
}
|
|
6039
|
-
function rt(l, e, t) {
|
|
6182
|
+
function rt$1(l, e, t) {
|
|
6040
6183
|
let n = l.match(t.other.indentCodeCompensation);
|
|
6041
6184
|
if (n === null) return e;
|
|
6042
6185
|
let s = n[1];
|
|
@@ -6054,7 +6197,7 @@ var w = class {
|
|
|
6054
6197
|
rules;
|
|
6055
6198
|
lexer;
|
|
6056
6199
|
constructor(e) {
|
|
6057
|
-
this.options = e || T;
|
|
6200
|
+
this.options = e || T$1;
|
|
6058
6201
|
}
|
|
6059
6202
|
space(e) {
|
|
6060
6203
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -6066,7 +6209,7 @@ var w = class {
|
|
|
6066
6209
|
code(e) {
|
|
6067
6210
|
let t = this.rules.block.code.exec(e);
|
|
6068
6211
|
if (t) {
|
|
6069
|
-
let n = this.options.pedantic ? t[0] : Y(t[0]);
|
|
6212
|
+
let n = this.options.pedantic ? t[0] : Y$1(t[0]);
|
|
6070
6213
|
return {
|
|
6071
6214
|
type: "code",
|
|
6072
6215
|
raw: n,
|
|
@@ -6078,7 +6221,7 @@ var w = class {
|
|
|
6078
6221
|
fences(e) {
|
|
6079
6222
|
let t = this.rules.block.fences.exec(e);
|
|
6080
6223
|
if (t) {
|
|
6081
|
-
let n = t[0], s = rt(n, t[3] || "", this.rules);
|
|
6224
|
+
let n = t[0], s = rt$1(n, t[3] || "", this.rules);
|
|
6082
6225
|
return {
|
|
6083
6226
|
type: "code",
|
|
6084
6227
|
raw: n,
|
|
@@ -6175,7 +6318,7 @@ ${p}` : p;
|
|
|
6175
6318
|
let a = !1, c = "", p = "";
|
|
6176
6319
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
6177
6320
|
c = t[0], e = e.substring(c.length);
|
|
6178
|
-
let d = fe(t[2].split(`
|
|
6321
|
+
let d = fe$1(t[2].split(`
|
|
6179
6322
|
`, 1)[0], t[1].length), h = e.split(`
|
|
6180
6323
|
`, 1)[0], R = !d.trim(), f = 0;
|
|
6181
6324
|
if (this.options.pedantic ? (f = 2, p = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
|
|
@@ -6248,7 +6391,7 @@ ${p}` : p;
|
|
|
6248
6391
|
html(e) {
|
|
6249
6392
|
let t = this.rules.block.html.exec(e);
|
|
6250
6393
|
if (t) {
|
|
6251
|
-
let n = Y(t[0]);
|
|
6394
|
+
let n = Y$1(t[0]);
|
|
6252
6395
|
return {
|
|
6253
6396
|
type: "html",
|
|
6254
6397
|
block: !0,
|
|
@@ -6275,7 +6418,7 @@ ${p}` : p;
|
|
|
6275
6418
|
table(e) {
|
|
6276
6419
|
let t = this.rules.block.table.exec(e);
|
|
6277
6420
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
6278
|
-
let n = V(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
6421
|
+
let n = V$1(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
6279
6422
|
`) : [], i = {
|
|
6280
6423
|
type: "table",
|
|
6281
6424
|
raw: $(t[0], `
|
|
@@ -6292,7 +6435,7 @@ ${p}` : p;
|
|
|
6292
6435
|
header: !0,
|
|
6293
6436
|
align: i.align[o]
|
|
6294
6437
|
});
|
|
6295
|
-
for (let o of r) i.rows.push(V(o, i.header.length).map((u, a) => ({
|
|
6438
|
+
for (let o of r) i.rows.push(V$1(o, i.header.length).map((u, a) => ({
|
|
6296
6439
|
text: u,
|
|
6297
6440
|
tokens: this.lexer.inline(u),
|
|
6298
6441
|
header: !1,
|
|
@@ -6365,7 +6508,7 @@ ${p}` : p;
|
|
|
6365
6508
|
let i = $(n.slice(0, -1), "\\");
|
|
6366
6509
|
if ((n.length - i.length) % 2 === 0) return;
|
|
6367
6510
|
} else {
|
|
6368
|
-
let i = ge(t[2], "()");
|
|
6511
|
+
let i = ge$1(t[2], "()");
|
|
6369
6512
|
if (i === -2) return;
|
|
6370
6513
|
if (i > -1) {
|
|
6371
6514
|
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
@@ -6377,7 +6520,7 @@ ${p}` : p;
|
|
|
6377
6520
|
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
6378
6521
|
i && (s = i[1], r = i[3]);
|
|
6379
6522
|
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
6380
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), me(t, {
|
|
6523
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), me$1(t, {
|
|
6381
6524
|
href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
6382
6525
|
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
6383
6526
|
}, t[0], this.lexer, this.rules);
|
|
@@ -6395,7 +6538,7 @@ ${p}` : p;
|
|
|
6395
6538
|
text: i
|
|
6396
6539
|
};
|
|
6397
6540
|
}
|
|
6398
|
-
return me(n, r, n[0], this.lexer, this.rules);
|
|
6541
|
+
return me$1(n, r, n[0], this.lexer, this.rules);
|
|
6399
6542
|
}
|
|
6400
6543
|
}
|
|
6401
6544
|
emStrong(e, t, n = "") {
|
|
@@ -6530,29 +6673,29 @@ ${p}` : p;
|
|
|
6530
6673
|
}
|
|
6531
6674
|
}
|
|
6532
6675
|
};
|
|
6533
|
-
var x = class l {
|
|
6676
|
+
var x$1 = class l {
|
|
6534
6677
|
tokens;
|
|
6535
6678
|
options;
|
|
6536
6679
|
state;
|
|
6537
6680
|
inlineQueue;
|
|
6538
6681
|
tokenizer;
|
|
6539
6682
|
constructor(e) {
|
|
6540
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
6683
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T$1, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
6541
6684
|
inLink: !1,
|
|
6542
6685
|
inRawBlock: !1,
|
|
6543
6686
|
top: !0
|
|
6544
6687
|
};
|
|
6545
6688
|
let t = {
|
|
6546
6689
|
other: m,
|
|
6547
|
-
block: B.normal,
|
|
6548
|
-
inline: A.normal
|
|
6690
|
+
block: B$1.normal,
|
|
6691
|
+
inline: A$1.normal
|
|
6549
6692
|
};
|
|
6550
|
-
this.options.pedantic ? (t.block = B.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
|
|
6693
|
+
this.options.pedantic ? (t.block = B$1.pedantic, t.inline = A$1.pedantic) : this.options.gfm && (t.block = B$1.gfm, this.options.breaks ? t.inline = A$1.breaks : t.inline = A$1.gfm), this.tokenizer.rules = t;
|
|
6551
6694
|
}
|
|
6552
6695
|
static get rules() {
|
|
6553
6696
|
return {
|
|
6554
|
-
block: B,
|
|
6555
|
-
inline: A
|
|
6697
|
+
block: B$1,
|
|
6698
|
+
inline: A$1
|
|
6556
6699
|
};
|
|
6557
6700
|
}
|
|
6558
6701
|
static lex(e, t) {
|
|
@@ -6771,7 +6914,7 @@ var y = class {
|
|
|
6771
6914
|
options;
|
|
6772
6915
|
parser;
|
|
6773
6916
|
constructor(e) {
|
|
6774
|
-
this.options = e || T;
|
|
6917
|
+
this.options = e || T$1;
|
|
6775
6918
|
}
|
|
6776
6919
|
space(e) {
|
|
6777
6920
|
return "";
|
|
@@ -6779,8 +6922,8 @@ var y = class {
|
|
|
6779
6922
|
code({ text: e, lang: t, escaped: n }) {
|
|
6780
6923
|
let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
|
|
6781
6924
|
`;
|
|
6782
|
-
return s ? "<pre><code class=\"language-" + O(s) + "\">" + (n ? r : O(r, !0)) + `</code></pre>
|
|
6783
|
-
` : "<pre><code>" + (n ? r : O(r, !0)) + `</code></pre>
|
|
6925
|
+
return s ? "<pre><code class=\"language-" + O$1(s) + "\">" + (n ? r : O$1(r, !0)) + `</code></pre>
|
|
6926
|
+
` : "<pre><code>" + (n ? r : O$1(r, !0)) + `</code></pre>
|
|
6784
6927
|
`;
|
|
6785
6928
|
}
|
|
6786
6929
|
blockquote({ tokens: e }) {
|
|
@@ -6858,7 +7001,7 @@ ${e}</tr>
|
|
|
6858
7001
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
6859
7002
|
}
|
|
6860
7003
|
codespan({ text: e }) {
|
|
6861
|
-
return `<code>${O(e, !0)}</code>`;
|
|
7004
|
+
return `<code>${O$1(e, !0)}</code>`;
|
|
6862
7005
|
}
|
|
6863
7006
|
br(e) {
|
|
6864
7007
|
return "<br>";
|
|
@@ -6871,21 +7014,21 @@ ${e}</tr>
|
|
|
6871
7014
|
if (r === null) return s;
|
|
6872
7015
|
e = r;
|
|
6873
7016
|
let i = "<a href=\"" + e + "\"";
|
|
6874
|
-
return t && (i += " title=\"" + O(t) + "\""), i += ">" + s + "</a>", i;
|
|
7017
|
+
return t && (i += " title=\"" + O$1(t) + "\""), i += ">" + s + "</a>", i;
|
|
6875
7018
|
}
|
|
6876
7019
|
image({ href: e, title: t, text: n, tokens: s }) {
|
|
6877
7020
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
6878
7021
|
let r = J(e);
|
|
6879
|
-
if (r === null) return O(n);
|
|
7022
|
+
if (r === null) return O$1(n);
|
|
6880
7023
|
e = r;
|
|
6881
|
-
let i = `<img src="${e}" alt="${O(n)}"`;
|
|
6882
|
-
return t && (i += ` title="${O(t)}"`), i += ">", i;
|
|
7024
|
+
let i = `<img src="${e}" alt="${O$1(n)}"`;
|
|
7025
|
+
return t && (i += ` title="${O$1(t)}"`), i += ">", i;
|
|
6883
7026
|
}
|
|
6884
7027
|
text(e) {
|
|
6885
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
7028
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O$1(e.text);
|
|
6886
7029
|
}
|
|
6887
7030
|
};
|
|
6888
|
-
var L = class {
|
|
7031
|
+
var L$1 = class {
|
|
6889
7032
|
strong({ text: e }) {
|
|
6890
7033
|
return e;
|
|
6891
7034
|
}
|
|
@@ -6922,7 +7065,7 @@ var b = class l {
|
|
|
6922
7065
|
renderer;
|
|
6923
7066
|
textRenderer;
|
|
6924
7067
|
constructor(e) {
|
|
6925
|
-
this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
|
|
7068
|
+
this.options = e || T$1, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L$1();
|
|
6926
7069
|
}
|
|
6927
7070
|
static parse(e, t) {
|
|
6928
7071
|
return new l(t).parse(e);
|
|
@@ -7069,11 +7212,11 @@ var b = class l {
|
|
|
7069
7212
|
return n;
|
|
7070
7213
|
}
|
|
7071
7214
|
};
|
|
7072
|
-
var P = class {
|
|
7215
|
+
var P$1 = class {
|
|
7073
7216
|
options;
|
|
7074
7217
|
block;
|
|
7075
7218
|
constructor(e) {
|
|
7076
|
-
this.options = e || T;
|
|
7219
|
+
this.options = e || T$1;
|
|
7077
7220
|
}
|
|
7078
7221
|
static passThroughHooks = new Set([
|
|
7079
7222
|
"preprocess",
|
|
@@ -7099,23 +7242,23 @@ var P = class {
|
|
|
7099
7242
|
return e;
|
|
7100
7243
|
}
|
|
7101
7244
|
provideLexer(e = this.block) {
|
|
7102
|
-
return e ? x.lex : x.lexInline;
|
|
7245
|
+
return e ? x$1.lex : x$1.lexInline;
|
|
7103
7246
|
}
|
|
7104
7247
|
provideParser(e = this.block) {
|
|
7105
7248
|
return e ? b.parse : b.parseInline;
|
|
7106
7249
|
}
|
|
7107
7250
|
};
|
|
7108
|
-
var D = class {
|
|
7251
|
+
var D$1 = class {
|
|
7109
7252
|
defaults = z();
|
|
7110
7253
|
options = this.setOptions;
|
|
7111
7254
|
parse = this.parseMarkdown(!0);
|
|
7112
7255
|
parseInline = this.parseMarkdown(!1);
|
|
7113
7256
|
Parser = b;
|
|
7114
7257
|
Renderer = y;
|
|
7115
|
-
TextRenderer = L;
|
|
7116
|
-
Lexer = x;
|
|
7258
|
+
TextRenderer = L$1;
|
|
7259
|
+
Lexer = x$1;
|
|
7117
7260
|
Tokenizer = w;
|
|
7118
|
-
Hooks = P;
|
|
7261
|
+
Hooks = P$1;
|
|
7119
7262
|
constructor(...e) {
|
|
7120
7263
|
this.use(...e);
|
|
7121
7264
|
}
|
|
@@ -7196,13 +7339,13 @@ var D = class {
|
|
|
7196
7339
|
s.tokenizer = r;
|
|
7197
7340
|
}
|
|
7198
7341
|
if (n.hooks) {
|
|
7199
|
-
let r = this.defaults.hooks || new P();
|
|
7342
|
+
let r = this.defaults.hooks || new P$1();
|
|
7200
7343
|
for (let i in n.hooks) {
|
|
7201
7344
|
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
7202
7345
|
if (["options", "block"].includes(i)) continue;
|
|
7203
7346
|
let o = i, u = n.hooks[o], a = r[o];
|
|
7204
|
-
P.passThroughHooks.has(i) ? r[o] = (c) => {
|
|
7205
|
-
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
7347
|
+
P$1.passThroughHooks.has(i) ? r[o] = (c) => {
|
|
7348
|
+
if (this.defaults.async && P$1.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
7206
7349
|
let d = await u.call(r, c);
|
|
7207
7350
|
return a.call(r, d);
|
|
7208
7351
|
})();
|
|
@@ -7239,7 +7382,7 @@ var D = class {
|
|
|
7239
7382
|
}, this;
|
|
7240
7383
|
}
|
|
7241
7384
|
lexer(e, t) {
|
|
7242
|
-
return x.lex(e, t ?? this.defaults);
|
|
7385
|
+
return x$1.lex(e, t ?? this.defaults);
|
|
7243
7386
|
}
|
|
7244
7387
|
parser(e, t) {
|
|
7245
7388
|
return b.parse(e, t ?? this.defaults);
|
|
@@ -7254,14 +7397,14 @@ var D = class {
|
|
|
7254
7397
|
if (typeof n > "u" || n === null) return o(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
|
|
7255
7398
|
if (typeof n != "string") return o(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
7256
7399
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
7257
|
-
let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
|
|
7400
|
+
let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x$1.lex : x$1.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
|
|
7258
7401
|
i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens));
|
|
7259
7402
|
let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i);
|
|
7260
7403
|
return i.hooks ? await i.hooks.postprocess(h) : h;
|
|
7261
7404
|
})().catch(o);
|
|
7262
7405
|
try {
|
|
7263
7406
|
i.hooks && (n = i.hooks.preprocess(n));
|
|
7264
|
-
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
|
|
7407
|
+
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x$1.lex : x$1.lexInline)(n, i);
|
|
7265
7408
|
i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
|
|
7266
7409
|
let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
|
|
7267
7410
|
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
@@ -7274,7 +7417,7 @@ var D = class {
|
|
|
7274
7417
|
return (n) => {
|
|
7275
7418
|
if (n.message += `
|
|
7276
7419
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
7277
|
-
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", !0) + "</pre>";
|
|
7420
|
+
let s = "<p>An error occurred:</p><pre>" + O$1(n.message + "", !0) + "</pre>";
|
|
7278
7421
|
return t ? Promise.resolve(s) : s;
|
|
7279
7422
|
}
|
|
7280
7423
|
if (t) return Promise.reject(n);
|
|
@@ -7282,30 +7425,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
7282
7425
|
};
|
|
7283
7426
|
}
|
|
7284
7427
|
};
|
|
7285
|
-
var M = new D();
|
|
7428
|
+
var M$1 = new D$1();
|
|
7286
7429
|
function g(l, e) {
|
|
7287
|
-
return M.parse(l, e);
|
|
7430
|
+
return M$1.parse(l, e);
|
|
7288
7431
|
}
|
|
7289
7432
|
g.options = g.setOptions = function(l) {
|
|
7290
|
-
return M.setOptions(l), g.defaults = M.defaults, G(g.defaults), g;
|
|
7433
|
+
return M$1.setOptions(l), g.defaults = M$1.defaults, G$1(g.defaults), g;
|
|
7291
7434
|
};
|
|
7292
7435
|
g.getDefaults = z;
|
|
7293
|
-
g.defaults = T;
|
|
7436
|
+
g.defaults = T$1;
|
|
7294
7437
|
g.use = function(...l) {
|
|
7295
|
-
return M.use(...l), g.defaults = M.defaults, G(g.defaults), g;
|
|
7438
|
+
return M$1.use(...l), g.defaults = M$1.defaults, G$1(g.defaults), g;
|
|
7296
7439
|
};
|
|
7297
7440
|
g.walkTokens = function(l, e) {
|
|
7298
|
-
return M.walkTokens(l, e);
|
|
7441
|
+
return M$1.walkTokens(l, e);
|
|
7299
7442
|
};
|
|
7300
|
-
g.parseInline = M.parseInline;
|
|
7443
|
+
g.parseInline = M$1.parseInline;
|
|
7301
7444
|
g.Parser = b;
|
|
7302
7445
|
g.parser = b.parse;
|
|
7303
7446
|
g.Renderer = y;
|
|
7304
|
-
g.TextRenderer = L;
|
|
7305
|
-
g.Lexer = x;
|
|
7306
|
-
g.lexer = x.lex;
|
|
7447
|
+
g.TextRenderer = L$1;
|
|
7448
|
+
g.Lexer = x$1;
|
|
7449
|
+
g.lexer = x$1.lex;
|
|
7307
7450
|
g.Tokenizer = w;
|
|
7308
|
-
g.Hooks = P;
|
|
7451
|
+
g.Hooks = P$1;
|
|
7309
7452
|
g.parse = g;
|
|
7310
7453
|
g.options;
|
|
7311
7454
|
g.setOptions;
|
|
@@ -7313,7 +7456,7 @@ g.use;
|
|
|
7313
7456
|
g.walkTokens;
|
|
7314
7457
|
g.parseInline;
|
|
7315
7458
|
b.parse;
|
|
7316
|
-
x.lex;
|
|
7459
|
+
x$1.lex;
|
|
7317
7460
|
//#endregion
|
|
7318
7461
|
//#region ../../node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.js
|
|
7319
7462
|
var require_decode_codepoint$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -23446,22 +23589,40 @@ async function createGitHubClient() {
|
|
|
23446
23589
|
//#endregion
|
|
23447
23590
|
//#region ../github/src/api/checkout-target.ts
|
|
23448
23591
|
async function listGitHubCheckoutTargets$1(owner, repo, options = {}) {
|
|
23449
|
-
const
|
|
23592
|
+
const github = await createGitHubClient();
|
|
23593
|
+
const perPage = options.limit ?? 30;
|
|
23594
|
+
const [{ data: issues }, { data: pullRequests }] = await Promise.all([github.issues.listForRepo({
|
|
23595
|
+
owner,
|
|
23596
|
+
repo,
|
|
23597
|
+
state: "open",
|
|
23598
|
+
sort: "updated",
|
|
23599
|
+
direction: "desc",
|
|
23600
|
+
per_page: perPage
|
|
23601
|
+
}), github.pulls.list({
|
|
23450
23602
|
owner,
|
|
23451
23603
|
repo,
|
|
23452
23604
|
state: "open",
|
|
23453
23605
|
sort: "updated",
|
|
23454
23606
|
direction: "desc",
|
|
23455
|
-
per_page:
|
|
23607
|
+
per_page: perPage
|
|
23608
|
+
}).catch(() => ({ data: [] }))]);
|
|
23609
|
+
const pullRequestByNumber = new Map(pullRequests.map((pullRequest) => [pullRequest.number, pullRequest]));
|
|
23610
|
+
return issues.map((item) => {
|
|
23611
|
+
const pullRequest = item.pull_request ? pullRequestByNumber.get(item.number) : void 0;
|
|
23612
|
+
return {
|
|
23613
|
+
author: item.user?.login ?? null,
|
|
23614
|
+
...pullRequest ? {
|
|
23615
|
+
baseRepoFullName: pullRequest.base.repo.full_name,
|
|
23616
|
+
headRef: pullRequest.head.ref,
|
|
23617
|
+
headRepoFullName: pullRequest.head.repo?.full_name
|
|
23618
|
+
} : {},
|
|
23619
|
+
htmlUrl: item.html_url,
|
|
23620
|
+
kind: item.pull_request ? "pullRequest" : "issue",
|
|
23621
|
+
number: item.number,
|
|
23622
|
+
title: item.title,
|
|
23623
|
+
updatedAt: item.updated_at
|
|
23624
|
+
};
|
|
23456
23625
|
});
|
|
23457
|
-
return data.map((item) => ({
|
|
23458
|
-
author: item.user?.login ?? null,
|
|
23459
|
-
htmlUrl: item.html_url,
|
|
23460
|
-
kind: item.pull_request ? "pullRequest" : "issue",
|
|
23461
|
-
number: item.number,
|
|
23462
|
-
title: item.title,
|
|
23463
|
-
updatedAt: item.updated_at
|
|
23464
|
-
}));
|
|
23465
23626
|
}
|
|
23466
23627
|
//#endregion
|
|
23467
23628
|
//#region ../github/src/api/pull-request.ts
|
|
@@ -23668,63 +23829,3229 @@ async function runWorktreeAction(options) {
|
|
|
23668
23829
|
return ok({});
|
|
23669
23830
|
}
|
|
23670
23831
|
//#endregion
|
|
23671
|
-
//#region
|
|
23672
|
-
var
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23676
|
-
|
|
23677
|
-
|
|
23832
|
+
//#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
|
|
23833
|
+
var Gt = (n, t, e) => {
|
|
23834
|
+
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
23835
|
+
return r && {
|
|
23836
|
+
start: r[0],
|
|
23837
|
+
end: r[1],
|
|
23838
|
+
pre: e.slice(0, r[0]),
|
|
23839
|
+
body: e.slice(r[0] + s.length, r[1]),
|
|
23840
|
+
post: e.slice(r[1] + i.length)
|
|
23841
|
+
};
|
|
23842
|
+
}, ce = (n, t) => {
|
|
23843
|
+
let e = t.match(n);
|
|
23844
|
+
return e ? e[0] : null;
|
|
23845
|
+
}, ss = (n, t, e) => {
|
|
23846
|
+
let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
|
|
23847
|
+
if (a >= 0 && l > 0) {
|
|
23848
|
+
if (n === t) return [a, l];
|
|
23849
|
+
for (s = [], r = e.length; u >= 0 && !h;) {
|
|
23850
|
+
if (u === a) s.push(u), a = e.indexOf(n, u + 1);
|
|
23851
|
+
else if (s.length === 1) {
|
|
23852
|
+
let c = s.pop();
|
|
23853
|
+
c !== void 0 && (h = [c, l]);
|
|
23854
|
+
} else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
|
|
23855
|
+
u = a < l && a >= 0 ? a : l;
|
|
23856
|
+
}
|
|
23857
|
+
s.length && o !== void 0 && (h = [r, o]);
|
|
23858
|
+
}
|
|
23859
|
+
return h;
|
|
23860
|
+
};
|
|
23861
|
+
var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs$1 = /\\,/g, us = /\\./g, ds = 1e5;
|
|
23862
|
+
function Ht(n) {
|
|
23863
|
+
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
23864
|
+
}
|
|
23865
|
+
function ps(n) {
|
|
23866
|
+
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$1, de).replace(us, pe);
|
|
23867
|
+
}
|
|
23868
|
+
function ms(n) {
|
|
23869
|
+
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
|
|
23870
|
+
}
|
|
23871
|
+
function me(n) {
|
|
23872
|
+
if (!n) return [""];
|
|
23873
|
+
let t = [], e = Gt("{", "}", n);
|
|
23874
|
+
if (!e) return n.split(",");
|
|
23875
|
+
let { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
23876
|
+
o[o.length - 1] += "{" + i + "}";
|
|
23877
|
+
let h = me(r);
|
|
23878
|
+
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
23879
|
+
}
|
|
23880
|
+
function ge(n, t = {}) {
|
|
23881
|
+
if (!n) return [];
|
|
23882
|
+
let { max: e = ds } = t;
|
|
23883
|
+
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
|
|
23884
|
+
}
|
|
23885
|
+
function gs(n) {
|
|
23886
|
+
return "{" + n + "}";
|
|
23887
|
+
}
|
|
23888
|
+
function ws(n) {
|
|
23889
|
+
return /^-?0\d/.test(n);
|
|
23890
|
+
}
|
|
23891
|
+
function ys(n, t) {
|
|
23892
|
+
return n <= t;
|
|
23893
|
+
}
|
|
23894
|
+
function bs(n, t) {
|
|
23895
|
+
return n >= t;
|
|
23896
|
+
}
|
|
23897
|
+
function ht(n, t, e) {
|
|
23898
|
+
let s = [], i = Gt("{", "}", n);
|
|
23899
|
+
if (!i) return [n];
|
|
23900
|
+
let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
|
|
23901
|
+
if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
|
|
23902
|
+
let a = r + "{" + i.body + "}" + o[h];
|
|
23903
|
+
s.push(a);
|
|
23904
|
+
}
|
|
23905
|
+
else {
|
|
23906
|
+
let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
|
|
23907
|
+
if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
|
|
23908
|
+
let c;
|
|
23909
|
+
if (l) c = i.body.split(/\.\./);
|
|
23910
|
+
else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
|
|
23911
|
+
let d;
|
|
23912
|
+
if (l && c[0] !== void 0 && c[1] !== void 0) {
|
|
23913
|
+
let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
|
|
23914
|
+
m < f && (w *= -1, g = bs);
|
|
23915
|
+
let E = c.some(ws);
|
|
23916
|
+
d = [];
|
|
23917
|
+
for (let y = f; g(y, m); y += w) {
|
|
23918
|
+
let b;
|
|
23919
|
+
if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
|
|
23920
|
+
else if (b = String(y), E) {
|
|
23921
|
+
let z = p - b.length;
|
|
23922
|
+
if (z > 0) {
|
|
23923
|
+
let $ = new Array(z + 1).join("0");
|
|
23924
|
+
y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
|
|
23925
|
+
}
|
|
23926
|
+
}
|
|
23927
|
+
d.push(b);
|
|
23928
|
+
}
|
|
23929
|
+
} else {
|
|
23930
|
+
d = [];
|
|
23931
|
+
for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
|
|
23932
|
+
}
|
|
23933
|
+
for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
|
|
23934
|
+
let p = r + d[f] + o[m];
|
|
23935
|
+
(!e || l || p) && s.push(p);
|
|
23936
|
+
}
|
|
23678
23937
|
}
|
|
23938
|
+
return s;
|
|
23939
|
+
}
|
|
23940
|
+
var at = (n) => {
|
|
23941
|
+
if (typeof n != "string") throw new TypeError("invalid pattern");
|
|
23942
|
+
if (n.length > 65536) throw new TypeError("pattern is too long");
|
|
23679
23943
|
};
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23944
|
+
var Ss = {
|
|
23945
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
23946
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
23947
|
+
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
23948
|
+
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
23949
|
+
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
23950
|
+
"[:digit:]": ["\\p{Nd}", !0],
|
|
23951
|
+
"[:graph:]": [
|
|
23952
|
+
"\\p{Z}\\p{C}",
|
|
23953
|
+
!0,
|
|
23954
|
+
!0
|
|
23955
|
+
],
|
|
23956
|
+
"[:lower:]": ["\\p{Ll}", !0],
|
|
23957
|
+
"[:print:]": ["\\p{C}", !0],
|
|
23958
|
+
"[:punct:]": ["\\p{P}", !0],
|
|
23959
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
23960
|
+
"[:upper:]": ["\\p{Lu}", !0],
|
|
23961
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
23962
|
+
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
23963
|
+
}, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
|
|
23964
|
+
let e = t;
|
|
23965
|
+
if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
|
|
23966
|
+
let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
|
|
23967
|
+
t: for (; r < n.length;) {
|
|
23968
|
+
let p = n.charAt(r);
|
|
23969
|
+
if ((p === "!" || p === "^") && r === e + 1) {
|
|
23970
|
+
l = !0, r++;
|
|
23971
|
+
continue;
|
|
23972
|
+
}
|
|
23973
|
+
if (p === "]" && o && !a) {
|
|
23974
|
+
u = r + 1;
|
|
23975
|
+
break;
|
|
23976
|
+
}
|
|
23977
|
+
if (o = !0, p === "\\" && !a) {
|
|
23978
|
+
a = !0, r++;
|
|
23979
|
+
continue;
|
|
23980
|
+
}
|
|
23981
|
+
if (p === "[" && !a) {
|
|
23982
|
+
for (let [w, [g, S, E]] of Object.entries(Ss)) if (n.startsWith(w, r)) {
|
|
23983
|
+
if (c) return [
|
|
23984
|
+
"$.",
|
|
23985
|
+
!1,
|
|
23986
|
+
n.length - e,
|
|
23987
|
+
!0
|
|
23988
|
+
];
|
|
23989
|
+
r += w.length, E ? i.push(g) : s.push(g), h = h || S;
|
|
23990
|
+
continue t;
|
|
23991
|
+
}
|
|
23992
|
+
}
|
|
23993
|
+
if (a = !1, c) {
|
|
23994
|
+
p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
|
|
23995
|
+
continue;
|
|
23996
|
+
}
|
|
23997
|
+
if (n.startsWith("-]", r + 1)) {
|
|
23998
|
+
s.push(lt(p + "-")), r += 2;
|
|
23999
|
+
continue;
|
|
24000
|
+
}
|
|
24001
|
+
if (n.startsWith("-", r + 1)) {
|
|
24002
|
+
c = p, r += 2;
|
|
24003
|
+
continue;
|
|
24004
|
+
}
|
|
24005
|
+
s.push(lt(p)), r++;
|
|
24006
|
+
}
|
|
24007
|
+
if (u < r) return [
|
|
24008
|
+
"",
|
|
24009
|
+
!1,
|
|
24010
|
+
0,
|
|
24011
|
+
!1
|
|
24012
|
+
];
|
|
24013
|
+
if (!s.length && !i.length) return [
|
|
24014
|
+
"$.",
|
|
24015
|
+
!1,
|
|
24016
|
+
n.length - e,
|
|
24017
|
+
!0
|
|
24018
|
+
];
|
|
24019
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) return [
|
|
24020
|
+
Es(s[0].length === 2 ? s[0].slice(-1) : s[0]),
|
|
24021
|
+
!1,
|
|
24022
|
+
u - e,
|
|
24023
|
+
!1
|
|
24024
|
+
];
|
|
24025
|
+
let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
|
|
24026
|
+
return [
|
|
24027
|
+
s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f,
|
|
24028
|
+
h,
|
|
24029
|
+
u - e,
|
|
24030
|
+
!0
|
|
24031
|
+
];
|
|
24032
|
+
};
|
|
24033
|
+
var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
24034
|
+
var xs = new Set([
|
|
24035
|
+
"!",
|
|
24036
|
+
"?",
|
|
24037
|
+
"+",
|
|
24038
|
+
"*",
|
|
24039
|
+
"@"
|
|
24040
|
+
]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
|
|
24041
|
+
type;
|
|
24042
|
+
#t;
|
|
24043
|
+
#s;
|
|
24044
|
+
#n = !1;
|
|
24045
|
+
#r = [];
|
|
24046
|
+
#o;
|
|
24047
|
+
#S;
|
|
24048
|
+
#w;
|
|
24049
|
+
#c = !1;
|
|
24050
|
+
#h;
|
|
24051
|
+
#u;
|
|
24052
|
+
#f = !1;
|
|
24053
|
+
constructor(t, e, s = {}) {
|
|
24054
|
+
this.type = t, t && (this.#s = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
|
|
24055
|
+
}
|
|
24056
|
+
get hasMagic() {
|
|
24057
|
+
if (this.#s !== void 0) return this.#s;
|
|
24058
|
+
for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = !0;
|
|
24059
|
+
return this.#s;
|
|
24060
|
+
}
|
|
24061
|
+
toString() {
|
|
24062
|
+
return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
|
|
24063
|
+
}
|
|
24064
|
+
#a() {
|
|
24065
|
+
if (this !== this.#t) throw new Error("should only call on root");
|
|
24066
|
+
if (this.#c) return this;
|
|
24067
|
+
this.toString(), this.#c = !0;
|
|
24068
|
+
let t;
|
|
24069
|
+
for (; t = this.#w.pop();) {
|
|
24070
|
+
if (t.type !== "!") continue;
|
|
24071
|
+
let e = t, s = e.#o;
|
|
24072
|
+
for (; s;) {
|
|
24073
|
+
for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
|
|
24074
|
+
if (typeof r == "string") throw new Error("string part in extglob AST??");
|
|
24075
|
+
r.copyIn(s.#r[i]);
|
|
24076
|
+
}
|
|
24077
|
+
e = s, s = e.#o;
|
|
24078
|
+
}
|
|
24079
|
+
}
|
|
24080
|
+
return this;
|
|
24081
|
+
}
|
|
24082
|
+
push(...t) {
|
|
24083
|
+
for (let e of t) if (e !== "") {
|
|
24084
|
+
if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
|
|
24085
|
+
this.#r.push(e);
|
|
24086
|
+
}
|
|
24087
|
+
}
|
|
24088
|
+
toJSON() {
|
|
24089
|
+
let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
24090
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
|
|
24091
|
+
}
|
|
24092
|
+
isStart() {
|
|
24093
|
+
if (this.#t === this) return !0;
|
|
24094
|
+
if (!this.#o?.isStart()) return !1;
|
|
24095
|
+
if (this.#S === 0) return !0;
|
|
24096
|
+
let t = this.#o;
|
|
24097
|
+
for (let e = 0; e < this.#S; e++) {
|
|
24098
|
+
let s = t.#r[e];
|
|
24099
|
+
if (!(s instanceof n && s.type === "!")) return !1;
|
|
24100
|
+
}
|
|
24101
|
+
return !0;
|
|
24102
|
+
}
|
|
24103
|
+
isEnd() {
|
|
24104
|
+
if (this.#t === this || this.#o?.type === "!") return !0;
|
|
24105
|
+
if (!this.#o?.isEnd()) return !1;
|
|
24106
|
+
if (!this.type) return this.#o?.isEnd();
|
|
24107
|
+
let t = this.#o ? this.#o.#r.length : 0;
|
|
24108
|
+
return this.#S === t - 1;
|
|
24109
|
+
}
|
|
24110
|
+
copyIn(t) {
|
|
24111
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
24112
|
+
}
|
|
24113
|
+
clone(t) {
|
|
24114
|
+
let e = new n(this.type, t);
|
|
24115
|
+
for (let s of this.#r) e.copyIn(s);
|
|
24116
|
+
return e;
|
|
24117
|
+
}
|
|
24118
|
+
static #i(t, e, s, i) {
|
|
24119
|
+
let r = !1, o = !1, h = -1, a = !1;
|
|
24120
|
+
if (e.type === null) {
|
|
24121
|
+
let f = s, m = "";
|
|
24122
|
+
for (; f < t.length;) {
|
|
24123
|
+
let p = t.charAt(f++);
|
|
24124
|
+
if (r || p === "\\") {
|
|
24125
|
+
r = !r, m += p;
|
|
24126
|
+
continue;
|
|
24127
|
+
}
|
|
24128
|
+
if (o) {
|
|
24129
|
+
f === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === h + 2 && a) && (o = !1), m += p;
|
|
24130
|
+
continue;
|
|
24131
|
+
} else if (p === "[") {
|
|
24132
|
+
o = !0, h = f, a = !1, m += p;
|
|
24133
|
+
continue;
|
|
24134
|
+
}
|
|
24135
|
+
if (!i.noext && be(p) && t.charAt(f) === "(") {
|
|
24136
|
+
e.push(m), m = "";
|
|
24137
|
+
let w = new n(p, e);
|
|
24138
|
+
f = n.#i(t, w, f, i), e.push(w);
|
|
24139
|
+
continue;
|
|
24140
|
+
}
|
|
24141
|
+
m += p;
|
|
24142
|
+
}
|
|
24143
|
+
return e.push(m), f;
|
|
24144
|
+
}
|
|
24145
|
+
let l = s + 1, u = new n(null, e), c = [], d = "";
|
|
24146
|
+
for (; l < t.length;) {
|
|
24147
|
+
let f = t.charAt(l++);
|
|
24148
|
+
if (r || f === "\\") {
|
|
24149
|
+
r = !r, d += f;
|
|
23689
24150
|
continue;
|
|
23690
24151
|
}
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
24152
|
+
if (o) {
|
|
24153
|
+
l === h + 1 ? (f === "^" || f === "!") && (a = !0) : f === "]" && !(l === h + 2 && a) && (o = !1), d += f;
|
|
24154
|
+
continue;
|
|
24155
|
+
} else if (f === "[") {
|
|
24156
|
+
o = !0, h = l, a = !1, d += f;
|
|
24157
|
+
continue;
|
|
24158
|
+
}
|
|
24159
|
+
if (be(f) && t.charAt(l) === "(") {
|
|
24160
|
+
u.push(d), d = "";
|
|
24161
|
+
let m = new n(f, u);
|
|
24162
|
+
u.push(m), l = n.#i(t, m, l, i);
|
|
24163
|
+
continue;
|
|
24164
|
+
}
|
|
24165
|
+
if (f === "|") {
|
|
24166
|
+
u.push(d), d = "", c.push(u), u = new n(null, e);
|
|
24167
|
+
continue;
|
|
24168
|
+
}
|
|
24169
|
+
if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = !0), u.push(d), d = "", e.push(...c, u), l;
|
|
24170
|
+
d += f;
|
|
23697
24171
|
}
|
|
24172
|
+
return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
|
|
23698
24173
|
}
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
24174
|
+
static fromGlob(t, e = {}) {
|
|
24175
|
+
let s = new n(null, void 0, e);
|
|
24176
|
+
return n.#i(t, s, 0, e), s;
|
|
24177
|
+
}
|
|
24178
|
+
toMMPattern() {
|
|
24179
|
+
if (this !== this.#t) return this.#t.toMMPattern();
|
|
24180
|
+
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
24181
|
+
if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
|
|
24182
|
+
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
24183
|
+
return Object.assign(new RegExp(`^${e}$`, h), {
|
|
24184
|
+
_src: e,
|
|
24185
|
+
_glob: t
|
|
24186
|
+
});
|
|
24187
|
+
}
|
|
24188
|
+
get options() {
|
|
24189
|
+
return this.#h;
|
|
24190
|
+
}
|
|
24191
|
+
toRegExpSource(t) {
|
|
24192
|
+
let e = t ?? !!this.#h.dot;
|
|
24193
|
+
if (this.#t === this && this.#a(), !this.type) {
|
|
24194
|
+
let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
|
|
24195
|
+
let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
|
|
24196
|
+
return this.#s = this.#s || w, this.#n = this.#n || g, m;
|
|
24197
|
+
}).join(""), u = "";
|
|
24198
|
+
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
|
|
24199
|
+
let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
|
|
24200
|
+
u = p ? vs : w ? Ct : "";
|
|
24201
|
+
}
|
|
24202
|
+
let c = "";
|
|
24203
|
+
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
|
|
24204
|
+
u + l + c,
|
|
24205
|
+
W(l),
|
|
24206
|
+
this.#s = !!this.#s,
|
|
24207
|
+
this.#n
|
|
24208
|
+
];
|
|
24209
|
+
}
|
|
24210
|
+
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
24211
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
24212
|
+
let a = this.toString();
|
|
24213
|
+
return this.#r = [a], this.type = null, this.#s = void 0, [
|
|
24214
|
+
a,
|
|
24215
|
+
W(this.toString()),
|
|
24216
|
+
!1,
|
|
24217
|
+
!1
|
|
24218
|
+
];
|
|
24219
|
+
}
|
|
24220
|
+
let o = !s || t || e || !Ct ? "" : this.#d(!0);
|
|
24221
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
24222
|
+
let h = "";
|
|
24223
|
+
if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
|
|
24224
|
+
else {
|
|
24225
|
+
let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
24226
|
+
h = i + r + a;
|
|
24227
|
+
}
|
|
24228
|
+
return [
|
|
24229
|
+
h,
|
|
24230
|
+
W(r),
|
|
24231
|
+
this.#s = !!this.#s,
|
|
24232
|
+
this.#n
|
|
24233
|
+
];
|
|
24234
|
+
}
|
|
24235
|
+
#d(t) {
|
|
24236
|
+
return this.#r.map((e) => {
|
|
24237
|
+
if (typeof e == "string") throw new Error("string type in extglob ast??");
|
|
24238
|
+
let [s, i, r, o] = e.toRegExpSource(t);
|
|
24239
|
+
return this.#n = this.#n || o, s;
|
|
24240
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
24241
|
+
}
|
|
24242
|
+
static #E(t, e, s = !1) {
|
|
24243
|
+
let i = !1, r = "", o = !1, h = !1;
|
|
24244
|
+
for (let a = 0; a < t.length; a++) {
|
|
24245
|
+
let l = t.charAt(a);
|
|
24246
|
+
if (i) {
|
|
24247
|
+
i = !1, r += (As.has(l) ? "\\" : "") + l;
|
|
24248
|
+
continue;
|
|
24249
|
+
}
|
|
24250
|
+
if (l === "*") {
|
|
24251
|
+
if (h) continue;
|
|
24252
|
+
h = !0, r += s && /^[*]+$/.test(t) ? Ee : Se, e = !0;
|
|
24253
|
+
continue;
|
|
24254
|
+
} else h = !1;
|
|
24255
|
+
if (l === "\\") {
|
|
24256
|
+
a === t.length - 1 ? r += "\\\\" : i = !0;
|
|
24257
|
+
continue;
|
|
24258
|
+
}
|
|
24259
|
+
if (l === "[") {
|
|
24260
|
+
let [u, c, d, f] = ye(t, a);
|
|
24261
|
+
if (d) {
|
|
24262
|
+
r += u, o = o || c, a += d - 1, e = e || f;
|
|
24263
|
+
continue;
|
|
24264
|
+
}
|
|
24265
|
+
}
|
|
24266
|
+
if (l === "?") {
|
|
24267
|
+
r += Kt, e = !0;
|
|
24268
|
+
continue;
|
|
24269
|
+
}
|
|
24270
|
+
r += ks(l);
|
|
24271
|
+
}
|
|
24272
|
+
return [
|
|
24273
|
+
r,
|
|
24274
|
+
W(t),
|
|
24275
|
+
!!e,
|
|
24276
|
+
o
|
|
24277
|
+
];
|
|
24278
|
+
}
|
|
24279
|
+
};
|
|
24280
|
+
var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
|
|
24281
|
+
var O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n)), Rs = /^\*+([^+@!?\*\[\(]*)$/, Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fs = (n) => (t) => t.endsWith(n), Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ns = /^\*+\.\*+$/, _s = (n) => !n.startsWith(".") && n.includes("."), Ls = (n) => n !== "." && n !== ".." && n.includes("."), Ws = /^\.\*+$/, Ps = (n) => n !== "." && n !== ".." && n.startsWith("."), js = /^\*+$/, Is = (n) => n.length !== 0 && !n.startsWith("."), zs = (n) => n.length !== 0 && n !== "." && n !== "..", Bs = /^\?+([^+@!?\*\[\(]*)?$/, Us = ([n, t = ""]) => {
|
|
24282
|
+
let e = Ce([n]);
|
|
24283
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
24284
|
+
}, $s = ([n, t = ""]) => {
|
|
24285
|
+
let e = Te([n]);
|
|
24286
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
24287
|
+
}, Gs = ([n, t = ""]) => {
|
|
24288
|
+
let e = Te([n]);
|
|
24289
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
24290
|
+
}, Hs = ([n, t = ""]) => {
|
|
24291
|
+
let e = Ce([n]);
|
|
24292
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
24293
|
+
}, Ce = ([n]) => {
|
|
24294
|
+
let t = n.length;
|
|
24295
|
+
return (e) => e.length === t && !e.startsWith(".");
|
|
24296
|
+
}, Te = ([n]) => {
|
|
24297
|
+
let t = n.length;
|
|
24298
|
+
return (e) => e.length === t && e !== "." && e !== "..";
|
|
24299
|
+
}, Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", xe = {
|
|
24300
|
+
win32: { sep: "\\" },
|
|
24301
|
+
posix: { sep: "/" }
|
|
24302
|
+
};
|
|
24303
|
+
O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
24304
|
+
var A = Symbol("globstar **");
|
|
24305
|
+
O.GLOBSTAR = A;
|
|
24306
|
+
var Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O(e, n, t);
|
|
24307
|
+
O.filter = Js;
|
|
24308
|
+
var N = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
|
|
24309
|
+
if (!n || typeof n != "object" || !Object.keys(n).length) return O;
|
|
24310
|
+
let t = O;
|
|
24311
|
+
return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
|
|
24312
|
+
Minimatch: class extends t.Minimatch {
|
|
24313
|
+
constructor(i, r = {}) {
|
|
24314
|
+
super(i, N(n, r));
|
|
24315
|
+
}
|
|
24316
|
+
static defaults(i) {
|
|
24317
|
+
return t.defaults(N(n, i)).Minimatch;
|
|
24318
|
+
}
|
|
24319
|
+
},
|
|
24320
|
+
AST: class extends t.AST {
|
|
24321
|
+
constructor(i, r, o = {}) {
|
|
24322
|
+
super(i, r, N(n, o));
|
|
24323
|
+
}
|
|
24324
|
+
static fromGlob(i, r = {}) {
|
|
24325
|
+
return t.AST.fromGlob(i, N(n, r));
|
|
24326
|
+
}
|
|
24327
|
+
},
|
|
24328
|
+
unescape: (s, i = {}) => t.unescape(s, N(n, i)),
|
|
24329
|
+
escape: (s, i = {}) => t.escape(s, N(n, i)),
|
|
24330
|
+
filter: (s, i = {}) => t.filter(s, N(n, i)),
|
|
24331
|
+
defaults: (s) => t.defaults(N(n, s)),
|
|
24332
|
+
makeRe: (s, i = {}) => t.makeRe(s, N(n, i)),
|
|
24333
|
+
braceExpand: (s, i = {}) => t.braceExpand(s, N(n, i)),
|
|
24334
|
+
match: (s, i, r = {}) => t.match(s, i, N(n, r)),
|
|
24335
|
+
sep: t.sep,
|
|
24336
|
+
GLOBSTAR: A
|
|
23702
24337
|
});
|
|
23703
|
-
}
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
24338
|
+
};
|
|
24339
|
+
O.defaults = Zs;
|
|
24340
|
+
var ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
|
|
24341
|
+
O.braceExpand = ke;
|
|
24342
|
+
var Qs = (n, t = {}) => new D(n, t).makeRe();
|
|
24343
|
+
O.makeRe = Qs;
|
|
24344
|
+
var ti = (n, t, e = {}) => {
|
|
24345
|
+
let s = new D(t, e);
|
|
24346
|
+
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
24347
|
+
};
|
|
24348
|
+
O.match = ti;
|
|
24349
|
+
var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D = class {
|
|
24350
|
+
options;
|
|
24351
|
+
set;
|
|
24352
|
+
pattern;
|
|
24353
|
+
windowsPathsNoEscape;
|
|
24354
|
+
nonegate;
|
|
24355
|
+
negate;
|
|
24356
|
+
comment;
|
|
24357
|
+
empty;
|
|
24358
|
+
preserveMultipleSlashes;
|
|
24359
|
+
partial;
|
|
24360
|
+
globSet;
|
|
24361
|
+
globParts;
|
|
24362
|
+
nocase;
|
|
24363
|
+
isWindows;
|
|
24364
|
+
platform;
|
|
24365
|
+
windowsNoMagicRoot;
|
|
24366
|
+
regexp;
|
|
24367
|
+
constructor(t, e = {}) {
|
|
24368
|
+
at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
|
|
24369
|
+
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e["allowWindowsEscape"] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
|
|
24370
|
+
}
|
|
24371
|
+
hasMagic() {
|
|
24372
|
+
if (this.options.magicalBraces && this.set.length > 1) return !0;
|
|
24373
|
+
for (let t of this.set) for (let e of t) if (typeof e != "string") return !0;
|
|
24374
|
+
return !1;
|
|
24375
|
+
}
|
|
24376
|
+
debug(...t) {}
|
|
24377
|
+
make() {
|
|
24378
|
+
let t = this.pattern, e = this.options;
|
|
24379
|
+
if (!e.nocomment && t.charAt(0) === "#") {
|
|
24380
|
+
this.comment = !0;
|
|
24381
|
+
return;
|
|
24382
|
+
}
|
|
24383
|
+
if (!t) {
|
|
24384
|
+
this.empty = !0;
|
|
24385
|
+
return;
|
|
24386
|
+
}
|
|
24387
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
|
|
24388
|
+
let s = this.globSet.map((r) => this.slashSplit(r));
|
|
24389
|
+
this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
|
|
24390
|
+
let i = this.globParts.map((r, o, h) => {
|
|
24391
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
24392
|
+
let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
|
|
24393
|
+
if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
|
|
24394
|
+
if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
|
|
24395
|
+
}
|
|
24396
|
+
return r.map((a) => this.parse(a));
|
|
24397
|
+
});
|
|
24398
|
+
if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
|
|
24399
|
+
let o = this.set[r];
|
|
24400
|
+
o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
24401
|
+
}
|
|
24402
|
+
this.debug(this.pattern, this.set);
|
|
24403
|
+
}
|
|
24404
|
+
preprocess(t) {
|
|
24405
|
+
if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*");
|
|
24406
|
+
let { optimizationLevel: e = 1 } = this.options;
|
|
24407
|
+
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
|
|
24408
|
+
}
|
|
24409
|
+
adjascentGlobstarOptimize(t) {
|
|
24410
|
+
return t.map((e) => {
|
|
24411
|
+
let s = -1;
|
|
24412
|
+
for (; (s = e.indexOf("**", s + 1)) !== -1;) {
|
|
24413
|
+
let i = s;
|
|
24414
|
+
for (; e[i + 1] === "**";) i++;
|
|
24415
|
+
i !== s && e.splice(s, i - s);
|
|
24416
|
+
}
|
|
24417
|
+
return e;
|
|
24418
|
+
});
|
|
24419
|
+
}
|
|
24420
|
+
levelOneOptimize(t) {
|
|
24421
|
+
return t.map((e) => (e = e.reduce((s, i) => {
|
|
24422
|
+
let r = s[s.length - 1];
|
|
24423
|
+
return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
|
|
24424
|
+
}, []), e.length === 0 ? [""] : e));
|
|
24425
|
+
}
|
|
24426
|
+
levelTwoFileOptimize(t) {
|
|
24427
|
+
Array.isArray(t) || (t = this.slashSplit(t));
|
|
24428
|
+
let e = !1;
|
|
24429
|
+
do {
|
|
24430
|
+
if (e = !1, !this.preserveMultipleSlashes) {
|
|
24431
|
+
for (let i = 1; i < t.length - 1; i++) {
|
|
24432
|
+
let r = t[i];
|
|
24433
|
+
i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
|
|
24434
|
+
}
|
|
24435
|
+
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
|
|
24436
|
+
}
|
|
24437
|
+
let s = 0;
|
|
24438
|
+
for (; (s = t.indexOf("..", s + 1)) !== -1;) {
|
|
24439
|
+
let i = t[s - 1];
|
|
24440
|
+
i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
|
|
24441
|
+
}
|
|
24442
|
+
} while (e);
|
|
24443
|
+
return t.length === 0 ? [""] : t;
|
|
24444
|
+
}
|
|
24445
|
+
firstPhasePreProcess(t) {
|
|
24446
|
+
let e = !1;
|
|
24447
|
+
do {
|
|
24448
|
+
e = !1;
|
|
24449
|
+
for (let s of t) {
|
|
24450
|
+
let i = -1;
|
|
24451
|
+
for (; (i = s.indexOf("**", i + 1)) !== -1;) {
|
|
24452
|
+
let o = i;
|
|
24453
|
+
for (; s[o + 1] === "**";) o++;
|
|
24454
|
+
o > i && s.splice(i + 1, o - i);
|
|
24455
|
+
let h = s[i + 1], a = s[i + 2], l = s[i + 3];
|
|
24456
|
+
if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
|
|
24457
|
+
e = !0, s.splice(i, 1);
|
|
24458
|
+
let u = s.slice(0);
|
|
24459
|
+
u[i] = "**", t.push(u), i--;
|
|
24460
|
+
}
|
|
24461
|
+
if (!this.preserveMultipleSlashes) {
|
|
24462
|
+
for (let o = 1; o < s.length - 1; o++) {
|
|
24463
|
+
let h = s[o];
|
|
24464
|
+
o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(o, 1), o--);
|
|
24465
|
+
}
|
|
24466
|
+
s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
|
|
24467
|
+
}
|
|
24468
|
+
let r = 0;
|
|
24469
|
+
for (; (r = s.indexOf("..", r + 1)) !== -1;) {
|
|
24470
|
+
let o = s[r - 1];
|
|
24471
|
+
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
24472
|
+
e = !0;
|
|
24473
|
+
let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
|
|
24474
|
+
s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
|
|
24475
|
+
}
|
|
24476
|
+
}
|
|
24477
|
+
}
|
|
24478
|
+
} while (e);
|
|
24479
|
+
return t;
|
|
24480
|
+
}
|
|
24481
|
+
secondPhasePreProcess(t) {
|
|
24482
|
+
for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
|
|
24483
|
+
let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
24484
|
+
if (i) {
|
|
24485
|
+
t[e] = [], t[s] = i;
|
|
24486
|
+
break;
|
|
23712
24487
|
}
|
|
23713
24488
|
}
|
|
23714
|
-
return
|
|
24489
|
+
return t.filter((e) => e.length);
|
|
24490
|
+
}
|
|
24491
|
+
partsMatch(t, e, s = !1) {
|
|
24492
|
+
let i = 0, r = 0, o = [], h = "";
|
|
24493
|
+
for (; i < t.length && r < e.length;) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
|
|
24494
|
+
else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
|
|
24495
|
+
else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
|
|
24496
|
+
else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
24497
|
+
if (h === "b") return !1;
|
|
24498
|
+
h = "a", o.push(t[i]), i++, r++;
|
|
24499
|
+
} else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
24500
|
+
if (h === "a") return !1;
|
|
24501
|
+
h = "b", o.push(e[r]), i++, r++;
|
|
24502
|
+
} else return !1;
|
|
24503
|
+
return t.length === e.length && o;
|
|
24504
|
+
}
|
|
24505
|
+
parseNegate() {
|
|
24506
|
+
if (this.nonegate) return;
|
|
24507
|
+
let t = this.pattern, e = !1, s = 0;
|
|
24508
|
+
for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
|
|
24509
|
+
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
24510
|
+
}
|
|
24511
|
+
matchOne(t, e, s = !1) {
|
|
24512
|
+
let i = this.options;
|
|
24513
|
+
if (this.isWindows) {
|
|
24514
|
+
let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : void 0, y = S ? 3 : g ? 0 : void 0;
|
|
24515
|
+
if (typeof E == "number" && typeof y == "number") {
|
|
24516
|
+
let [b, z] = [t[E], e[y]];
|
|
24517
|
+
b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
|
|
24518
|
+
}
|
|
24519
|
+
}
|
|
24520
|
+
let { optimizationLevel: r = 1 } = this.options;
|
|
24521
|
+
r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, {
|
|
24522
|
+
file: t,
|
|
24523
|
+
pattern: e
|
|
24524
|
+
}), this.debug("matchOne", t.length, e.length);
|
|
24525
|
+
for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
|
|
24526
|
+
this.debug("matchOne loop");
|
|
24527
|
+
var u = e[h], c = t[o];
|
|
24528
|
+
if (this.debug(e, u, c), u === !1) return !1;
|
|
24529
|
+
if (u === A) {
|
|
24530
|
+
this.debug("GLOBSTAR", [
|
|
24531
|
+
e,
|
|
24532
|
+
u,
|
|
24533
|
+
c
|
|
24534
|
+
]);
|
|
24535
|
+
var d = o, f = h + 1;
|
|
24536
|
+
if (f === l) {
|
|
24537
|
+
for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return !1;
|
|
24538
|
+
return !0;
|
|
24539
|
+
}
|
|
24540
|
+
for (; d < a;) {
|
|
24541
|
+
var m = t[d];
|
|
24542
|
+
if (this.debug(`
|
|
24543
|
+
globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) return this.debug("globstar found match!", d, a, m), !0;
|
|
24544
|
+
if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
|
|
24545
|
+
this.debug("dot detected!", t, d, e, f);
|
|
24546
|
+
break;
|
|
24547
|
+
}
|
|
24548
|
+
this.debug("globstar swallow a segment, and continue"), d++;
|
|
24549
|
+
}
|
|
24550
|
+
return !!(s && (this.debug(`
|
|
24551
|
+
>>> no match, partial?`, t, d, e, f), d === a));
|
|
24552
|
+
}
|
|
24553
|
+
let p;
|
|
24554
|
+
if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p) return !1;
|
|
24555
|
+
}
|
|
24556
|
+
if (o === a && h === l) return !0;
|
|
24557
|
+
if (o === a) return s;
|
|
24558
|
+
if (h === l) return o === a - 1 && t[o] === "";
|
|
24559
|
+
throw new Error("wtf?");
|
|
24560
|
+
}
|
|
24561
|
+
braceExpand() {
|
|
24562
|
+
return ke(this.pattern, this.options);
|
|
24563
|
+
}
|
|
24564
|
+
parse(t) {
|
|
24565
|
+
at(t);
|
|
24566
|
+
let e = this.options;
|
|
24567
|
+
if (t === "**") return A;
|
|
24568
|
+
if (t === "") return "";
|
|
24569
|
+
let s, i = null;
|
|
24570
|
+
(s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
|
|
24571
|
+
let r = Q.fromGlob(t, this.options).toMMPattern();
|
|
24572
|
+
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
24573
|
+
}
|
|
24574
|
+
makeRe() {
|
|
24575
|
+
if (this.regexp || this.regexp === !1) return this.regexp;
|
|
24576
|
+
let t = this.set;
|
|
24577
|
+
if (!t.length) return this.regexp = !1, this.regexp;
|
|
24578
|
+
let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
|
|
24579
|
+
let l = a.map((c) => {
|
|
24580
|
+
if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
|
|
24581
|
+
return typeof c == "string" ? ei(c) : c === A ? A : c._src;
|
|
24582
|
+
});
|
|
24583
|
+
l.forEach((c, d) => {
|
|
24584
|
+
let f = l[d + 1], m = l[d - 1];
|
|
24585
|
+
c !== A || m === A || (m === void 0 ? f !== void 0 && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
|
|
24586
|
+
});
|
|
24587
|
+
let u = l.filter((c) => c !== A);
|
|
24588
|
+
if (this.partial && u.length >= 1) {
|
|
24589
|
+
let c = [];
|
|
24590
|
+
for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
|
|
24591
|
+
return "(?:" + c.join("|") + ")";
|
|
24592
|
+
}
|
|
24593
|
+
return u.join("/");
|
|
24594
|
+
}).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
24595
|
+
r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
|
|
24596
|
+
try {
|
|
24597
|
+
this.regexp = new RegExp(r, [...i].join(""));
|
|
24598
|
+
} catch {
|
|
24599
|
+
this.regexp = !1;
|
|
24600
|
+
}
|
|
24601
|
+
return this.regexp;
|
|
24602
|
+
}
|
|
24603
|
+
slashSplit(t) {
|
|
24604
|
+
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
24605
|
+
}
|
|
24606
|
+
match(t, e = this.partial) {
|
|
24607
|
+
if (this.debug("match", t, this.pattern), this.comment) return !1;
|
|
24608
|
+
if (this.empty) return t === "";
|
|
24609
|
+
if (t === "/" && e) return !0;
|
|
24610
|
+
let s = this.options;
|
|
24611
|
+
this.isWindows && (t = t.split("\\").join("/"));
|
|
24612
|
+
let i = this.slashSplit(t);
|
|
24613
|
+
this.debug(this.pattern, "split", i);
|
|
24614
|
+
let r = this.set;
|
|
24615
|
+
this.debug(this.pattern, "set", r);
|
|
24616
|
+
let o = i[i.length - 1];
|
|
24617
|
+
if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
|
|
24618
|
+
for (let h = 0; h < r.length; h++) {
|
|
24619
|
+
let a = r[h], l = i;
|
|
24620
|
+
if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? !0 : !this.negate;
|
|
24621
|
+
}
|
|
24622
|
+
return s.flipNegate ? !1 : this.negate;
|
|
24623
|
+
}
|
|
24624
|
+
static defaults(t) {
|
|
24625
|
+
return O.defaults(t).Minimatch;
|
|
24626
|
+
}
|
|
24627
|
+
};
|
|
24628
|
+
O.AST = Q;
|
|
24629
|
+
O.Minimatch = D;
|
|
24630
|
+
O.escape = tt;
|
|
24631
|
+
O.unescape = W;
|
|
24632
|
+
var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Oe = /* @__PURE__ */ new Set(), Vt = typeof process == "object" && process ? process : {}, Fe = (n, t, e, s) => {
|
|
24633
|
+
typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
|
|
24634
|
+
}, At = globalThis.AbortController, Re = globalThis.AbortSignal;
|
|
24635
|
+
if (typeof At > "u") {
|
|
24636
|
+
Re = class {
|
|
24637
|
+
onabort;
|
|
24638
|
+
_onabort = [];
|
|
24639
|
+
reason;
|
|
24640
|
+
aborted = !1;
|
|
24641
|
+
addEventListener(e, s) {
|
|
24642
|
+
this._onabort.push(s);
|
|
24643
|
+
}
|
|
24644
|
+
}, At = class {
|
|
24645
|
+
constructor() {
|
|
24646
|
+
t();
|
|
24647
|
+
}
|
|
24648
|
+
signal = new Re();
|
|
24649
|
+
abort(e) {
|
|
24650
|
+
if (!this.signal.aborted) {
|
|
24651
|
+
this.signal.reason = e, this.signal.aborted = !0;
|
|
24652
|
+
for (let s of this.signal._onabort) s(e);
|
|
24653
|
+
this.signal.onabort?.(e);
|
|
24654
|
+
}
|
|
24655
|
+
}
|
|
24656
|
+
};
|
|
24657
|
+
let n = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
24658
|
+
n && (n = !1, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
24659
|
+
};
|
|
24660
|
+
}
|
|
24661
|
+
var ii = (n) => !Oe.has(n);
|
|
24662
|
+
var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null, Tt = class extends Array {
|
|
24663
|
+
constructor(n) {
|
|
24664
|
+
super(n), this.fill(0);
|
|
24665
|
+
}
|
|
24666
|
+
}, ri = class ct {
|
|
24667
|
+
heap;
|
|
24668
|
+
length;
|
|
24669
|
+
static #t = !1;
|
|
24670
|
+
static create(t) {
|
|
24671
|
+
let e = De(t);
|
|
24672
|
+
if (!e) return [];
|
|
24673
|
+
ct.#t = !0;
|
|
24674
|
+
let s = new ct(t, e);
|
|
24675
|
+
return ct.#t = !1, s;
|
|
24676
|
+
}
|
|
24677
|
+
constructor(t, e) {
|
|
24678
|
+
if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
24679
|
+
this.heap = new e(t), this.length = 0;
|
|
24680
|
+
}
|
|
24681
|
+
push(t) {
|
|
24682
|
+
this.heap[this.length++] = t;
|
|
24683
|
+
}
|
|
24684
|
+
pop() {
|
|
24685
|
+
return this.heap[--this.length];
|
|
24686
|
+
}
|
|
24687
|
+
}, ft = class Me {
|
|
24688
|
+
#t;
|
|
24689
|
+
#s;
|
|
24690
|
+
#n;
|
|
24691
|
+
#r;
|
|
24692
|
+
#o;
|
|
24693
|
+
#S;
|
|
24694
|
+
#w;
|
|
24695
|
+
#c;
|
|
24696
|
+
get perf() {
|
|
24697
|
+
return this.#c;
|
|
24698
|
+
}
|
|
24699
|
+
ttl;
|
|
24700
|
+
ttlResolution;
|
|
24701
|
+
ttlAutopurge;
|
|
24702
|
+
updateAgeOnGet;
|
|
24703
|
+
updateAgeOnHas;
|
|
24704
|
+
allowStale;
|
|
24705
|
+
noDisposeOnSet;
|
|
24706
|
+
noUpdateTTL;
|
|
24707
|
+
maxEntrySize;
|
|
24708
|
+
sizeCalculation;
|
|
24709
|
+
noDeleteOnFetchRejection;
|
|
24710
|
+
noDeleteOnStaleGet;
|
|
24711
|
+
allowStaleOnFetchAbort;
|
|
24712
|
+
allowStaleOnFetchRejection;
|
|
24713
|
+
ignoreFetchAbort;
|
|
24714
|
+
#h;
|
|
24715
|
+
#u;
|
|
24716
|
+
#f;
|
|
24717
|
+
#a;
|
|
24718
|
+
#i;
|
|
24719
|
+
#d;
|
|
24720
|
+
#E;
|
|
24721
|
+
#b;
|
|
24722
|
+
#p;
|
|
24723
|
+
#R;
|
|
24724
|
+
#m;
|
|
24725
|
+
#C;
|
|
24726
|
+
#T;
|
|
24727
|
+
#g;
|
|
24728
|
+
#y;
|
|
24729
|
+
#x;
|
|
24730
|
+
#A;
|
|
24731
|
+
#e;
|
|
24732
|
+
#_;
|
|
24733
|
+
static unsafeExposeInternals(t) {
|
|
24734
|
+
return {
|
|
24735
|
+
starts: t.#T,
|
|
24736
|
+
ttls: t.#g,
|
|
24737
|
+
autopurgeTimers: t.#y,
|
|
24738
|
+
sizes: t.#C,
|
|
24739
|
+
keyMap: t.#f,
|
|
24740
|
+
keyList: t.#a,
|
|
24741
|
+
valList: t.#i,
|
|
24742
|
+
next: t.#d,
|
|
24743
|
+
prev: t.#E,
|
|
24744
|
+
get head() {
|
|
24745
|
+
return t.#b;
|
|
24746
|
+
},
|
|
24747
|
+
get tail() {
|
|
24748
|
+
return t.#p;
|
|
24749
|
+
},
|
|
24750
|
+
free: t.#R,
|
|
24751
|
+
isBackgroundFetch: (e) => t.#l(e),
|
|
24752
|
+
backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r),
|
|
24753
|
+
moveToTail: (e) => t.#W(e),
|
|
24754
|
+
indexes: (e) => t.#F(e),
|
|
24755
|
+
rindexes: (e) => t.#D(e),
|
|
24756
|
+
isStale: (e) => t.#v(e)
|
|
24757
|
+
};
|
|
24758
|
+
}
|
|
24759
|
+
get max() {
|
|
24760
|
+
return this.#t;
|
|
24761
|
+
}
|
|
24762
|
+
get maxSize() {
|
|
24763
|
+
return this.#s;
|
|
24764
|
+
}
|
|
24765
|
+
get calculatedSize() {
|
|
24766
|
+
return this.#u;
|
|
24767
|
+
}
|
|
24768
|
+
get size() {
|
|
24769
|
+
return this.#h;
|
|
24770
|
+
}
|
|
24771
|
+
get fetchMethod() {
|
|
24772
|
+
return this.#S;
|
|
24773
|
+
}
|
|
24774
|
+
get memoMethod() {
|
|
24775
|
+
return this.#w;
|
|
24776
|
+
}
|
|
24777
|
+
get dispose() {
|
|
24778
|
+
return this.#n;
|
|
24779
|
+
}
|
|
24780
|
+
get onInsert() {
|
|
24781
|
+
return this.#r;
|
|
24782
|
+
}
|
|
24783
|
+
get disposeAfter() {
|
|
24784
|
+
return this.#o;
|
|
24785
|
+
}
|
|
24786
|
+
constructor(t) {
|
|
24787
|
+
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
|
|
24788
|
+
if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
24789
|
+
if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
24790
|
+
let Z = e ? De(e) : Array;
|
|
24791
|
+
if (!Z) throw new Error("invalid max value: " + e);
|
|
24792
|
+
if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
|
|
24793
|
+
if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
24794
|
+
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
24795
|
+
}
|
|
24796
|
+
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
24797
|
+
if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
24798
|
+
if (this.#S = g, this.#A = !!g, this.#f = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
|
|
24799
|
+
if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
24800
|
+
if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
24801
|
+
this.#G();
|
|
24802
|
+
}
|
|
24803
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
|
|
24804
|
+
if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
24805
|
+
this.#M();
|
|
24806
|
+
}
|
|
24807
|
+
if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
24808
|
+
if (!this.ttlAutopurge && !this.#t && !this.#s) {
|
|
24809
|
+
let $t = "LRU_CACHE_UNBOUNDED";
|
|
24810
|
+
ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
|
|
24811
|
+
}
|
|
24812
|
+
}
|
|
24813
|
+
getRemainingTTL(t) {
|
|
24814
|
+
return this.#f.has(t) ? Infinity : 0;
|
|
24815
|
+
}
|
|
24816
|
+
#M() {
|
|
24817
|
+
let t = new Tt(this.#t), e = new Tt(this.#t);
|
|
24818
|
+
this.#g = t, this.#T = e;
|
|
24819
|
+
let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
|
|
24820
|
+
this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
|
|
24821
|
+
if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
|
|
24822
|
+
let l = setTimeout(() => {
|
|
24823
|
+
this.#v(o) && this.#O(this.#a[o], "expire");
|
|
24824
|
+
}, h + 1);
|
|
24825
|
+
l.unref && l.unref(), s[o] = l;
|
|
24826
|
+
}
|
|
24827
|
+
}, this.#k = (o) => {
|
|
24828
|
+
e[o] = t[o] !== 0 ? this.#c.now() : 0;
|
|
24829
|
+
}, this.#N = (o, h) => {
|
|
24830
|
+
if (t[h]) {
|
|
24831
|
+
let a = t[h], l = e[h];
|
|
24832
|
+
if (!a || !l) return;
|
|
24833
|
+
o.ttl = a, o.start = l, o.now = i || r();
|
|
24834
|
+
o.remainingTTL = a - (o.now - l);
|
|
24835
|
+
}
|
|
24836
|
+
};
|
|
24837
|
+
let i = 0, r = () => {
|
|
24838
|
+
let o = this.#c.now();
|
|
24839
|
+
if (this.ttlResolution > 0) {
|
|
24840
|
+
i = o;
|
|
24841
|
+
let h = setTimeout(() => i = 0, this.ttlResolution);
|
|
24842
|
+
h.unref && h.unref();
|
|
24843
|
+
}
|
|
24844
|
+
return o;
|
|
24845
|
+
};
|
|
24846
|
+
this.getRemainingTTL = (o) => {
|
|
24847
|
+
let h = this.#f.get(o);
|
|
24848
|
+
if (h === void 0) return 0;
|
|
24849
|
+
let a = t[h], l = e[h];
|
|
24850
|
+
if (!a || !l) return Infinity;
|
|
24851
|
+
return a - ((i || r()) - l);
|
|
24852
|
+
}, this.#v = (o) => {
|
|
24853
|
+
let h = e[o], a = t[o];
|
|
24854
|
+
return !!a && !!h && (i || r()) - h > a;
|
|
24855
|
+
};
|
|
24856
|
+
}
|
|
24857
|
+
#k = () => {};
|
|
24858
|
+
#N = () => {};
|
|
24859
|
+
#j = () => {};
|
|
24860
|
+
#v = () => !1;
|
|
24861
|
+
#G() {
|
|
24862
|
+
let t = new Tt(this.#t);
|
|
24863
|
+
this.#u = 0, this.#C = t, this.#P = (e) => {
|
|
24864
|
+
this.#u -= t[e], t[e] = 0;
|
|
24865
|
+
}, this.#I = (e, s, i, r) => {
|
|
24866
|
+
if (this.#l(s)) return 0;
|
|
24867
|
+
if (!q(i)) if (r) {
|
|
24868
|
+
if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
|
|
24869
|
+
if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
24870
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
24871
|
+
return i;
|
|
24872
|
+
}, this.#L = (e, s, i) => {
|
|
24873
|
+
if (t[e] = s, this.#s) {
|
|
24874
|
+
let r = this.#s - t[e];
|
|
24875
|
+
for (; this.#u > r;) this.#B(!0);
|
|
24876
|
+
}
|
|
24877
|
+
this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
|
|
24878
|
+
};
|
|
24879
|
+
}
|
|
24880
|
+
#P = (t) => {};
|
|
24881
|
+
#L = (t, e, s) => {};
|
|
24882
|
+
#I = (t, e, s, i) => {
|
|
24883
|
+
if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
24884
|
+
return 0;
|
|
23715
24885
|
};
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
24886
|
+
*#F({ allowStale: t = this.allowStale } = {}) {
|
|
24887
|
+
if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b));) e = this.#E[e];
|
|
24888
|
+
}
|
|
24889
|
+
*#D({ allowStale: t = this.allowStale } = {}) {
|
|
24890
|
+
if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p));) e = this.#d[e];
|
|
24891
|
+
}
|
|
24892
|
+
#z(t) {
|
|
24893
|
+
return t !== void 0 && this.#f.get(this.#a[t]) === t;
|
|
24894
|
+
}
|
|
24895
|
+
*entries() {
|
|
24896
|
+
for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
24897
|
+
}
|
|
24898
|
+
*rentries() {
|
|
24899
|
+
for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
24900
|
+
}
|
|
24901
|
+
*keys() {
|
|
24902
|
+
for (let t of this.#F()) {
|
|
24903
|
+
let e = this.#a[t];
|
|
24904
|
+
e !== void 0 && !this.#l(this.#i[t]) && (yield e);
|
|
24905
|
+
}
|
|
24906
|
+
}
|
|
24907
|
+
*rkeys() {
|
|
24908
|
+
for (let t of this.#D()) {
|
|
24909
|
+
let e = this.#a[t];
|
|
24910
|
+
e !== void 0 && !this.#l(this.#i[t]) && (yield e);
|
|
24911
|
+
}
|
|
24912
|
+
}
|
|
24913
|
+
*values() {
|
|
24914
|
+
for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
24915
|
+
}
|
|
24916
|
+
*rvalues() {
|
|
24917
|
+
for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
24918
|
+
}
|
|
24919
|
+
[Symbol.iterator]() {
|
|
24920
|
+
return this.entries();
|
|
24921
|
+
}
|
|
24922
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
24923
|
+
find(t, e = {}) {
|
|
24924
|
+
for (let s of this.#F()) {
|
|
24925
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
24926
|
+
if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
|
|
24927
|
+
}
|
|
24928
|
+
}
|
|
24929
|
+
forEach(t, e = this) {
|
|
24930
|
+
for (let s of this.#F()) {
|
|
24931
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
24932
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
24933
|
+
}
|
|
24934
|
+
}
|
|
24935
|
+
rforEach(t, e = this) {
|
|
24936
|
+
for (let s of this.#D()) {
|
|
24937
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
24938
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
24939
|
+
}
|
|
24940
|
+
}
|
|
24941
|
+
purgeStale() {
|
|
24942
|
+
let t = !1;
|
|
24943
|
+
for (let e of this.#D({ allowStale: !0 })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = !0);
|
|
24944
|
+
return t;
|
|
24945
|
+
}
|
|
24946
|
+
info(t) {
|
|
24947
|
+
let e = this.#f.get(t);
|
|
24948
|
+
if (e === void 0) return;
|
|
24949
|
+
let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
|
|
24950
|
+
if (i === void 0) return;
|
|
24951
|
+
let r = { value: i };
|
|
24952
|
+
if (this.#g && this.#T) {
|
|
24953
|
+
let o = this.#g[e], h = this.#T[e];
|
|
24954
|
+
if (o && h) r.ttl = o - (this.#c.now() - h), r.start = Date.now();
|
|
24955
|
+
}
|
|
24956
|
+
return this.#C && (r.size = this.#C[e]), r;
|
|
24957
|
+
}
|
|
24958
|
+
dump() {
|
|
24959
|
+
let t = [];
|
|
24960
|
+
for (let e of this.#F({ allowStale: !0 })) {
|
|
24961
|
+
let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
24962
|
+
if (r === void 0 || s === void 0) continue;
|
|
24963
|
+
let o = { value: r };
|
|
24964
|
+
if (this.#g && this.#T) {
|
|
24965
|
+
o.ttl = this.#g[e];
|
|
24966
|
+
let h = this.#c.now() - this.#T[e];
|
|
24967
|
+
o.start = Math.floor(Date.now() - h);
|
|
24968
|
+
}
|
|
24969
|
+
this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
|
|
24970
|
+
}
|
|
24971
|
+
return t;
|
|
24972
|
+
}
|
|
24973
|
+
load(t) {
|
|
24974
|
+
this.clear();
|
|
24975
|
+
for (let [e, s] of t) {
|
|
24976
|
+
if (s.start) {
|
|
24977
|
+
let i = Date.now() - s.start;
|
|
24978
|
+
s.start = this.#c.now() - i;
|
|
24979
|
+
}
|
|
24980
|
+
this.set(e, s.value, s);
|
|
24981
|
+
}
|
|
24982
|
+
}
|
|
24983
|
+
set(t, e, s = {}) {
|
|
24984
|
+
if (e === void 0) return this.delete(t), this;
|
|
24985
|
+
let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
|
|
24986
|
+
if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.#O(t, "set"), this;
|
|
24987
|
+
let c = this.#h === 0 ? void 0 : this.#f.get(t);
|
|
24988
|
+
if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(!1) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = !1, this.#_ && this.#r?.(e, t, "add");
|
|
24989
|
+
else {
|
|
24990
|
+
this.#W(c);
|
|
24991
|
+
let d = this.#i[c];
|
|
24992
|
+
if (e !== d) {
|
|
24993
|
+
if (this.#A && this.#l(d)) {
|
|
24994
|
+
d.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
|
|
24995
|
+
let { __staleWhileFetching: f } = d;
|
|
24996
|
+
f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([
|
|
24997
|
+
f,
|
|
24998
|
+
t,
|
|
24999
|
+
"set"
|
|
25000
|
+
]));
|
|
25001
|
+
} else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([
|
|
25002
|
+
d,
|
|
25003
|
+
t,
|
|
25004
|
+
"set"
|
|
25005
|
+
]));
|
|
25006
|
+
if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
|
|
25007
|
+
a.set = "replace";
|
|
25008
|
+
let f = d && this.#l(d) ? d.__staleWhileFetching : d;
|
|
25009
|
+
f !== void 0 && (a.oldValue = f);
|
|
25010
|
+
}
|
|
25011
|
+
} else a && (a.set = "update");
|
|
25012
|
+
this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
25013
|
+
}
|
|
25014
|
+
if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
|
|
25015
|
+
let d = this.#m, f;
|
|
25016
|
+
for (; f = d?.shift();) this.#o?.(...f);
|
|
25017
|
+
}
|
|
25018
|
+
return this;
|
|
25019
|
+
}
|
|
25020
|
+
pop() {
|
|
25021
|
+
try {
|
|
25022
|
+
for (; this.#h;) {
|
|
25023
|
+
let t = this.#i[this.#b];
|
|
25024
|
+
if (this.#B(!0), this.#l(t)) {
|
|
25025
|
+
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
25026
|
+
} else if (t !== void 0) return t;
|
|
25027
|
+
}
|
|
25028
|
+
} finally {
|
|
25029
|
+
if (this.#e && this.#m) {
|
|
25030
|
+
let t = this.#m, e;
|
|
25031
|
+
for (; e = t?.shift();) this.#o?.(...e);
|
|
25032
|
+
}
|
|
25033
|
+
}
|
|
25034
|
+
}
|
|
25035
|
+
#B(t) {
|
|
25036
|
+
let e = this.#b, s = this.#a[e], i = this.#i[e];
|
|
25037
|
+
return this.#A && this.#l(i) ? i.__abortController.abort(/* @__PURE__ */ new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([
|
|
25038
|
+
i,
|
|
25039
|
+
s,
|
|
25040
|
+
"evict"
|
|
25041
|
+
])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
|
|
25042
|
+
}
|
|
25043
|
+
has(t, e = {}) {
|
|
25044
|
+
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
|
|
25045
|
+
if (r !== void 0) {
|
|
25046
|
+
let o = this.#i[r];
|
|
25047
|
+
if (this.#l(o) && o.__staleWhileFetching === void 0) return !1;
|
|
25048
|
+
if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
|
|
25049
|
+
else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), !0;
|
|
25050
|
+
} else i && (i.has = "miss");
|
|
25051
|
+
return !1;
|
|
25052
|
+
}
|
|
25053
|
+
peek(t, e = {}) {
|
|
25054
|
+
let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
|
|
25055
|
+
if (i === void 0 || !s && this.#v(i)) return;
|
|
25056
|
+
let r = this.#i[i];
|
|
25057
|
+
return this.#l(r) ? r.__staleWhileFetching : r;
|
|
25058
|
+
}
|
|
25059
|
+
#U(t, e, s, i) {
|
|
25060
|
+
let r = e === void 0 ? void 0 : this.#i[e];
|
|
25061
|
+
if (this.#l(r)) return r;
|
|
25062
|
+
let o = new At(), { signal: h } = s;
|
|
25063
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
25064
|
+
let a = {
|
|
25065
|
+
signal: o.signal,
|
|
25066
|
+
options: s,
|
|
25067
|
+
context: i
|
|
25068
|
+
}, l = (p, w = !1) => {
|
|
25069
|
+
let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
|
|
25070
|
+
if (s.status && (g && !w ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = !0)) : s.status.fetchResolved = !0), g && !S && !w) return c(o.signal.reason, E);
|
|
25071
|
+
let y = f, b = this.#i[e];
|
|
25072
|
+
return (b === f || S && w && b === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = !0), this.set(t, p, a.options))), p;
|
|
25073
|
+
}, u = (p) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = p), c(p, !1)), c = (p, w) => {
|
|
25074
|
+
let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
|
|
25075
|
+
if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), b.__staleWhileFetching;
|
|
25076
|
+
if (b.__returned === b) throw p;
|
|
25077
|
+
}, d = (p, w) => {
|
|
25078
|
+
let g = this.#S?.(t, r, a);
|
|
25079
|
+
g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
|
|
25080
|
+
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, !0)));
|
|
25081
|
+
});
|
|
25082
|
+
};
|
|
25083
|
+
s.status && (s.status.fetchDispatched = !0);
|
|
25084
|
+
let f = new Promise(d).then(l, u), m = Object.assign(f, {
|
|
25085
|
+
__abortController: o,
|
|
25086
|
+
__staleWhileFetching: r,
|
|
25087
|
+
__returned: void 0
|
|
25088
|
+
});
|
|
25089
|
+
return e === void 0 ? (this.set(t, m, {
|
|
25090
|
+
...a.options,
|
|
25091
|
+
status: void 0
|
|
25092
|
+
}), e = this.#f.get(t)) : this.#i[e] = m, m;
|
|
25093
|
+
}
|
|
25094
|
+
#l(t) {
|
|
25095
|
+
if (!this.#A) return !1;
|
|
25096
|
+
let e = t;
|
|
25097
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
|
|
25098
|
+
}
|
|
25099
|
+
async fetch(t, e = {}) {
|
|
25100
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = !1, status: g, signal: S } = e;
|
|
25101
|
+
if (!this.#A) return g && (g.fetch = "get"), this.get(t, {
|
|
25102
|
+
allowStale: s,
|
|
25103
|
+
updateAgeOnGet: i,
|
|
25104
|
+
noDeleteOnStaleGet: r,
|
|
25105
|
+
status: g
|
|
25106
|
+
});
|
|
25107
|
+
let E = {
|
|
25108
|
+
allowStale: s,
|
|
25109
|
+
updateAgeOnGet: i,
|
|
25110
|
+
noDeleteOnStaleGet: r,
|
|
25111
|
+
ttl: o,
|
|
25112
|
+
noDisposeOnSet: h,
|
|
25113
|
+
size: a,
|
|
25114
|
+
sizeCalculation: l,
|
|
25115
|
+
noUpdateTTL: u,
|
|
25116
|
+
noDeleteOnFetchRejection: c,
|
|
25117
|
+
allowStaleOnFetchRejection: d,
|
|
25118
|
+
allowStaleOnFetchAbort: m,
|
|
25119
|
+
ignoreFetchAbort: f,
|
|
25120
|
+
status: g,
|
|
25121
|
+
signal: S
|
|
25122
|
+
}, y = this.#f.get(t);
|
|
25123
|
+
if (y === void 0) {
|
|
25124
|
+
g && (g.fetch = "miss");
|
|
25125
|
+
let b = this.#U(t, y, E, p);
|
|
25126
|
+
return b.__returned = b;
|
|
25127
|
+
} else {
|
|
25128
|
+
let b = this.#i[y];
|
|
25129
|
+
if (this.#l(b)) {
|
|
25130
|
+
let Z = s && b.__staleWhileFetching !== void 0;
|
|
25131
|
+
return g && (g.fetch = "inflight", Z && (g.returnedStale = !0)), Z ? b.__staleWhileFetching : b.__returned = b;
|
|
25132
|
+
}
|
|
25133
|
+
let z = this.#v(y);
|
|
25134
|
+
if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
|
|
25135
|
+
let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
|
|
25136
|
+
return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = !0)), J ? $.__staleWhileFetching : $.__returned = $;
|
|
25137
|
+
}
|
|
25138
|
+
}
|
|
25139
|
+
async forceFetch(t, e = {}) {
|
|
25140
|
+
let s = await this.fetch(t, e);
|
|
25141
|
+
if (s === void 0) throw new Error("fetch() returned undefined");
|
|
25142
|
+
return s;
|
|
25143
|
+
}
|
|
25144
|
+
memo(t, e = {}) {
|
|
25145
|
+
let s = this.#w;
|
|
25146
|
+
if (!s) throw new Error("no memoMethod provided to constructor");
|
|
25147
|
+
let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
|
|
25148
|
+
if (!r && h !== void 0) return h;
|
|
25149
|
+
let a = s(t, h, {
|
|
25150
|
+
options: o,
|
|
25151
|
+
context: i
|
|
25152
|
+
});
|
|
25153
|
+
return this.set(t, a, o), a;
|
|
25154
|
+
}
|
|
25155
|
+
get(t, e = {}) {
|
|
25156
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
|
|
25157
|
+
if (h !== void 0) {
|
|
25158
|
+
let a = this.#i[h], l = this.#l(a);
|
|
25159
|
+
return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), s ? a.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = !0), s ? a : void 0)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
|
|
25160
|
+
} else o && (o.get = "miss");
|
|
25161
|
+
}
|
|
25162
|
+
#$(t, e) {
|
|
25163
|
+
this.#E[e] = t, this.#d[t] = e;
|
|
25164
|
+
}
|
|
25165
|
+
#W(t) {
|
|
25166
|
+
t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
|
|
25167
|
+
}
|
|
25168
|
+
delete(t) {
|
|
25169
|
+
return this.#O(t, "delete");
|
|
25170
|
+
}
|
|
25171
|
+
#O(t, e) {
|
|
25172
|
+
let s = !1;
|
|
25173
|
+
if (this.#h !== 0) {
|
|
25174
|
+
let i = this.#f.get(t);
|
|
25175
|
+
if (i !== void 0) if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = void 0), s = !0, this.#h === 1) this.#H(e);
|
|
25176
|
+
else {
|
|
25177
|
+
this.#P(i);
|
|
25178
|
+
let r = this.#i[i];
|
|
25179
|
+
if (this.#l(r) ? r.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([
|
|
25180
|
+
r,
|
|
25181
|
+
t,
|
|
25182
|
+
e
|
|
25183
|
+
])), this.#f.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#E[i];
|
|
25184
|
+
else if (i === this.#b) this.#b = this.#d[i];
|
|
25185
|
+
else {
|
|
25186
|
+
let o = this.#E[i];
|
|
25187
|
+
this.#d[o] = this.#d[i];
|
|
25188
|
+
let h = this.#d[i];
|
|
25189
|
+
this.#E[h] = this.#E[i];
|
|
25190
|
+
}
|
|
25191
|
+
this.#h--, this.#R.push(i);
|
|
25192
|
+
}
|
|
25193
|
+
}
|
|
25194
|
+
if (this.#e && this.#m?.length) {
|
|
25195
|
+
let i = this.#m, r;
|
|
25196
|
+
for (; r = i?.shift();) this.#o?.(...r);
|
|
25197
|
+
}
|
|
25198
|
+
return s;
|
|
25199
|
+
}
|
|
25200
|
+
clear() {
|
|
25201
|
+
return this.#H("delete");
|
|
25202
|
+
}
|
|
25203
|
+
#H(t) {
|
|
25204
|
+
for (let e of this.#D({ allowStale: !0 })) {
|
|
25205
|
+
let s = this.#i[e];
|
|
25206
|
+
if (this.#l(s)) s.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
|
|
25207
|
+
else {
|
|
25208
|
+
let i = this.#a[e];
|
|
25209
|
+
this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([
|
|
25210
|
+
s,
|
|
25211
|
+
i,
|
|
25212
|
+
t
|
|
25213
|
+
]);
|
|
25214
|
+
}
|
|
25215
|
+
}
|
|
25216
|
+
if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
|
|
25217
|
+
this.#g.fill(0), this.#T.fill(0);
|
|
25218
|
+
for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
|
|
25219
|
+
this.#y?.fill(void 0);
|
|
25220
|
+
}
|
|
25221
|
+
if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
|
|
25222
|
+
let e = this.#m, s;
|
|
25223
|
+
for (; s = e?.shift();) this.#o?.(...s);
|
|
25224
|
+
}
|
|
25225
|
+
}
|
|
25226
|
+
};
|
|
25227
|
+
var Ne = typeof process == "object" && process ? process : {
|
|
25228
|
+
stdout: null,
|
|
25229
|
+
stderr: null
|
|
25230
|
+
}, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
|
|
25231
|
+
src;
|
|
25232
|
+
dest;
|
|
25233
|
+
opts;
|
|
25234
|
+
ondrain;
|
|
25235
|
+
constructor(t, e, s) {
|
|
25236
|
+
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
|
|
25237
|
+
}
|
|
25238
|
+
unpipe() {
|
|
25239
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
25240
|
+
}
|
|
25241
|
+
proxyErrors(t) {}
|
|
25242
|
+
end() {
|
|
25243
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
25244
|
+
}
|
|
25245
|
+
}, te = class extends Mt {
|
|
25246
|
+
unpipe() {
|
|
25247
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
25248
|
+
}
|
|
25249
|
+
constructor(t, e, s) {
|
|
25250
|
+
super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
|
|
25251
|
+
}
|
|
25252
|
+
}, di = (n) => !!n.objectMode, pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", V = class extends EventEmitter {
|
|
25253
|
+
[v] = !1;
|
|
25254
|
+
[dt] = !1;
|
|
25255
|
+
[F] = [];
|
|
25256
|
+
[C] = [];
|
|
25257
|
+
[k];
|
|
25258
|
+
[P];
|
|
25259
|
+
[B];
|
|
25260
|
+
[et];
|
|
25261
|
+
[G] = !1;
|
|
25262
|
+
[K] = !1;
|
|
25263
|
+
[kt] = !1;
|
|
25264
|
+
[Rt] = !1;
|
|
25265
|
+
[ut] = null;
|
|
25266
|
+
[T] = 0;
|
|
25267
|
+
[x] = !1;
|
|
25268
|
+
[pt];
|
|
25269
|
+
[Dt] = !1;
|
|
25270
|
+
[Y] = 0;
|
|
25271
|
+
[M] = !1;
|
|
25272
|
+
writable = !0;
|
|
25273
|
+
readable = !0;
|
|
25274
|
+
constructor(...t) {
|
|
25275
|
+
let e = t[0] || {};
|
|
25276
|
+
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
25277
|
+
di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
|
|
25278
|
+
let { signal: s } = e;
|
|
25279
|
+
s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
|
|
25280
|
+
}
|
|
25281
|
+
get bufferLength() {
|
|
25282
|
+
return this[T];
|
|
25283
|
+
}
|
|
25284
|
+
get encoding() {
|
|
25285
|
+
return this[P];
|
|
25286
|
+
}
|
|
25287
|
+
set encoding(t) {
|
|
25288
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
25289
|
+
}
|
|
25290
|
+
setEncoding(t) {
|
|
25291
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
25292
|
+
}
|
|
25293
|
+
get objectMode() {
|
|
25294
|
+
return this[k];
|
|
25295
|
+
}
|
|
25296
|
+
set objectMode(t) {
|
|
25297
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
25298
|
+
}
|
|
25299
|
+
get async() {
|
|
25300
|
+
return this[B];
|
|
25301
|
+
}
|
|
25302
|
+
set async(t) {
|
|
25303
|
+
this[B] = this[B] || !!t;
|
|
25304
|
+
}
|
|
25305
|
+
[Qt]() {
|
|
25306
|
+
this[Dt] = !0, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
|
|
25307
|
+
}
|
|
25308
|
+
get aborted() {
|
|
25309
|
+
return this[Dt];
|
|
25310
|
+
}
|
|
25311
|
+
set aborted(t) {}
|
|
25312
|
+
write(t, e, s) {
|
|
25313
|
+
if (this[Dt]) return !1;
|
|
25314
|
+
if (this[G]) throw new Error("write after end");
|
|
25315
|
+
if (this[x]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
25316
|
+
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
25317
|
+
let i = this[B] ? mt : li;
|
|
25318
|
+
if (!this[k] && !Buffer.isBuffer(t)) {
|
|
25319
|
+
if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
25320
|
+
else if (fi(t)) t = Buffer.from(t);
|
|
25321
|
+
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
25322
|
+
}
|
|
25323
|
+
return this[k] ? (this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
|
|
25324
|
+
}
|
|
25325
|
+
read(t) {
|
|
25326
|
+
if (this[x]) return null;
|
|
25327
|
+
if (this[M] = !1, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
|
|
25328
|
+
this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
|
|
25329
|
+
let e = this[_e](t || null, this[C][0]);
|
|
25330
|
+
return this[H](), e;
|
|
25331
|
+
}
|
|
25332
|
+
[_e](t, e) {
|
|
25333
|
+
if (this[k]) this[Ft]();
|
|
25334
|
+
else {
|
|
25335
|
+
let s = e;
|
|
25336
|
+
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
|
|
25337
|
+
}
|
|
25338
|
+
return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
|
|
25339
|
+
}
|
|
25340
|
+
end(t, e, s) {
|
|
25341
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
|
|
25342
|
+
}
|
|
25343
|
+
[st]() {
|
|
25344
|
+
this[x] || (!this[Y] && !this[F].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
|
|
25345
|
+
}
|
|
25346
|
+
resume() {
|
|
25347
|
+
return this[st]();
|
|
25348
|
+
}
|
|
25349
|
+
pause() {
|
|
25350
|
+
this[v] = !1, this[dt] = !0, this[M] = !1;
|
|
25351
|
+
}
|
|
25352
|
+
get destroyed() {
|
|
25353
|
+
return this[x];
|
|
25354
|
+
}
|
|
25355
|
+
get flowing() {
|
|
25356
|
+
return this[v];
|
|
25357
|
+
}
|
|
25358
|
+
get paused() {
|
|
25359
|
+
return this[dt];
|
|
25360
|
+
}
|
|
25361
|
+
[Yt](t) {
|
|
25362
|
+
this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
|
|
25363
|
+
}
|
|
25364
|
+
[Ft]() {
|
|
25365
|
+
return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
|
|
25366
|
+
}
|
|
25367
|
+
[Ot](t = !1) {
|
|
25368
|
+
do ;
|
|
25369
|
+
while (this[Le](this[Ft]()) && this[C].length);
|
|
25370
|
+
!t && !this[C].length && !this[G] && this.emit("drain");
|
|
25371
|
+
}
|
|
25372
|
+
[Le](t) {
|
|
25373
|
+
return this.emit("data", t), this[v];
|
|
25374
|
+
}
|
|
25375
|
+
pipe(t, e) {
|
|
25376
|
+
if (this[x]) return t;
|
|
25377
|
+
this[M] = !1;
|
|
25378
|
+
let s = this[K];
|
|
25379
|
+
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
|
|
25380
|
+
}
|
|
25381
|
+
unpipe(t) {
|
|
25382
|
+
let e = this[F].find((s) => s.dest === t);
|
|
25383
|
+
e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
|
|
25384
|
+
}
|
|
25385
|
+
addListener(t, e) {
|
|
25386
|
+
return this.on(t, e);
|
|
25387
|
+
}
|
|
25388
|
+
on(t, e) {
|
|
25389
|
+
let s = super.on(t, e);
|
|
25390
|
+
if (t === "data") this[M] = !1, this[Y]++, !this[F].length && !this[v] && this[st]();
|
|
25391
|
+
else if (t === "readable" && this[T] !== 0) super.emit("readable");
|
|
25392
|
+
else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
|
|
25393
|
+
else if (t === "error" && this[ut]) {
|
|
25394
|
+
let i = e;
|
|
25395
|
+
this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
|
|
25396
|
+
}
|
|
25397
|
+
return s;
|
|
25398
|
+
}
|
|
25399
|
+
removeListener(t, e) {
|
|
25400
|
+
return this.off(t, e);
|
|
25401
|
+
}
|
|
25402
|
+
off(t, e) {
|
|
25403
|
+
let s = super.off(t, e);
|
|
25404
|
+
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = !1)), s;
|
|
25405
|
+
}
|
|
25406
|
+
removeAllListeners(t) {
|
|
25407
|
+
let e = super.removeAllListeners(t);
|
|
25408
|
+
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = !1)), e;
|
|
25409
|
+
}
|
|
25410
|
+
get emittedEnd() {
|
|
25411
|
+
return this[K];
|
|
25412
|
+
}
|
|
25413
|
+
[H]() {
|
|
25414
|
+
!this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
|
|
25415
|
+
}
|
|
25416
|
+
emit(t, ...e) {
|
|
25417
|
+
let s = e[0];
|
|
25418
|
+
if (t !== "error" && t !== "close" && t !== x && this[x]) return !1;
|
|
25419
|
+
if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
|
|
25420
|
+
if (t === "end") return this[We]();
|
|
25421
|
+
if (t === "close") {
|
|
25422
|
+
if (this[Rt] = !0, !this[K] && !this[x]) return !1;
|
|
25423
|
+
let r = super.emit("close");
|
|
25424
|
+
return this.removeAllListeners("close"), r;
|
|
25425
|
+
} else if (t === "error") {
|
|
25426
|
+
this[ut] = s, super.emit(Xt, s);
|
|
25427
|
+
let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : !1;
|
|
25428
|
+
return this[H](), r;
|
|
25429
|
+
} else if (t === "resume") {
|
|
25430
|
+
let r = super.emit("resume");
|
|
25431
|
+
return this[H](), r;
|
|
25432
|
+
} else if (t === "finish" || t === "prefinish") {
|
|
25433
|
+
let r = super.emit(t);
|
|
25434
|
+
return this.removeAllListeners(t), r;
|
|
25435
|
+
}
|
|
25436
|
+
let i = super.emit(t, ...e);
|
|
25437
|
+
return this[H](), i;
|
|
25438
|
+
}
|
|
25439
|
+
[Jt](t) {
|
|
25440
|
+
for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
|
|
25441
|
+
let e = this[M] ? !1 : super.emit("data", t);
|
|
25442
|
+
return this[H](), e;
|
|
25443
|
+
}
|
|
25444
|
+
[We]() {
|
|
25445
|
+
return this[K] ? !1 : (this[K] = !0, this.readable = !1, this[B] ? (mt(() => this[Zt]()), !0) : this[Zt]());
|
|
25446
|
+
}
|
|
25447
|
+
[Zt]() {
|
|
25448
|
+
if (this[et]) {
|
|
25449
|
+
let e = this[et].end();
|
|
25450
|
+
if (e) {
|
|
25451
|
+
for (let s of this[F]) s.dest.write(e);
|
|
25452
|
+
this[M] || super.emit("data", e);
|
|
25453
|
+
}
|
|
25454
|
+
}
|
|
25455
|
+
for (let e of this[F]) e.end();
|
|
25456
|
+
let t = super.emit("end");
|
|
25457
|
+
return this.removeAllListeners("end"), t;
|
|
25458
|
+
}
|
|
25459
|
+
async collect() {
|
|
25460
|
+
let t = Object.assign([], { dataLength: 0 });
|
|
25461
|
+
this[k] || (t.dataLength = 0);
|
|
25462
|
+
let e = this.promise();
|
|
25463
|
+
return this.on("data", (s) => {
|
|
25464
|
+
t.push(s), this[k] || (t.dataLength += s.length);
|
|
25465
|
+
}), await e, t;
|
|
25466
|
+
}
|
|
25467
|
+
async concat() {
|
|
25468
|
+
if (this[k]) throw new Error("cannot concat in objectMode");
|
|
25469
|
+
let t = await this.collect();
|
|
25470
|
+
return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
25471
|
+
}
|
|
25472
|
+
async promise() {
|
|
25473
|
+
return new Promise((t, e) => {
|
|
25474
|
+
this.on(x, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
|
|
25475
|
+
});
|
|
25476
|
+
}
|
|
25477
|
+
[Symbol.asyncIterator]() {
|
|
25478
|
+
this[M] = !1;
|
|
25479
|
+
let t = !1, e = async () => (this.pause(), t = !0, {
|
|
25480
|
+
value: void 0,
|
|
25481
|
+
done: !0
|
|
25482
|
+
});
|
|
25483
|
+
return {
|
|
25484
|
+
next: () => {
|
|
25485
|
+
if (t) return e();
|
|
25486
|
+
let i = this.read();
|
|
25487
|
+
if (i !== null) return Promise.resolve({
|
|
25488
|
+
done: !1,
|
|
25489
|
+
value: i
|
|
25490
|
+
});
|
|
25491
|
+
if (this[G]) return e();
|
|
25492
|
+
let r, o, h = (c) => {
|
|
25493
|
+
this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
|
|
25494
|
+
}, a = (c) => {
|
|
25495
|
+
this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({
|
|
25496
|
+
value: c,
|
|
25497
|
+
done: !!this[G]
|
|
25498
|
+
});
|
|
25499
|
+
}, l = () => {
|
|
25500
|
+
this.off("error", h), this.off("data", a), this.off(x, u), e(), r({
|
|
25501
|
+
done: !0,
|
|
25502
|
+
value: void 0
|
|
25503
|
+
});
|
|
25504
|
+
}, u = () => h(/* @__PURE__ */ new Error("stream destroyed"));
|
|
25505
|
+
return new Promise((c, d) => {
|
|
25506
|
+
o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
25507
|
+
});
|
|
25508
|
+
},
|
|
25509
|
+
throw: e,
|
|
25510
|
+
return: e,
|
|
25511
|
+
[Symbol.asyncIterator]() {
|
|
25512
|
+
return this;
|
|
25513
|
+
},
|
|
25514
|
+
[Symbol.asyncDispose]: async () => {}
|
|
25515
|
+
};
|
|
25516
|
+
}
|
|
25517
|
+
[Symbol.iterator]() {
|
|
25518
|
+
this[M] = !1;
|
|
25519
|
+
let t = !1, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = !0, {
|
|
25520
|
+
done: !0,
|
|
25521
|
+
value: void 0
|
|
25522
|
+
}), s = () => {
|
|
25523
|
+
if (t) return e();
|
|
25524
|
+
let i = this.read();
|
|
25525
|
+
return i === null ? e() : {
|
|
25526
|
+
done: !1,
|
|
25527
|
+
value: i
|
|
25528
|
+
};
|
|
25529
|
+
};
|
|
25530
|
+
return this.once("end", e), this.once(Xt, e), this.once(x, e), {
|
|
25531
|
+
next: s,
|
|
25532
|
+
throw: e,
|
|
25533
|
+
return: e,
|
|
25534
|
+
[Symbol.iterator]() {
|
|
25535
|
+
return this;
|
|
25536
|
+
},
|
|
25537
|
+
[Symbol.dispose]: () => {}
|
|
25538
|
+
};
|
|
25539
|
+
}
|
|
25540
|
+
destroy(t) {
|
|
25541
|
+
if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
|
|
25542
|
+
this[x] = !0, this[M] = !0, this[C].length = 0, this[T] = 0;
|
|
25543
|
+
let e = this;
|
|
25544
|
+
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
|
|
25545
|
+
}
|
|
25546
|
+
static get isStream() {
|
|
25547
|
+
return oi;
|
|
25548
|
+
}
|
|
25549
|
+
}, wt = {
|
|
25550
|
+
lstatSync,
|
|
25551
|
+
readdir,
|
|
25552
|
+
readdirSync,
|
|
25553
|
+
readlinkSync,
|
|
25554
|
+
realpathSync: realpathSync.native,
|
|
25555
|
+
promises: {
|
|
25556
|
+
lstat,
|
|
25557
|
+
readdir: readdir$1,
|
|
25558
|
+
readlink,
|
|
25559
|
+
realpath
|
|
25560
|
+
}
|
|
25561
|
+
}, Ue = (n) => !n || n === wt || n === xi ? wt : {
|
|
25562
|
+
...wt,
|
|
25563
|
+
...n,
|
|
25564
|
+
promises: {
|
|
25565
|
+
...wt.promises,
|
|
25566
|
+
...n.promises || {}
|
|
25567
|
+
}
|
|
25568
|
+
}, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _ = 15, gt = ~_, se = 16, je = 32, yt = 64, j = 128, Nt = 256, Lt = 512, Ie = yt | j | Lt, Fi = 1023, ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L, ze = new ft({ max: 2 ** 12 }), bt = (n) => {
|
|
25569
|
+
let t = ze.get(n);
|
|
25570
|
+
if (t) return t;
|
|
25571
|
+
let e = n.normalize("NFKD");
|
|
25572
|
+
return ze.set(n, e), e;
|
|
25573
|
+
}, Be = new ft({ max: 2 ** 12 }), _t = (n) => {
|
|
25574
|
+
let t = Be.get(n);
|
|
25575
|
+
if (t) return t;
|
|
25576
|
+
let e = bt(n.toLowerCase());
|
|
25577
|
+
return Be.set(n, e), e;
|
|
25578
|
+
}, Wt = class extends ft {
|
|
25579
|
+
constructor() {
|
|
25580
|
+
super({ max: 256 });
|
|
25581
|
+
}
|
|
25582
|
+
}, ne = class extends ft {
|
|
25583
|
+
constructor(t = 16 * 1024) {
|
|
25584
|
+
super({
|
|
25585
|
+
maxSize: t,
|
|
25586
|
+
sizeCalculation: (e) => e.length + 1
|
|
25587
|
+
});
|
|
25588
|
+
}
|
|
25589
|
+
}, Ye = Symbol("PathScurry setAsCwd"), R = class {
|
|
25590
|
+
name;
|
|
25591
|
+
root;
|
|
25592
|
+
roots;
|
|
25593
|
+
parent;
|
|
25594
|
+
nocase;
|
|
25595
|
+
isCWD = !1;
|
|
25596
|
+
#t;
|
|
25597
|
+
#s;
|
|
25598
|
+
get dev() {
|
|
25599
|
+
return this.#s;
|
|
25600
|
+
}
|
|
25601
|
+
#n;
|
|
25602
|
+
get mode() {
|
|
25603
|
+
return this.#n;
|
|
25604
|
+
}
|
|
25605
|
+
#r;
|
|
25606
|
+
get nlink() {
|
|
25607
|
+
return this.#r;
|
|
25608
|
+
}
|
|
25609
|
+
#o;
|
|
25610
|
+
get uid() {
|
|
25611
|
+
return this.#o;
|
|
25612
|
+
}
|
|
25613
|
+
#S;
|
|
25614
|
+
get gid() {
|
|
25615
|
+
return this.#S;
|
|
25616
|
+
}
|
|
25617
|
+
#w;
|
|
25618
|
+
get rdev() {
|
|
25619
|
+
return this.#w;
|
|
25620
|
+
}
|
|
25621
|
+
#c;
|
|
25622
|
+
get blksize() {
|
|
25623
|
+
return this.#c;
|
|
25624
|
+
}
|
|
25625
|
+
#h;
|
|
25626
|
+
get ino() {
|
|
25627
|
+
return this.#h;
|
|
25628
|
+
}
|
|
25629
|
+
#u;
|
|
25630
|
+
get size() {
|
|
25631
|
+
return this.#u;
|
|
25632
|
+
}
|
|
25633
|
+
#f;
|
|
25634
|
+
get blocks() {
|
|
25635
|
+
return this.#f;
|
|
25636
|
+
}
|
|
25637
|
+
#a;
|
|
25638
|
+
get atimeMs() {
|
|
25639
|
+
return this.#a;
|
|
25640
|
+
}
|
|
25641
|
+
#i;
|
|
25642
|
+
get mtimeMs() {
|
|
25643
|
+
return this.#i;
|
|
25644
|
+
}
|
|
25645
|
+
#d;
|
|
25646
|
+
get ctimeMs() {
|
|
25647
|
+
return this.#d;
|
|
25648
|
+
}
|
|
25649
|
+
#E;
|
|
25650
|
+
get birthtimeMs() {
|
|
25651
|
+
return this.#E;
|
|
25652
|
+
}
|
|
25653
|
+
#b;
|
|
25654
|
+
get atime() {
|
|
25655
|
+
return this.#b;
|
|
25656
|
+
}
|
|
25657
|
+
#p;
|
|
25658
|
+
get mtime() {
|
|
25659
|
+
return this.#p;
|
|
25660
|
+
}
|
|
25661
|
+
#R;
|
|
25662
|
+
get ctime() {
|
|
25663
|
+
return this.#R;
|
|
25664
|
+
}
|
|
25665
|
+
#m;
|
|
25666
|
+
get birthtime() {
|
|
25667
|
+
return this.#m;
|
|
25668
|
+
}
|
|
25669
|
+
#C;
|
|
25670
|
+
#T;
|
|
25671
|
+
#g;
|
|
25672
|
+
#y;
|
|
25673
|
+
#x;
|
|
25674
|
+
#A;
|
|
25675
|
+
#e;
|
|
25676
|
+
#_;
|
|
25677
|
+
#M;
|
|
25678
|
+
#k;
|
|
25679
|
+
get parentPath() {
|
|
25680
|
+
return (this.parent || this).fullpath();
|
|
25681
|
+
}
|
|
25682
|
+
get path() {
|
|
25683
|
+
return this.parentPath;
|
|
25684
|
+
}
|
|
25685
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
25686
|
+
this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
|
|
25687
|
+
}
|
|
25688
|
+
depth() {
|
|
25689
|
+
return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
|
|
25690
|
+
}
|
|
25691
|
+
childrenCache() {
|
|
25692
|
+
return this.#_;
|
|
25693
|
+
}
|
|
25694
|
+
resolve(t) {
|
|
25695
|
+
if (!t) return this;
|
|
25696
|
+
let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
|
|
25697
|
+
return e ? this.getRoot(e).#N(i) : this.#N(i);
|
|
25698
|
+
}
|
|
25699
|
+
#N(t) {
|
|
25700
|
+
let e = this;
|
|
25701
|
+
for (let s of t) e = e.child(s);
|
|
25702
|
+
return e;
|
|
25703
|
+
}
|
|
25704
|
+
children() {
|
|
25705
|
+
let t = this.#_.get(this);
|
|
25706
|
+
if (t) return t;
|
|
25707
|
+
let e = Object.assign([], { provisional: 0 });
|
|
25708
|
+
return this.#_.set(this, e), this.#e &= ~se, e;
|
|
25709
|
+
}
|
|
25710
|
+
child(t, e) {
|
|
25711
|
+
if (t === "" || t === ".") return this;
|
|
25712
|
+
if (t === "..") return this.parent || this;
|
|
25713
|
+
let s = this.children(), i = this.nocase ? _t(t) : bt(t);
|
|
25714
|
+
for (let a of s) if (a.#C === i) return a;
|
|
25715
|
+
let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L, {
|
|
25716
|
+
...e,
|
|
25717
|
+
parent: this,
|
|
25718
|
+
fullpath: o
|
|
25719
|
+
});
|
|
25720
|
+
return this.canReaddir() || (h.#e |= j), s.push(h), h;
|
|
25721
|
+
}
|
|
25722
|
+
relative() {
|
|
25723
|
+
if (this.isCWD) return "";
|
|
25724
|
+
if (this.#x !== void 0) return this.#x;
|
|
25725
|
+
let t = this.name, e = this.parent;
|
|
25726
|
+
if (!e) return this.#x = this.name;
|
|
25727
|
+
let s = e.relative();
|
|
25728
|
+
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
25729
|
+
}
|
|
25730
|
+
relativePosix() {
|
|
25731
|
+
if (this.sep === "/") return this.relative();
|
|
25732
|
+
if (this.isCWD) return "";
|
|
25733
|
+
if (this.#A !== void 0) return this.#A;
|
|
25734
|
+
let t = this.name, e = this.parent;
|
|
25735
|
+
if (!e) return this.#A = this.fullpathPosix();
|
|
25736
|
+
let s = e.relativePosix();
|
|
25737
|
+
return s + (!s || !e.parent ? "" : "/") + t;
|
|
25738
|
+
}
|
|
25739
|
+
fullpath() {
|
|
25740
|
+
if (this.#g !== void 0) return this.#g;
|
|
25741
|
+
let t = this.name, e = this.parent;
|
|
25742
|
+
if (!e) return this.#g = this.name;
|
|
25743
|
+
return this.#g = e.fullpath() + (e.parent ? this.sep : "") + t;
|
|
25744
|
+
}
|
|
25745
|
+
fullpathPosix() {
|
|
25746
|
+
if (this.#y !== void 0) return this.#y;
|
|
25747
|
+
if (this.sep === "/") return this.#y = this.fullpath();
|
|
25748
|
+
if (!this.parent) {
|
|
25749
|
+
let i = this.fullpath().replace(/\\/g, "/");
|
|
25750
|
+
return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
|
|
25751
|
+
}
|
|
25752
|
+
let t = this.parent, e = t.fullpathPosix();
|
|
25753
|
+
return this.#y = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
25754
|
+
}
|
|
25755
|
+
isUnknown() {
|
|
25756
|
+
return (this.#e & _) === L;
|
|
25757
|
+
}
|
|
25758
|
+
isType(t) {
|
|
25759
|
+
return this[`is${t}`]();
|
|
25760
|
+
}
|
|
25761
|
+
getType() {
|
|
25762
|
+
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
25763
|
+
}
|
|
25764
|
+
isFile() {
|
|
25765
|
+
return (this.#e & _) === Ke;
|
|
25766
|
+
}
|
|
25767
|
+
isDirectory() {
|
|
25768
|
+
return (this.#e & _) === U;
|
|
25769
|
+
}
|
|
25770
|
+
isCharacterDevice() {
|
|
25771
|
+
return (this.#e & _) === He;
|
|
25772
|
+
}
|
|
25773
|
+
isBlockDevice() {
|
|
25774
|
+
return (this.#e & _) === qe;
|
|
25775
|
+
}
|
|
25776
|
+
isFIFO() {
|
|
25777
|
+
return (this.#e & _) === Ge;
|
|
25778
|
+
}
|
|
25779
|
+
isSocket() {
|
|
25780
|
+
return (this.#e & _) === Ve;
|
|
25781
|
+
}
|
|
25782
|
+
isSymbolicLink() {
|
|
25783
|
+
return (this.#e & X) === X;
|
|
25784
|
+
}
|
|
25785
|
+
lstatCached() {
|
|
25786
|
+
return this.#e & je ? this : void 0;
|
|
25787
|
+
}
|
|
25788
|
+
readlinkCached() {
|
|
25789
|
+
return this.#M;
|
|
25790
|
+
}
|
|
25791
|
+
realpathCached() {
|
|
25792
|
+
return this.#k;
|
|
25793
|
+
}
|
|
25794
|
+
readdirCached() {
|
|
25795
|
+
let t = this.children();
|
|
25796
|
+
return t.slice(0, t.provisional);
|
|
25797
|
+
}
|
|
25798
|
+
canReadlink() {
|
|
25799
|
+
if (this.#M) return !0;
|
|
25800
|
+
if (!this.parent) return !1;
|
|
25801
|
+
let t = this.#e & _;
|
|
25802
|
+
return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
|
|
25803
|
+
}
|
|
25804
|
+
calledReaddir() {
|
|
25805
|
+
return !!(this.#e & se);
|
|
25806
|
+
}
|
|
25807
|
+
isENOENT() {
|
|
25808
|
+
return !!(this.#e & j);
|
|
25809
|
+
}
|
|
25810
|
+
isNamed(t) {
|
|
25811
|
+
return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
|
|
25812
|
+
}
|
|
25813
|
+
async readlink() {
|
|
25814
|
+
let t = this.#M;
|
|
25815
|
+
if (t) return t;
|
|
25816
|
+
if (this.canReadlink() && this.parent) try {
|
|
25817
|
+
let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
|
|
25818
|
+
if (s) return this.#M = s;
|
|
25819
|
+
} catch (e) {
|
|
25820
|
+
this.#D(e.code);
|
|
25821
|
+
return;
|
|
25822
|
+
}
|
|
25823
|
+
}
|
|
25824
|
+
readlinkSync() {
|
|
25825
|
+
let t = this.#M;
|
|
25826
|
+
if (t) return t;
|
|
25827
|
+
if (this.canReadlink() && this.parent) try {
|
|
25828
|
+
let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
|
|
25829
|
+
if (s) return this.#M = s;
|
|
25830
|
+
} catch (e) {
|
|
25831
|
+
this.#D(e.code);
|
|
25832
|
+
return;
|
|
25833
|
+
}
|
|
25834
|
+
}
|
|
25835
|
+
#j(t) {
|
|
25836
|
+
this.#e |= se;
|
|
25837
|
+
for (let e = t.provisional; e < t.length; e++) {
|
|
25838
|
+
let s = t[e];
|
|
25839
|
+
s && s.#v();
|
|
25840
|
+
}
|
|
25841
|
+
}
|
|
25842
|
+
#v() {
|
|
25843
|
+
this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
|
|
25844
|
+
}
|
|
25845
|
+
#G() {
|
|
25846
|
+
let t = this.children();
|
|
25847
|
+
t.provisional = 0;
|
|
25848
|
+
for (let e of t) e.#v();
|
|
25849
|
+
}
|
|
25850
|
+
#P() {
|
|
25851
|
+
this.#e |= Lt, this.#L();
|
|
25852
|
+
}
|
|
25853
|
+
#L() {
|
|
25854
|
+
if (this.#e & yt) return;
|
|
25855
|
+
let t = this.#e;
|
|
25856
|
+
(t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
|
|
25857
|
+
}
|
|
25858
|
+
#I(t = "") {
|
|
25859
|
+
t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
|
|
25860
|
+
}
|
|
25861
|
+
#F(t = "") {
|
|
25862
|
+
t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
|
|
25863
|
+
}
|
|
25864
|
+
#D(t = "") {
|
|
25865
|
+
let e = this.#e;
|
|
25866
|
+
e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
|
|
25867
|
+
}
|
|
25868
|
+
#z(t, e) {
|
|
25869
|
+
return this.#U(t, e) || this.#B(t, e);
|
|
25870
|
+
}
|
|
25871
|
+
#B(t, e) {
|
|
25872
|
+
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
|
|
25873
|
+
return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
|
|
25874
|
+
}
|
|
25875
|
+
#U(t, e) {
|
|
25876
|
+
for (let s = e.provisional; s < e.length; s++) {
|
|
25877
|
+
let i = e[s];
|
|
25878
|
+
if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
|
|
25879
|
+
}
|
|
25880
|
+
}
|
|
25881
|
+
#l(t, e, s, i) {
|
|
25882
|
+
let r = e.name;
|
|
25883
|
+
return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
|
|
25884
|
+
}
|
|
25885
|
+
async lstat() {
|
|
25886
|
+
if ((this.#e & j) === 0) try {
|
|
25887
|
+
return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
|
|
25888
|
+
} catch (t) {
|
|
25889
|
+
this.#F(t.code);
|
|
25890
|
+
}
|
|
25891
|
+
}
|
|
25892
|
+
lstatSync() {
|
|
25893
|
+
if ((this.#e & j) === 0) try {
|
|
25894
|
+
return this.#$(this.#t.lstatSync(this.fullpath())), this;
|
|
25895
|
+
} catch (t) {
|
|
25896
|
+
this.#F(t.code);
|
|
25897
|
+
}
|
|
25898
|
+
}
|
|
25899
|
+
#$(t) {
|
|
25900
|
+
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
|
|
25901
|
+
this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
|
|
25902
|
+
let y = ie(t);
|
|
25903
|
+
this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
|
|
25904
|
+
}
|
|
25905
|
+
#W = [];
|
|
25906
|
+
#O = !1;
|
|
25907
|
+
#H(t) {
|
|
25908
|
+
this.#O = !1;
|
|
25909
|
+
let e = this.#W.slice();
|
|
25910
|
+
this.#W.length = 0, e.forEach((s) => s(null, t));
|
|
25911
|
+
}
|
|
25912
|
+
readdirCB(t, e = !1) {
|
|
25913
|
+
if (!this.canReaddir()) {
|
|
25914
|
+
e ? t(null, []) : queueMicrotask(() => t(null, []));
|
|
25915
|
+
return;
|
|
25916
|
+
}
|
|
25917
|
+
let s = this.children();
|
|
25918
|
+
if (this.calledReaddir()) {
|
|
25919
|
+
let r = s.slice(0, s.provisional);
|
|
25920
|
+
e ? t(null, r) : queueMicrotask(() => t(null, r));
|
|
25921
|
+
return;
|
|
25922
|
+
}
|
|
25923
|
+
if (this.#W.push(t), this.#O) return;
|
|
25924
|
+
this.#O = !0;
|
|
25925
|
+
let i = this.fullpath();
|
|
25926
|
+
this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
|
|
25927
|
+
if (r) this.#I(r.code), s.provisional = 0;
|
|
25928
|
+
else {
|
|
25929
|
+
for (let h of o) this.#z(h, s);
|
|
25930
|
+
this.#j(s);
|
|
25931
|
+
}
|
|
25932
|
+
this.#H(s.slice(0, s.provisional));
|
|
25933
|
+
});
|
|
25934
|
+
}
|
|
25935
|
+
#q;
|
|
25936
|
+
async readdir() {
|
|
25937
|
+
if (!this.canReaddir()) return [];
|
|
25938
|
+
let t = this.children();
|
|
25939
|
+
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
25940
|
+
let e = this.fullpath();
|
|
25941
|
+
if (this.#q) await this.#q;
|
|
25942
|
+
else {
|
|
25943
|
+
let s = () => {};
|
|
25944
|
+
this.#q = new Promise((i) => s = i);
|
|
25945
|
+
try {
|
|
25946
|
+
for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
|
|
25947
|
+
this.#j(t);
|
|
25948
|
+
} catch (i) {
|
|
25949
|
+
this.#I(i.code), t.provisional = 0;
|
|
25950
|
+
}
|
|
25951
|
+
this.#q = void 0, s();
|
|
25952
|
+
}
|
|
25953
|
+
return t.slice(0, t.provisional);
|
|
25954
|
+
}
|
|
25955
|
+
readdirSync() {
|
|
25956
|
+
if (!this.canReaddir()) return [];
|
|
25957
|
+
let t = this.children();
|
|
25958
|
+
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
25959
|
+
let e = this.fullpath();
|
|
25960
|
+
try {
|
|
25961
|
+
for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
|
|
25962
|
+
this.#j(t);
|
|
25963
|
+
} catch (s) {
|
|
25964
|
+
this.#I(s.code), t.provisional = 0;
|
|
25965
|
+
}
|
|
25966
|
+
return t.slice(0, t.provisional);
|
|
25967
|
+
}
|
|
25968
|
+
canReaddir() {
|
|
25969
|
+
if (this.#e & Ie) return !1;
|
|
25970
|
+
let t = _ & this.#e;
|
|
25971
|
+
return t === L || t === U || t === X;
|
|
25972
|
+
}
|
|
25973
|
+
shouldWalk(t, e) {
|
|
25974
|
+
return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
|
|
25975
|
+
}
|
|
25976
|
+
async realpath() {
|
|
25977
|
+
if (this.#k) return this.#k;
|
|
25978
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
25979
|
+
let t = await this.#t.promises.realpath(this.fullpath());
|
|
25980
|
+
return this.#k = this.resolve(t);
|
|
25981
|
+
} catch {
|
|
25982
|
+
this.#P();
|
|
25983
|
+
}
|
|
25984
|
+
}
|
|
25985
|
+
realpathSync() {
|
|
25986
|
+
if (this.#k) return this.#k;
|
|
25987
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
25988
|
+
let t = this.#t.realpathSync(this.fullpath());
|
|
25989
|
+
return this.#k = this.resolve(t);
|
|
25990
|
+
} catch {
|
|
25991
|
+
this.#P();
|
|
25992
|
+
}
|
|
25993
|
+
}
|
|
25994
|
+
[Ye](t) {
|
|
25995
|
+
if (t === this) return;
|
|
25996
|
+
t.isCWD = !1, this.isCWD = !0;
|
|
25997
|
+
let e = /* @__PURE__ */ new Set([]), s = [], i = this;
|
|
25998
|
+
for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
|
|
25999
|
+
for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
|
|
26000
|
+
}
|
|
26001
|
+
}, Pt = class n extends R {
|
|
26002
|
+
sep = "\\";
|
|
26003
|
+
splitSep = Oi;
|
|
26004
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
26005
|
+
super(t, e, s, i, r, o, h);
|
|
26006
|
+
}
|
|
26007
|
+
newChild(t, e = L, s = {}) {
|
|
26008
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
26009
|
+
}
|
|
26010
|
+
getRootString(t) {
|
|
26011
|
+
return win32.parse(t).root;
|
|
26012
|
+
}
|
|
26013
|
+
getRoot(t) {
|
|
26014
|
+
if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
|
|
26015
|
+
for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
|
|
26016
|
+
return this.roots[t] = new it(t, this).root;
|
|
26017
|
+
}
|
|
26018
|
+
sameRoot(t, e = this.root.name) {
|
|
26019
|
+
return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
|
|
26020
|
+
}
|
|
26021
|
+
}, jt = class n extends R {
|
|
26022
|
+
splitSep = "/";
|
|
26023
|
+
sep = "/";
|
|
26024
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
26025
|
+
super(t, e, s, i, r, o, h);
|
|
26026
|
+
}
|
|
26027
|
+
getRootString(t) {
|
|
26028
|
+
return t.startsWith("/") ? "/" : "";
|
|
26029
|
+
}
|
|
26030
|
+
getRoot(t) {
|
|
26031
|
+
return this.root;
|
|
26032
|
+
}
|
|
26033
|
+
newChild(t, e = L, s = {}) {
|
|
26034
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
26035
|
+
}
|
|
26036
|
+
}, It = class {
|
|
26037
|
+
root;
|
|
26038
|
+
rootPath;
|
|
26039
|
+
roots;
|
|
26040
|
+
cwd;
|
|
26041
|
+
#t;
|
|
26042
|
+
#s;
|
|
26043
|
+
#n;
|
|
26044
|
+
nocase;
|
|
26045
|
+
#r;
|
|
26046
|
+
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
|
|
26047
|
+
this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
|
|
26048
|
+
let h = e.resolve(t);
|
|
26049
|
+
this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
|
|
26050
|
+
let a = h.substring(this.rootPath.length).split(s);
|
|
26051
|
+
if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
26052
|
+
this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
|
|
26053
|
+
let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
|
|
26054
|
+
for (let m of a) {
|
|
26055
|
+
let p = u--;
|
|
26056
|
+
l = l.child(m, {
|
|
26057
|
+
relative: new Array(p).fill("..").join(c),
|
|
26058
|
+
relativePosix: new Array(p).fill("..").join("/"),
|
|
26059
|
+
fullpath: d += (f ? "" : c) + m
|
|
26060
|
+
}), f = !0;
|
|
26061
|
+
}
|
|
26062
|
+
this.cwd = l;
|
|
26063
|
+
}
|
|
26064
|
+
depth(t = this.cwd) {
|
|
26065
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
|
|
26066
|
+
}
|
|
26067
|
+
childrenCache() {
|
|
26068
|
+
return this.#n;
|
|
26069
|
+
}
|
|
26070
|
+
resolve(...t) {
|
|
26071
|
+
let e = "";
|
|
26072
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
26073
|
+
let o = t[r];
|
|
26074
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
|
|
26075
|
+
}
|
|
26076
|
+
let s = this.#t.get(e);
|
|
26077
|
+
if (s !== void 0) return s;
|
|
26078
|
+
let i = this.cwd.resolve(e).fullpath();
|
|
26079
|
+
return this.#t.set(e, i), i;
|
|
26080
|
+
}
|
|
26081
|
+
resolvePosix(...t) {
|
|
26082
|
+
let e = "";
|
|
26083
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
26084
|
+
let o = t[r];
|
|
26085
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
|
|
26086
|
+
}
|
|
26087
|
+
let s = this.#s.get(e);
|
|
26088
|
+
if (s !== void 0) return s;
|
|
26089
|
+
let i = this.cwd.resolve(e).fullpathPosix();
|
|
26090
|
+
return this.#s.set(e, i), i;
|
|
26091
|
+
}
|
|
26092
|
+
relative(t = this.cwd) {
|
|
26093
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
|
|
26094
|
+
}
|
|
26095
|
+
relativePosix(t = this.cwd) {
|
|
26096
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
|
|
26097
|
+
}
|
|
26098
|
+
basename(t = this.cwd) {
|
|
26099
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
|
|
26100
|
+
}
|
|
26101
|
+
dirname(t = this.cwd) {
|
|
26102
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
26103
|
+
}
|
|
26104
|
+
async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
26105
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26106
|
+
let { withFileTypes: s } = e;
|
|
26107
|
+
if (t.canReaddir()) {
|
|
26108
|
+
let i = await t.readdir();
|
|
26109
|
+
return s ? i : i.map((r) => r.name);
|
|
26110
|
+
} else return [];
|
|
26111
|
+
}
|
|
26112
|
+
readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
26113
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26114
|
+
let { withFileTypes: s = !0 } = e;
|
|
26115
|
+
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
26116
|
+
}
|
|
26117
|
+
async lstat(t = this.cwd) {
|
|
26118
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
|
|
26119
|
+
}
|
|
26120
|
+
lstatSync(t = this.cwd) {
|
|
26121
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
26122
|
+
}
|
|
26123
|
+
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
26124
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
26125
|
+
let s = await t.readlink();
|
|
26126
|
+
return e ? s : s?.fullpath();
|
|
26127
|
+
}
|
|
26128
|
+
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
26129
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
26130
|
+
let s = t.readlinkSync();
|
|
26131
|
+
return e ? s : s?.fullpath();
|
|
26132
|
+
}
|
|
26133
|
+
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
26134
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
26135
|
+
let s = await t.realpath();
|
|
26136
|
+
return e ? s : s?.fullpath();
|
|
26137
|
+
}
|
|
26138
|
+
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
26139
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
26140
|
+
let s = t.realpathSync();
|
|
26141
|
+
return e ? s : s?.fullpath();
|
|
26142
|
+
}
|
|
26143
|
+
async walk(t = this.cwd, e = {}) {
|
|
26144
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26145
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
26146
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
26147
|
+
let a = /* @__PURE__ */ new Set(), l = (c, d) => {
|
|
26148
|
+
a.add(c), c.readdirCB((f, m) => {
|
|
26149
|
+
if (f) return d(f);
|
|
26150
|
+
let p = m.length;
|
|
26151
|
+
if (!p) return d();
|
|
26152
|
+
let w = () => {
|
|
26153
|
+
--p === 0 && d();
|
|
26154
|
+
};
|
|
26155
|
+
for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
|
|
26156
|
+
}, !0);
|
|
26157
|
+
}, u = t;
|
|
26158
|
+
return new Promise((c, d) => {
|
|
26159
|
+
l(u, (f) => {
|
|
26160
|
+
if (f) return d(f);
|
|
26161
|
+
c(h);
|
|
26162
|
+
});
|
|
26163
|
+
});
|
|
26164
|
+
}
|
|
26165
|
+
walkSync(t = this.cwd, e = {}) {
|
|
26166
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26167
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
26168
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
26169
|
+
let a = new Set([t]);
|
|
26170
|
+
for (let l of a) {
|
|
26171
|
+
let u = l.readdirSync();
|
|
26172
|
+
for (let c of u) {
|
|
26173
|
+
(!r || r(c)) && h.push(s ? c : c.fullpath());
|
|
26174
|
+
let d = c;
|
|
26175
|
+
if (c.isSymbolicLink()) {
|
|
26176
|
+
if (!(i && (d = c.realpathSync()))) continue;
|
|
26177
|
+
d.isUnknown() && d.lstatSync();
|
|
26178
|
+
}
|
|
26179
|
+
d.shouldWalk(a, o) && a.add(d);
|
|
26180
|
+
}
|
|
26181
|
+
}
|
|
26182
|
+
return h;
|
|
26183
|
+
}
|
|
26184
|
+
[Symbol.asyncIterator]() {
|
|
26185
|
+
return this.iterate();
|
|
26186
|
+
}
|
|
26187
|
+
iterate(t = this.cwd, e = {}) {
|
|
26188
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
26189
|
+
}
|
|
26190
|
+
[Symbol.iterator]() {
|
|
26191
|
+
return this.iterateSync();
|
|
26192
|
+
}
|
|
26193
|
+
*iterateSync(t = this.cwd, e = {}) {
|
|
26194
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26195
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
|
|
26196
|
+
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
26197
|
+
let h = new Set([t]);
|
|
26198
|
+
for (let a of h) {
|
|
26199
|
+
let l = a.readdirSync();
|
|
26200
|
+
for (let u of l) {
|
|
26201
|
+
(!r || r(u)) && (yield s ? u : u.fullpath());
|
|
26202
|
+
let c = u;
|
|
26203
|
+
if (u.isSymbolicLink()) {
|
|
26204
|
+
if (!(i && (c = u.realpathSync()))) continue;
|
|
26205
|
+
c.isUnknown() && c.lstatSync();
|
|
26206
|
+
}
|
|
26207
|
+
c.shouldWalk(h, o) && h.add(c);
|
|
26208
|
+
}
|
|
26209
|
+
}
|
|
26210
|
+
}
|
|
26211
|
+
stream(t = this.cwd, e = {}) {
|
|
26212
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26213
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
|
|
26214
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
26215
|
+
let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
|
|
26216
|
+
let d = !1;
|
|
26217
|
+
for (; !d;) {
|
|
26218
|
+
let f = l.shift();
|
|
26219
|
+
if (!f) {
|
|
26220
|
+
u === 0 && h.end();
|
|
26221
|
+
return;
|
|
26222
|
+
}
|
|
26223
|
+
u++, a.add(f);
|
|
26224
|
+
let m = (w, g, S = !1) => {
|
|
26225
|
+
if (w) return h.emit("error", w);
|
|
26226
|
+
if (i && !S) {
|
|
26227
|
+
let E = [];
|
|
26228
|
+
for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
|
|
26229
|
+
if (E.length) {
|
|
26230
|
+
Promise.all(E).then(() => m(null, g, !0));
|
|
26231
|
+
return;
|
|
26232
|
+
}
|
|
26233
|
+
}
|
|
26234
|
+
for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
|
|
26235
|
+
u--;
|
|
26236
|
+
for (let E of g) {
|
|
26237
|
+
let y = E.realpathCached() || E;
|
|
26238
|
+
y.shouldWalk(a, o) && l.push(y);
|
|
26239
|
+
}
|
|
26240
|
+
d && !h.flowing ? h.once("drain", c) : p || c();
|
|
26241
|
+
}, p = !0;
|
|
26242
|
+
f.readdirCB(m, !0), p = !1;
|
|
26243
|
+
}
|
|
26244
|
+
};
|
|
26245
|
+
return c(), h;
|
|
26246
|
+
}
|
|
26247
|
+
streamSync(t = this.cwd, e = {}) {
|
|
26248
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
26249
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
|
|
26250
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
26251
|
+
let l = [t], u = 0, c = () => {
|
|
26252
|
+
let d = !1;
|
|
26253
|
+
for (; !d;) {
|
|
26254
|
+
let f = l.shift();
|
|
26255
|
+
if (!f) {
|
|
26256
|
+
u === 0 && h.end();
|
|
26257
|
+
return;
|
|
26258
|
+
}
|
|
26259
|
+
u++, a.add(f);
|
|
26260
|
+
let m = f.readdirSync();
|
|
26261
|
+
for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
|
|
26262
|
+
u--;
|
|
26263
|
+
for (let p of m) {
|
|
26264
|
+
let w = p;
|
|
26265
|
+
if (p.isSymbolicLink()) {
|
|
26266
|
+
if (!(i && (w = p.realpathSync()))) continue;
|
|
26267
|
+
w.isUnknown() && w.lstatSync();
|
|
26268
|
+
}
|
|
26269
|
+
w.shouldWalk(a, o) && l.push(w);
|
|
26270
|
+
}
|
|
26271
|
+
}
|
|
26272
|
+
d && !h.flowing && h.once("drain", c);
|
|
26273
|
+
};
|
|
26274
|
+
return c(), h;
|
|
26275
|
+
}
|
|
26276
|
+
chdir(t = this.cwd) {
|
|
26277
|
+
let e = this.cwd;
|
|
26278
|
+
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
|
|
26279
|
+
}
|
|
26280
|
+
}, it = class extends It {
|
|
26281
|
+
sep = "\\";
|
|
26282
|
+
constructor(t = process.cwd(), e = {}) {
|
|
26283
|
+
let { nocase: s = !0 } = e;
|
|
26284
|
+
super(t, win32, "\\", {
|
|
26285
|
+
...e,
|
|
26286
|
+
nocase: s
|
|
26287
|
+
}), this.nocase = s;
|
|
26288
|
+
for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
|
|
26289
|
+
}
|
|
26290
|
+
parseRootPath(t) {
|
|
26291
|
+
return win32.parse(t).root.toUpperCase();
|
|
26292
|
+
}
|
|
26293
|
+
newRoot(t) {
|
|
26294
|
+
return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
26295
|
+
}
|
|
26296
|
+
isAbsolute(t) {
|
|
26297
|
+
return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
|
|
26298
|
+
}
|
|
26299
|
+
}, rt = class extends It {
|
|
26300
|
+
sep = "/";
|
|
26301
|
+
constructor(t = process.cwd(), e = {}) {
|
|
26302
|
+
let { nocase: s = !1 } = e;
|
|
26303
|
+
super(t, posix, "/", {
|
|
26304
|
+
...e,
|
|
26305
|
+
nocase: s
|
|
26306
|
+
}), this.nocase = s;
|
|
26307
|
+
}
|
|
26308
|
+
parseRootPath(t) {
|
|
26309
|
+
return "/";
|
|
26310
|
+
}
|
|
26311
|
+
newRoot(t) {
|
|
26312
|
+
return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
26313
|
+
}
|
|
26314
|
+
isAbsolute(t) {
|
|
26315
|
+
return t.startsWith("/");
|
|
26316
|
+
}
|
|
26317
|
+
}, St = class extends rt {
|
|
26318
|
+
constructor(t = process.cwd(), e = {}) {
|
|
26319
|
+
let { nocase: s = !0 } = e;
|
|
26320
|
+
super(t, {
|
|
26321
|
+
...e,
|
|
26322
|
+
nocase: s
|
|
26323
|
+
});
|
|
26324
|
+
}
|
|
26325
|
+
};
|
|
26326
|
+
process.platform;
|
|
26327
|
+
var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
|
|
26328
|
+
var Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodejs.util.inspect.custom"), nt = class n {
|
|
26329
|
+
#t;
|
|
26330
|
+
#s;
|
|
26331
|
+
#n;
|
|
26332
|
+
length;
|
|
26333
|
+
#r;
|
|
26334
|
+
#o;
|
|
26335
|
+
#S;
|
|
26336
|
+
#w;
|
|
26337
|
+
#c;
|
|
26338
|
+
#h;
|
|
26339
|
+
#u = !0;
|
|
26340
|
+
constructor(t, e, s, i) {
|
|
26341
|
+
if (!Di(t)) throw new TypeError("empty pattern list");
|
|
26342
|
+
if (!Mi(e)) throw new TypeError("empty glob list");
|
|
26343
|
+
if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
|
|
26344
|
+
if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
|
|
26345
|
+
if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
|
|
26346
|
+
if (this.isUNC()) {
|
|
26347
|
+
let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
|
|
26348
|
+
l[0] === "" && (l.shift(), m.shift());
|
|
26349
|
+
let p = [
|
|
26350
|
+
r,
|
|
26351
|
+
o,
|
|
26352
|
+
h,
|
|
26353
|
+
a,
|
|
26354
|
+
""
|
|
26355
|
+
].join("/"), w = [
|
|
26356
|
+
u,
|
|
26357
|
+
c,
|
|
26358
|
+
d,
|
|
26359
|
+
f,
|
|
26360
|
+
""
|
|
26361
|
+
].join("/");
|
|
26362
|
+
this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
|
|
26363
|
+
} else if (this.isDrive() || this.isAbsolute()) {
|
|
26364
|
+
let [r, ...o] = this.#t, [h, ...a] = this.#s;
|
|
26365
|
+
o[0] === "" && (o.shift(), a.shift());
|
|
26366
|
+
let l = r + "/", u = h + "/";
|
|
26367
|
+
this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
|
|
26368
|
+
}
|
|
26369
|
+
}
|
|
26370
|
+
}
|
|
26371
|
+
[Ni]() {
|
|
26372
|
+
return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
|
|
26373
|
+
}
|
|
26374
|
+
pattern() {
|
|
26375
|
+
return this.#t[this.#n];
|
|
26376
|
+
}
|
|
26377
|
+
isString() {
|
|
26378
|
+
return typeof this.#t[this.#n] == "string";
|
|
26379
|
+
}
|
|
26380
|
+
isGlobstar() {
|
|
26381
|
+
return this.#t[this.#n] === A;
|
|
26382
|
+
}
|
|
26383
|
+
isRegExp() {
|
|
26384
|
+
return this.#t[this.#n] instanceof RegExp;
|
|
26385
|
+
}
|
|
26386
|
+
globString() {
|
|
26387
|
+
return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
|
|
26388
|
+
}
|
|
26389
|
+
hasMore() {
|
|
26390
|
+
return this.length > this.#n + 1;
|
|
26391
|
+
}
|
|
26392
|
+
rest() {
|
|
26393
|
+
return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
|
|
26394
|
+
}
|
|
26395
|
+
isUNC() {
|
|
26396
|
+
let t = this.#t;
|
|
26397
|
+
return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
|
|
26398
|
+
}
|
|
26399
|
+
isDrive() {
|
|
26400
|
+
let t = this.#t;
|
|
26401
|
+
return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
|
|
26402
|
+
}
|
|
26403
|
+
isAbsolute() {
|
|
26404
|
+
let t = this.#t;
|
|
26405
|
+
return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
26406
|
+
}
|
|
26407
|
+
root() {
|
|
26408
|
+
let t = this.#t[0];
|
|
26409
|
+
return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
|
|
26410
|
+
}
|
|
26411
|
+
checkFollowGlobstar() {
|
|
26412
|
+
return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
|
|
26413
|
+
}
|
|
26414
|
+
markFollowGlobstar() {
|
|
26415
|
+
return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
|
|
26416
|
+
}
|
|
26417
|
+
};
|
|
26418
|
+
var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ot = class {
|
|
26419
|
+
relative;
|
|
26420
|
+
relativeChildren;
|
|
26421
|
+
absolute;
|
|
26422
|
+
absoluteChildren;
|
|
26423
|
+
platform;
|
|
26424
|
+
mmopts;
|
|
26425
|
+
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
|
|
26426
|
+
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
|
|
26427
|
+
dot: !0,
|
|
26428
|
+
nobrace: e,
|
|
26429
|
+
nocase: s,
|
|
26430
|
+
noext: i,
|
|
26431
|
+
noglobstar: r,
|
|
26432
|
+
optimizationLevel: 2,
|
|
26433
|
+
platform: o,
|
|
26434
|
+
nocomment: !0,
|
|
26435
|
+
nonegate: !0
|
|
26436
|
+
};
|
|
26437
|
+
for (let h of t) this.add(h);
|
|
26438
|
+
}
|
|
26439
|
+
add(t) {
|
|
26440
|
+
let e = new D(t, this.mmopts);
|
|
26441
|
+
for (let s = 0; s < e.set.length; s++) {
|
|
26442
|
+
let i = e.set[s], r = e.globParts[s];
|
|
26443
|
+
if (!i || !r) throw new Error("invalid pattern object");
|
|
26444
|
+
for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
|
|
26445
|
+
let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
|
|
26446
|
+
l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
26447
|
+
}
|
|
26448
|
+
}
|
|
26449
|
+
ignored(t) {
|
|
26450
|
+
let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
|
|
26451
|
+
for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
|
|
26452
|
+
for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
|
|
26453
|
+
return !1;
|
|
26454
|
+
}
|
|
26455
|
+
childrenIgnored(t) {
|
|
26456
|
+
let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
|
|
26457
|
+
for (let i of this.relativeChildren) if (i.match(s)) return !0;
|
|
26458
|
+
for (let i of this.absoluteChildren) if (i.match(e)) return !0;
|
|
26459
|
+
return !1;
|
|
26460
|
+
}
|
|
26461
|
+
};
|
|
26462
|
+
var oe = class n {
|
|
26463
|
+
store;
|
|
26464
|
+
constructor(t = /* @__PURE__ */ new Map()) {
|
|
26465
|
+
this.store = t;
|
|
26466
|
+
}
|
|
26467
|
+
copy() {
|
|
26468
|
+
return new n(new Map(this.store));
|
|
26469
|
+
}
|
|
26470
|
+
hasWalked(t, e) {
|
|
26471
|
+
return this.store.get(t.fullpath())?.has(e.globString());
|
|
26472
|
+
}
|
|
26473
|
+
storeWalked(t, e) {
|
|
26474
|
+
let s = t.fullpath(), i = this.store.get(s);
|
|
26475
|
+
i ? i.add(e.globString()) : this.store.set(s, new Set([e.globString()]));
|
|
26476
|
+
}
|
|
26477
|
+
}, he = class {
|
|
26478
|
+
store = /* @__PURE__ */ new Map();
|
|
26479
|
+
add(t, e, s) {
|
|
26480
|
+
let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
|
|
26481
|
+
this.store.set(t, r === void 0 ? i : i & r);
|
|
26482
|
+
}
|
|
26483
|
+
entries() {
|
|
26484
|
+
return [...this.store.entries()].map(([t, e]) => [
|
|
26485
|
+
t,
|
|
26486
|
+
!!(e & 2),
|
|
26487
|
+
!!(e & 1)
|
|
26488
|
+
]);
|
|
26489
|
+
}
|
|
26490
|
+
}, ae = class {
|
|
26491
|
+
store = /* @__PURE__ */ new Map();
|
|
26492
|
+
add(t, e) {
|
|
26493
|
+
if (!t.canReaddir()) return;
|
|
26494
|
+
let s = this.store.get(t);
|
|
26495
|
+
s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
|
|
26496
|
+
}
|
|
26497
|
+
get(t) {
|
|
26498
|
+
let e = this.store.get(t);
|
|
26499
|
+
if (!e) throw new Error("attempting to walk unknown path");
|
|
26500
|
+
return e;
|
|
26501
|
+
}
|
|
26502
|
+
entries() {
|
|
26503
|
+
return this.keys().map((t) => [t, this.store.get(t)]);
|
|
26504
|
+
}
|
|
26505
|
+
keys() {
|
|
26506
|
+
return [...this.store.keys()].filter((t) => t.canReaddir());
|
|
26507
|
+
}
|
|
26508
|
+
}, Et = class n {
|
|
26509
|
+
hasWalkedCache;
|
|
26510
|
+
matches = new he();
|
|
26511
|
+
subwalks = new ae();
|
|
26512
|
+
patterns;
|
|
26513
|
+
follow;
|
|
26514
|
+
dot;
|
|
26515
|
+
opts;
|
|
26516
|
+
constructor(t, e) {
|
|
26517
|
+
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
|
|
26518
|
+
}
|
|
26519
|
+
processPatterns(t, e) {
|
|
26520
|
+
this.patterns = e;
|
|
26521
|
+
let s = e.map((i) => [t, i]);
|
|
26522
|
+
for (let [i, r] of s) {
|
|
26523
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
26524
|
+
let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
|
|
26525
|
+
if (o) {
|
|
26526
|
+
i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
|
|
26527
|
+
let c = r.rest();
|
|
26528
|
+
if (c) r = c;
|
|
26529
|
+
else {
|
|
26530
|
+
this.matches.add(i, !0, !1);
|
|
26531
|
+
continue;
|
|
26532
|
+
}
|
|
26533
|
+
}
|
|
26534
|
+
if (i.isENOENT()) continue;
|
|
26535
|
+
let a, l, u = !1;
|
|
26536
|
+
for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
|
|
26537
|
+
if (a = r.pattern(), l = r.rest(), u) {
|
|
26538
|
+
if (this.hasWalkedCache.hasWalked(i, r)) continue;
|
|
26539
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
26540
|
+
}
|
|
26541
|
+
if (typeof a == "string") {
|
|
26542
|
+
let c = a === ".." || a === "" || a === ".";
|
|
26543
|
+
this.matches.add(i.resolve(a), h, c);
|
|
26544
|
+
continue;
|
|
26545
|
+
} else if (a === A) {
|
|
26546
|
+
(!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
|
|
26547
|
+
let c = l?.pattern(), d = l?.rest();
|
|
26548
|
+
if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
|
|
26549
|
+
else if (c === "..") {
|
|
26550
|
+
let f = i.parent || i;
|
|
26551
|
+
d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
|
|
26552
|
+
}
|
|
26553
|
+
} else a instanceof RegExp && this.subwalks.add(i, r);
|
|
26554
|
+
}
|
|
26555
|
+
return this;
|
|
26556
|
+
}
|
|
26557
|
+
subwalkTargets() {
|
|
26558
|
+
return this.subwalks.keys();
|
|
26559
|
+
}
|
|
26560
|
+
child() {
|
|
26561
|
+
return new n(this.opts, this.hasWalkedCache);
|
|
26562
|
+
}
|
|
26563
|
+
filterEntries(t, e) {
|
|
26564
|
+
let s = this.subwalks.get(t), i = this.child();
|
|
26565
|
+
for (let r of e) for (let o of s) {
|
|
26566
|
+
let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
|
|
26567
|
+
a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
|
|
26568
|
+
}
|
|
26569
|
+
return i;
|
|
26570
|
+
}
|
|
26571
|
+
testGlobstar(t, e, s, i) {
|
|
26572
|
+
if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
|
|
26573
|
+
let r = s.pattern();
|
|
26574
|
+
if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
|
|
26575
|
+
else if (r === "..") {
|
|
26576
|
+
let o = t.parent || t;
|
|
26577
|
+
this.subwalks.add(o, s);
|
|
26578
|
+
} else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
|
|
26579
|
+
}
|
|
26580
|
+
}
|
|
26581
|
+
testRegExp(t, e, s, i) {
|
|
26582
|
+
e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
26583
|
+
}
|
|
26584
|
+
testString(t, e, s, i) {
|
|
26585
|
+
t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
26586
|
+
}
|
|
26587
|
+
};
|
|
26588
|
+
var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
|
|
26589
|
+
path;
|
|
26590
|
+
patterns;
|
|
26591
|
+
opts;
|
|
26592
|
+
seen = /* @__PURE__ */ new Set();
|
|
26593
|
+
paused = !1;
|
|
26594
|
+
aborted = !1;
|
|
26595
|
+
#t = [];
|
|
26596
|
+
#s;
|
|
26597
|
+
#n;
|
|
26598
|
+
signal;
|
|
26599
|
+
maxDepth;
|
|
26600
|
+
includeChildMatches;
|
|
26601
|
+
constructor(t, e, s) {
|
|
26602
|
+
if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
|
|
26603
|
+
this.maxDepth = s.maxDepth || Infinity, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
|
|
26604
|
+
this.#t.length = 0;
|
|
26605
|
+
}));
|
|
26606
|
+
}
|
|
26607
|
+
#r(t) {
|
|
26608
|
+
return this.seen.has(t) || !!this.#s?.ignored?.(t);
|
|
26609
|
+
}
|
|
26610
|
+
#o(t) {
|
|
26611
|
+
return !!this.#s?.childrenIgnored?.(t);
|
|
26612
|
+
}
|
|
26613
|
+
pause() {
|
|
26614
|
+
this.paused = !0;
|
|
26615
|
+
}
|
|
26616
|
+
resume() {
|
|
26617
|
+
if (this.signal?.aborted) return;
|
|
26618
|
+
this.paused = !1;
|
|
26619
|
+
let t;
|
|
26620
|
+
for (; !this.paused && (t = this.#t.shift());) t();
|
|
26621
|
+
}
|
|
26622
|
+
onResume(t) {
|
|
26623
|
+
this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
|
|
26624
|
+
}
|
|
26625
|
+
async matchCheck(t, e) {
|
|
26626
|
+
if (e && this.opts.nodir) return;
|
|
26627
|
+
let s;
|
|
26628
|
+
if (this.opts.realpath) {
|
|
26629
|
+
if (s = t.realpathCached() || await t.realpath(), !s) return;
|
|
26630
|
+
t = s;
|
|
26631
|
+
}
|
|
26632
|
+
let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
|
|
26633
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
26634
|
+
let o = await r.realpath();
|
|
26635
|
+
o && (o.isUnknown() || this.opts.stat) && await o.lstat();
|
|
26636
|
+
}
|
|
26637
|
+
return this.matchCheckTest(r, e);
|
|
26638
|
+
}
|
|
26639
|
+
matchCheckTest(t, e) {
|
|
26640
|
+
return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
|
|
26641
|
+
}
|
|
26642
|
+
matchCheckSync(t, e) {
|
|
26643
|
+
if (e && this.opts.nodir) return;
|
|
26644
|
+
let s;
|
|
26645
|
+
if (this.opts.realpath) {
|
|
26646
|
+
if (s = t.realpathCached() || t.realpathSync(), !s) return;
|
|
26647
|
+
t = s;
|
|
26648
|
+
}
|
|
26649
|
+
let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
|
|
26650
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
26651
|
+
let o = r.realpathSync();
|
|
26652
|
+
o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
|
|
26653
|
+
}
|
|
26654
|
+
return this.matchCheckTest(r, e);
|
|
26655
|
+
}
|
|
26656
|
+
matchFinish(t, e) {
|
|
26657
|
+
if (this.#r(t)) return;
|
|
26658
|
+
if (!this.includeChildMatches && this.#s?.add) {
|
|
26659
|
+
let r = `${t.relativePosix()}/**`;
|
|
26660
|
+
this.#s.add(r);
|
|
26661
|
+
}
|
|
26662
|
+
let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
|
|
26663
|
+
this.seen.add(t);
|
|
26664
|
+
let i = this.opts.mark && t.isDirectory() ? this.#n : "";
|
|
26665
|
+
if (this.opts.withFileTypes) this.matchEmit(t);
|
|
26666
|
+
else if (s) {
|
|
26667
|
+
let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
|
|
26668
|
+
this.matchEmit(r + i);
|
|
26669
|
+
} else {
|
|
26670
|
+
let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
|
|
26671
|
+
this.matchEmit(r ? o + r + i : "." + i);
|
|
26672
|
+
}
|
|
26673
|
+
}
|
|
26674
|
+
async match(t, e, s) {
|
|
26675
|
+
let i = await this.matchCheck(t, s);
|
|
26676
|
+
i && this.matchFinish(i, e);
|
|
26677
|
+
}
|
|
26678
|
+
matchSync(t, e, s) {
|
|
26679
|
+
let i = this.matchCheckSync(t, s);
|
|
26680
|
+
i && this.matchFinish(i, e);
|
|
26681
|
+
}
|
|
26682
|
+
walkCB(t, e, s) {
|
|
26683
|
+
this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
|
|
26684
|
+
}
|
|
26685
|
+
walkCB2(t, e, s, i) {
|
|
26686
|
+
if (this.#o(t)) return i();
|
|
26687
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
26688
|
+
this.onResume(() => this.walkCB2(t, e, s, i));
|
|
26689
|
+
return;
|
|
26690
|
+
}
|
|
26691
|
+
s.processPatterns(t, e);
|
|
26692
|
+
let r = 1, o = () => {
|
|
26693
|
+
--r === 0 && i();
|
|
26694
|
+
};
|
|
26695
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
26696
|
+
for (let h of s.subwalkTargets()) {
|
|
26697
|
+
if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
|
|
26698
|
+
r++;
|
|
26699
|
+
let a = h.readdirCached();
|
|
26700
|
+
h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
|
|
26701
|
+
}
|
|
26702
|
+
o();
|
|
26703
|
+
}
|
|
26704
|
+
walkCB3(t, e, s, i) {
|
|
26705
|
+
s = s.filterEntries(t, e);
|
|
26706
|
+
let r = 1, o = () => {
|
|
26707
|
+
--r === 0 && i();
|
|
26708
|
+
};
|
|
26709
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
26710
|
+
for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
|
|
26711
|
+
o();
|
|
26712
|
+
}
|
|
26713
|
+
walkCBSync(t, e, s) {
|
|
26714
|
+
this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
|
|
26715
|
+
}
|
|
26716
|
+
walkCB2Sync(t, e, s, i) {
|
|
26717
|
+
if (this.#o(t)) return i();
|
|
26718
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
26719
|
+
this.onResume(() => this.walkCB2Sync(t, e, s, i));
|
|
26720
|
+
return;
|
|
26721
|
+
}
|
|
26722
|
+
s.processPatterns(t, e);
|
|
26723
|
+
let r = 1, o = () => {
|
|
26724
|
+
--r === 0 && i();
|
|
26725
|
+
};
|
|
26726
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
|
|
26727
|
+
for (let h of s.subwalkTargets()) {
|
|
26728
|
+
if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
|
|
26729
|
+
r++;
|
|
26730
|
+
let a = h.readdirSync();
|
|
26731
|
+
this.walkCB3Sync(h, a, s, o);
|
|
26732
|
+
}
|
|
26733
|
+
o();
|
|
26734
|
+
}
|
|
26735
|
+
walkCB3Sync(t, e, s, i) {
|
|
26736
|
+
s = s.filterEntries(t, e);
|
|
26737
|
+
let r = 1, o = () => {
|
|
26738
|
+
--r === 0 && i();
|
|
26739
|
+
};
|
|
26740
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
|
|
26741
|
+
for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
|
|
26742
|
+
o();
|
|
26743
|
+
}
|
|
26744
|
+
}, xt = class extends zt {
|
|
26745
|
+
matches = /* @__PURE__ */ new Set();
|
|
26746
|
+
constructor(t, e, s) {
|
|
26747
|
+
super(t, e, s);
|
|
26748
|
+
}
|
|
26749
|
+
matchEmit(t) {
|
|
26750
|
+
this.matches.add(t);
|
|
26751
|
+
}
|
|
26752
|
+
async walk() {
|
|
26753
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
26754
|
+
return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
|
|
26755
|
+
this.walkCB(this.path, this.patterns, () => {
|
|
26756
|
+
this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
|
|
26757
|
+
});
|
|
26758
|
+
}), this.matches;
|
|
26759
|
+
}
|
|
26760
|
+
walkSync() {
|
|
26761
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
26762
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
|
|
26763
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
26764
|
+
}), this.matches;
|
|
26765
|
+
}
|
|
26766
|
+
}, vt = class extends zt {
|
|
26767
|
+
results;
|
|
26768
|
+
constructor(t, e, s) {
|
|
26769
|
+
super(t, e, s), this.results = new V({
|
|
26770
|
+
signal: this.signal,
|
|
26771
|
+
objectMode: !0
|
|
26772
|
+
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
26773
|
+
}
|
|
26774
|
+
matchEmit(t) {
|
|
26775
|
+
this.results.write(t), this.results.flowing || this.pause();
|
|
26776
|
+
}
|
|
26777
|
+
stream() {
|
|
26778
|
+
let t = this.path;
|
|
26779
|
+
return t.isUnknown() ? t.lstat().then(() => {
|
|
26780
|
+
this.walkCB(t, this.patterns, () => this.results.end());
|
|
26781
|
+
}) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
|
|
26782
|
+
}
|
|
26783
|
+
streamSync() {
|
|
26784
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
26785
|
+
}
|
|
26786
|
+
};
|
|
26787
|
+
var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
|
|
26788
|
+
absolute;
|
|
26789
|
+
cwd;
|
|
26790
|
+
root;
|
|
26791
|
+
dot;
|
|
26792
|
+
dotRelative;
|
|
26793
|
+
follow;
|
|
26794
|
+
ignore;
|
|
26795
|
+
magicalBraces;
|
|
26796
|
+
mark;
|
|
26797
|
+
matchBase;
|
|
26798
|
+
maxDepth;
|
|
26799
|
+
nobrace;
|
|
26800
|
+
nocase;
|
|
26801
|
+
nodir;
|
|
26802
|
+
noext;
|
|
26803
|
+
noglobstar;
|
|
26804
|
+
pattern;
|
|
26805
|
+
platform;
|
|
26806
|
+
realpath;
|
|
26807
|
+
scurry;
|
|
26808
|
+
stat;
|
|
26809
|
+
signal;
|
|
26810
|
+
windowsPathsNoEscape;
|
|
26811
|
+
withFileTypes;
|
|
26812
|
+
includeChildMatches;
|
|
26813
|
+
opts;
|
|
26814
|
+
patterns;
|
|
26815
|
+
constructor(t, e) {
|
|
26816
|
+
if (!e) throw new TypeError("glob options required");
|
|
26817
|
+
if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : Infinity, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
|
|
26818
|
+
if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
|
|
26819
|
+
if (e.noglobstar) throw new TypeError("base matching requires globstar");
|
|
26820
|
+
t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
|
|
26821
|
+
}
|
|
26822
|
+
if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
|
|
26823
|
+
...e,
|
|
26824
|
+
platform: this.platform
|
|
26825
|
+
}, e.scurry) {
|
|
26826
|
+
if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
|
|
26827
|
+
} else this.scurry = new (e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe)(this.cwd, {
|
|
26828
|
+
nocase: e.nocase,
|
|
26829
|
+
fs: e.fs
|
|
26830
|
+
});
|
|
26831
|
+
this.nocase = this.scurry.nocase;
|
|
26832
|
+
let s = this.platform === "darwin" || this.platform === "win32", i = {
|
|
26833
|
+
braceExpandMax: 1e4,
|
|
26834
|
+
...e,
|
|
26835
|
+
dot: this.dot,
|
|
26836
|
+
matchBase: this.matchBase,
|
|
26837
|
+
nobrace: this.nobrace,
|
|
26838
|
+
nocase: this.nocase,
|
|
26839
|
+
nocaseMagicOnly: s,
|
|
26840
|
+
nocomment: !0,
|
|
26841
|
+
noext: this.noext,
|
|
26842
|
+
nonegate: !0,
|
|
26843
|
+
optimizationLevel: 2,
|
|
26844
|
+
platform: this.platform,
|
|
26845
|
+
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
26846
|
+
debug: !!this.opts.debug
|
|
26847
|
+
}, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
|
|
26848
|
+
this.patterns = o.map((a, l) => {
|
|
26849
|
+
let u = h[l];
|
|
26850
|
+
if (!u) throw new Error("invalid pattern object");
|
|
26851
|
+
return new nt(a, u, 0, this.platform);
|
|
26852
|
+
});
|
|
26853
|
+
}
|
|
26854
|
+
async walk() {
|
|
26855
|
+
return [...await new xt(this.patterns, this.scurry.cwd, {
|
|
26856
|
+
...this.opts,
|
|
26857
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
26858
|
+
platform: this.platform,
|
|
26859
|
+
nocase: this.nocase,
|
|
26860
|
+
includeChildMatches: this.includeChildMatches
|
|
26861
|
+
}).walk()];
|
|
26862
|
+
}
|
|
26863
|
+
walkSync() {
|
|
26864
|
+
return [...new xt(this.patterns, this.scurry.cwd, {
|
|
26865
|
+
...this.opts,
|
|
26866
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
26867
|
+
platform: this.platform,
|
|
26868
|
+
nocase: this.nocase,
|
|
26869
|
+
includeChildMatches: this.includeChildMatches
|
|
26870
|
+
}).walkSync()];
|
|
26871
|
+
}
|
|
26872
|
+
stream() {
|
|
26873
|
+
return new vt(this.patterns, this.scurry.cwd, {
|
|
26874
|
+
...this.opts,
|
|
26875
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
26876
|
+
platform: this.platform,
|
|
26877
|
+
nocase: this.nocase,
|
|
26878
|
+
includeChildMatches: this.includeChildMatches
|
|
26879
|
+
}).stream();
|
|
26880
|
+
}
|
|
26881
|
+
streamSync() {
|
|
26882
|
+
return new vt(this.patterns, this.scurry.cwd, {
|
|
26883
|
+
...this.opts,
|
|
26884
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
26885
|
+
platform: this.platform,
|
|
26886
|
+
nocase: this.nocase,
|
|
26887
|
+
includeChildMatches: this.includeChildMatches
|
|
26888
|
+
}).streamSync();
|
|
26889
|
+
}
|
|
26890
|
+
iterateSync() {
|
|
26891
|
+
return this.streamSync()[Symbol.iterator]();
|
|
26892
|
+
}
|
|
26893
|
+
[Symbol.iterator]() {
|
|
26894
|
+
return this.iterateSync();
|
|
26895
|
+
}
|
|
26896
|
+
iterate() {
|
|
26897
|
+
return this.stream()[Symbol.asyncIterator]();
|
|
26898
|
+
}
|
|
26899
|
+
[Symbol.asyncIterator]() {
|
|
26900
|
+
return this.iterate();
|
|
26901
|
+
}
|
|
26902
|
+
};
|
|
26903
|
+
var le = (n, t = {}) => {
|
|
26904
|
+
Array.isArray(n) || (n = [n]);
|
|
26905
|
+
for (let e of n) if (new D(e, t).hasMagic()) return !0;
|
|
26906
|
+
return !1;
|
|
26907
|
+
};
|
|
26908
|
+
function Bt(n, t = {}) {
|
|
26909
|
+
return new I(n, t).streamSync();
|
|
26910
|
+
}
|
|
26911
|
+
function Qe(n, t = {}) {
|
|
26912
|
+
return new I(n, t).stream();
|
|
26913
|
+
}
|
|
26914
|
+
function ts(n, t = {}) {
|
|
26915
|
+
return new I(n, t).walkSync();
|
|
26916
|
+
}
|
|
26917
|
+
async function Je(n, t = {}) {
|
|
26918
|
+
return new I(n, t).walk();
|
|
26919
|
+
}
|
|
26920
|
+
function Ut(n, t = {}) {
|
|
26921
|
+
return new I(n, t).iterateSync();
|
|
26922
|
+
}
|
|
26923
|
+
function es(n, t = {}) {
|
|
26924
|
+
return new I(n, t).iterate();
|
|
26925
|
+
}
|
|
26926
|
+
var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
|
|
26927
|
+
stream: Bt,
|
|
26928
|
+
iterate: Ut
|
|
26929
|
+
}), Ze = Object.assign(Je, {
|
|
26930
|
+
glob: Je,
|
|
26931
|
+
globSync: ts,
|
|
26932
|
+
sync: Ui,
|
|
26933
|
+
globStream: Qe,
|
|
26934
|
+
stream: Ii,
|
|
26935
|
+
globStreamSync: Bt,
|
|
26936
|
+
streamSync: ji,
|
|
26937
|
+
globIterate: es,
|
|
26938
|
+
iterate: Bi,
|
|
26939
|
+
globIterateSync: Ut,
|
|
26940
|
+
iterateSync: zi,
|
|
26941
|
+
Glob: I,
|
|
26942
|
+
hasMagic: le,
|
|
26943
|
+
escape: tt,
|
|
26944
|
+
unescape: W
|
|
26945
|
+
});
|
|
26946
|
+
Ze.glob = Ze;
|
|
26947
|
+
//#endregion
|
|
26948
|
+
//#region ../core/src/worktree/glob-resolver.ts
|
|
26949
|
+
var GlobResolutionError = class extends Error {
|
|
26950
|
+
pattern;
|
|
26951
|
+
constructor(pattern, message) {
|
|
26952
|
+
super(`Failed to resolve pattern '${pattern}': ${message}`);
|
|
26953
|
+
this.name = "GlobResolutionError";
|
|
26954
|
+
this.pattern = pattern;
|
|
26955
|
+
}
|
|
26956
|
+
};
|
|
26957
|
+
function normalizePatternPath(filePath) {
|
|
26958
|
+
return filePath.replace(/\\/g, "/");
|
|
26959
|
+
}
|
|
26960
|
+
/**
|
|
26961
|
+
* Resolve glob patterns to actual file paths
|
|
26962
|
+
*
|
|
26963
|
+
* @param gitRoot - The git repository root directory
|
|
26964
|
+
* @param patterns - Array of file paths or glob patterns
|
|
26965
|
+
* @returns Result containing resolved files and pattern details, or error
|
|
26966
|
+
*/
|
|
26967
|
+
async function resolveGlobPatterns(gitRoot, patterns) {
|
|
26968
|
+
const allFiles = /* @__PURE__ */ new Set();
|
|
26969
|
+
const resolutionDetails = [];
|
|
26970
|
+
for (const pattern of patterns) {
|
|
26971
|
+
const normalizedPattern = normalizePatternPath(pattern);
|
|
26972
|
+
try {
|
|
26973
|
+
const resolvedFiles = le(normalizedPattern, { magicalBraces: true }) ? await Ze(normalizedPattern, {
|
|
26974
|
+
cwd: gitRoot,
|
|
26975
|
+
dot: true,
|
|
26976
|
+
ignore: ".git/**",
|
|
26977
|
+
nodir: true,
|
|
26978
|
+
posix: true
|
|
26979
|
+
}) : [normalizedPattern];
|
|
26980
|
+
for (const file of resolvedFiles) allFiles.add(file);
|
|
26981
|
+
resolutionDetails.push({
|
|
26982
|
+
pattern,
|
|
26983
|
+
resolvedFiles
|
|
26984
|
+
});
|
|
26985
|
+
} catch (error) {
|
|
26986
|
+
return err(new GlobResolutionError(pattern, error instanceof Error ? error.message : String(error)));
|
|
26987
|
+
}
|
|
26988
|
+
}
|
|
26989
|
+
return ok({
|
|
26990
|
+
resolvedFiles: Array.from(allFiles),
|
|
26991
|
+
patterns: resolutionDetails
|
|
26992
|
+
});
|
|
26993
|
+
}
|
|
26994
|
+
//#endregion
|
|
26995
|
+
//#region ../core/src/worktree/file-copier.ts
|
|
26996
|
+
var FileCopyError = class extends Error {
|
|
26997
|
+
file;
|
|
26998
|
+
constructor(file, message) {
|
|
26999
|
+
super(`Failed to copy ${file}: ${message}`);
|
|
27000
|
+
this.name = "FileCopyError";
|
|
27001
|
+
this.file = file;
|
|
27002
|
+
}
|
|
27003
|
+
};
|
|
27004
|
+
async function copyFiles(sourceDir, targetDir, files) {
|
|
27005
|
+
const resolveResult = await resolveGlobPatterns(sourceDir, files);
|
|
27006
|
+
if (isErr(resolveResult)) return resolveResult;
|
|
27007
|
+
const resolvedFiles = resolveResult.value.resolvedFiles;
|
|
27008
|
+
const copiedFiles = [];
|
|
27009
|
+
const skippedFiles = [];
|
|
27010
|
+
for (const file of resolvedFiles) {
|
|
27011
|
+
const sourcePath = path.join(sourceDir, file);
|
|
27012
|
+
const targetPath = path.join(targetDir, file);
|
|
27013
|
+
try {
|
|
27014
|
+
if (!(await stat(sourcePath)).isFile()) {
|
|
27015
|
+
skippedFiles.push(file);
|
|
27016
|
+
continue;
|
|
27017
|
+
}
|
|
27018
|
+
await mkdir(path.dirname(targetPath), { recursive: true });
|
|
27019
|
+
await copyFile(sourcePath, targetPath);
|
|
27020
|
+
copiedFiles.push(file);
|
|
27021
|
+
} catch (error) {
|
|
27022
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") skippedFiles.push(file);
|
|
27023
|
+
else return err(new FileCopyError(file, error instanceof Error ? error.message : String(error)));
|
|
27024
|
+
}
|
|
27025
|
+
}
|
|
27026
|
+
return ok({
|
|
27027
|
+
copiedFiles,
|
|
27028
|
+
skippedFiles
|
|
27029
|
+
});
|
|
27030
|
+
}
|
|
27031
|
+
//#endregion
|
|
27032
|
+
//#region ../core/src/worktree/generate-name.ts
|
|
27033
|
+
var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
27034
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
27035
|
+
if (pack || arguments.length === 2) {
|
|
27036
|
+
for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
|
|
27037
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27038
|
+
ar[i] = from[i];
|
|
27039
|
+
}
|
|
27040
|
+
}
|
|
27041
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
27042
|
+
};
|
|
27043
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27044
|
+
exports.minLength = exports.maxLength = exports.poolSize = exports.humanId = exports.adverbs = exports.verbs = exports.nouns = exports.adjectives = void 0;
|
|
27045
|
+
exports.adjectives = [
|
|
27046
|
+
"afraid",
|
|
27047
|
+
"all",
|
|
27048
|
+
"beige",
|
|
27049
|
+
"better",
|
|
27050
|
+
"big",
|
|
27051
|
+
"blue",
|
|
27052
|
+
"bold",
|
|
27053
|
+
"brave",
|
|
27054
|
+
"breezy",
|
|
23728
27055
|
"bright",
|
|
23729
27056
|
"brown",
|
|
23730
27057
|
"bumpy",
|
|
@@ -25153,7 +28480,7 @@ var CodexBridge = class {
|
|
|
25153
28480
|
await this.sendRequest("initialize", {
|
|
25154
28481
|
clientInfo: {
|
|
25155
28482
|
name: "phantom_serve",
|
|
25156
|
-
title: "Phantom
|
|
28483
|
+
title: "Phantom",
|
|
25157
28484
|
version: "0.1.0"
|
|
25158
28485
|
},
|
|
25159
28486
|
capabilities: { experimentalApi: true }
|
|
@@ -25308,6 +28635,19 @@ function summarizeCodexEvent(method, params) {
|
|
|
25308
28635
|
}
|
|
25309
28636
|
return method;
|
|
25310
28637
|
}
|
|
28638
|
+
function rememberRecentProjectSkillSelection(recordsByProject, projectId, skillPath, lastUsedAt = (/* @__PURE__ */ new Date()).toISOString(), limit = 5) {
|
|
28639
|
+
const nextProjectRecords = [{
|
|
28640
|
+
path: skillPath,
|
|
28641
|
+
lastUsedAt
|
|
28642
|
+
}, ...(recordsByProject[projectId] ?? []).filter((record) => record.path !== skillPath)].sort((left, right) => right.lastUsedAt.localeCompare(left.lastUsedAt)).slice(0, Math.max(0, limit));
|
|
28643
|
+
return {
|
|
28644
|
+
...recordsByProject,
|
|
28645
|
+
[projectId]: nextProjectRecords
|
|
28646
|
+
};
|
|
28647
|
+
}
|
|
28648
|
+
function getRecentProjectSkillRecords(recordsByProject, projectId) {
|
|
28649
|
+
return recordsByProject[projectId] ?? [];
|
|
28650
|
+
}
|
|
25311
28651
|
//#endregion
|
|
25312
28652
|
//#region ../state/src/types.ts
|
|
25313
28653
|
const chatStatusSchema = _enum([
|
|
@@ -25351,6 +28691,11 @@ const turnContextItemBaseSchema = object({
|
|
|
25351
28691
|
name: string(),
|
|
25352
28692
|
path: string()
|
|
25353
28693
|
});
|
|
28694
|
+
const recentProjectSkillRecordBaseSchema = object({
|
|
28695
|
+
path: string(),
|
|
28696
|
+
lastUsedAt: string()
|
|
28697
|
+
});
|
|
28698
|
+
const recentProjectSkillsByProjectBaseSchema = record(string(), array(recentProjectSkillRecordBaseSchema)).default({});
|
|
25354
28699
|
const queuedMessageRecordBaseSchema = object({
|
|
25355
28700
|
id: string(),
|
|
25356
28701
|
chatId: string(),
|
|
@@ -25386,12 +28731,14 @@ object({
|
|
|
25386
28731
|
chats: array(chatRecordBaseSchema),
|
|
25387
28732
|
messages: array(chatMessageRecordBaseSchema),
|
|
25388
28733
|
queuedMessages: array(queuedMessageRecordBaseSchema).default([]),
|
|
28734
|
+
recentProjectSkills: recentProjectSkillsByProjectBaseSchema,
|
|
25389
28735
|
selectedProjectId: nullableStringFromUnknownSchema,
|
|
25390
28736
|
selectedChatId: nullableStringFromUnknownSchema
|
|
25391
28737
|
});
|
|
25392
28738
|
const projectRecordSchema = projectRecordBaseSchema.passthrough();
|
|
25393
28739
|
const chatMessageRecordSchema = chatMessageRecordBaseSchema.passthrough();
|
|
25394
28740
|
const queuedMessageRecordSchema = queuedMessageRecordBaseSchema.passthrough();
|
|
28741
|
+
const recentProjectSkillRecordSchema = recentProjectSkillRecordBaseSchema.passthrough();
|
|
25395
28742
|
const chatRecordSchema = chatRecordBaseSchema.passthrough();
|
|
25396
28743
|
const serveStateSchema = object({
|
|
25397
28744
|
version: literal(1),
|
|
@@ -25399,6 +28746,7 @@ const serveStateSchema = object({
|
|
|
25399
28746
|
chats: array(chatRecordSchema),
|
|
25400
28747
|
messages: array(chatMessageRecordSchema),
|
|
25401
28748
|
queuedMessages: array(queuedMessageRecordSchema).default([]),
|
|
28749
|
+
recentProjectSkills: record(string(), array(recentProjectSkillRecordSchema)).default({}),
|
|
25402
28750
|
selectedProjectId: nullableStringFromUnknownSchema,
|
|
25403
28751
|
selectedChatId: nullableStringFromUnknownSchema
|
|
25404
28752
|
}).passthrough();
|
|
@@ -25415,6 +28763,7 @@ function createEmptyState() {
|
|
|
25415
28763
|
chats: [],
|
|
25416
28764
|
messages: [],
|
|
25417
28765
|
queuedMessages: [],
|
|
28766
|
+
recentProjectSkills: {},
|
|
25418
28767
|
selectedProjectId: null,
|
|
25419
28768
|
selectedChatId: null
|
|
25420
28769
|
};
|
|
@@ -25480,7 +28829,8 @@ var ServeStateStore = class {
|
|
|
25480
28829
|
projects: [...state.projects],
|
|
25481
28830
|
chats: [...state.chats],
|
|
25482
28831
|
messages: [...state.messages],
|
|
25483
|
-
queuedMessages: [...state.queuedMessages]
|
|
28832
|
+
queuedMessages: [...state.queuedMessages],
|
|
28833
|
+
recentProjectSkills: cloneRecentProjectSkills(state.recentProjectSkills)
|
|
25484
28834
|
});
|
|
25485
28835
|
await this.save(nextState);
|
|
25486
28836
|
return nextState;
|
|
@@ -25489,6 +28839,9 @@ var ServeStateStore = class {
|
|
|
25489
28839
|
return nextUpdate;
|
|
25490
28840
|
}
|
|
25491
28841
|
};
|
|
28842
|
+
function cloneRecentProjectSkills(recordsByProject) {
|
|
28843
|
+
return Object.fromEntries(Object.entries(recordsByProject).map(([projectId, records]) => [projectId, [...records]]));
|
|
28844
|
+
}
|
|
25492
28845
|
function touchProject(project) {
|
|
25493
28846
|
const timestamp = now();
|
|
25494
28847
|
return {
|
|
@@ -25637,12 +28990,37 @@ var ServeServices = class {
|
|
|
25637
28990
|
chats: state.chats.filter((chat) => chat.projectId !== projectId),
|
|
25638
28991
|
messages: state.messages.filter((message) => !removedChatIds.has(message.chatId)),
|
|
25639
28992
|
queuedMessages: state.queuedMessages.filter((message) => !removedChatIds.has(message.chatId)),
|
|
28993
|
+
recentProjectSkills: Object.fromEntries(Object.entries(state.recentProjectSkills).filter(([storedProjectId]) => storedProjectId !== projectId)),
|
|
25640
28994
|
selectedProjectId: state.selectedProjectId === projectId ? null : state.selectedProjectId,
|
|
25641
28995
|
selectedChatId: removedChatIds.has(state.selectedChatId ?? "") ? null : state.selectedChatId
|
|
25642
28996
|
};
|
|
25643
28997
|
});
|
|
25644
28998
|
this.eventHub.emit("project.removed", { projectId });
|
|
25645
28999
|
}
|
|
29000
|
+
async listRecentProjectSkills(projectId) {
|
|
29001
|
+
const state = await this.store.load();
|
|
29002
|
+
const project = this.requireProject(state, projectId);
|
|
29003
|
+
return normalizeRecentProjectSkillRecordPaths(getRecentProjectSkillRecords(state.recentProjectSkills, projectId), getProjectSkillRoots(state, project));
|
|
29004
|
+
}
|
|
29005
|
+
async rememberRecentProjectSkill(projectId, skillPath) {
|
|
29006
|
+
if (!skillPath.trim()) throw new Error("Skill path is required");
|
|
29007
|
+
let recentSkills = [];
|
|
29008
|
+
const lastUsedAt = createTimestamp();
|
|
29009
|
+
await this.store.update((state) => {
|
|
29010
|
+
const projectSkillRoots = getProjectSkillRoots(state, this.requireProject(state, projectId));
|
|
29011
|
+
const normalizedSkillPath = normalizeProjectSkillPath(skillPath, projectSkillRoots);
|
|
29012
|
+
const recentProjectSkills = rememberRecentProjectSkillSelection({
|
|
29013
|
+
...state.recentProjectSkills,
|
|
29014
|
+
[projectId]: normalizeRecentProjectSkillRecordPaths(getRecentProjectSkillRecords(state.recentProjectSkills, projectId), projectSkillRoots)
|
|
29015
|
+
}, projectId, normalizedSkillPath, lastUsedAt);
|
|
29016
|
+
recentSkills = getRecentProjectSkillRecords(recentProjectSkills, projectId);
|
|
29017
|
+
return {
|
|
29018
|
+
...state,
|
|
29019
|
+
recentProjectSkills
|
|
29020
|
+
};
|
|
29021
|
+
});
|
|
29022
|
+
return recentSkills;
|
|
29023
|
+
}
|
|
25646
29024
|
async listChats(projectId) {
|
|
25647
29025
|
await this.resetStaleTransientChatState();
|
|
25648
29026
|
const state = await this.store.load();
|
|
@@ -26054,9 +29432,12 @@ var ServeServices = class {
|
|
|
26054
29432
|
const activeTurnId = chat.activeTurnId ?? (resetChatIds.has(chatId) ? null : findLocalSteeredTurnId(localMessages));
|
|
26055
29433
|
if (!chat.codexThreadId) return localMessagesWithoutStaleSteeredState(chat, localMessages);
|
|
26056
29434
|
try {
|
|
26057
|
-
|
|
26058
|
-
|
|
26059
|
-
|
|
29435
|
+
return resolveChatMessageTimeline({
|
|
29436
|
+
activeTurnId,
|
|
29437
|
+
chat,
|
|
29438
|
+
codexMessages: normalizeCodexThreadMessages(await this.codex.readThread(chat.codexThreadId, { includeTurns: true }), chat.id),
|
|
29439
|
+
localMessages
|
|
29440
|
+
});
|
|
26060
29441
|
} catch {
|
|
26061
29442
|
return localMessagesWithoutStaleSteeredState(chat, localMessages);
|
|
26062
29443
|
}
|
|
@@ -26353,6 +29734,11 @@ var ServeServices = class {
|
|
|
26353
29734
|
async listModels() {
|
|
26354
29735
|
return normalizeModelRecords(await this.codex.listModels());
|
|
26355
29736
|
}
|
|
29737
|
+
async listProjectSkills(projectId) {
|
|
29738
|
+
const state = await this.store.load();
|
|
29739
|
+
const project = this.requireProject(state, projectId);
|
|
29740
|
+
return normalizeSkillRecords(await this.codex.listSkills([project.rootPath]));
|
|
29741
|
+
}
|
|
26356
29742
|
async listSkills(chatId) {
|
|
26357
29743
|
const chat = await this.getChat(chatId);
|
|
26358
29744
|
return normalizeSkillRecords(await this.codex.listSkills([chat.worktreePath]));
|
|
@@ -26366,7 +29752,7 @@ var ServeServices = class {
|
|
|
26366
29752
|
async createCodexTurnOptions(input, chat) {
|
|
26367
29753
|
const attachments = await this.normalizeAttachmentItems(input.attachments, chat.id);
|
|
26368
29754
|
const files = await normalizeFileContextItems(input.files, chat.worktreePath);
|
|
26369
|
-
const skills = await this.normalizeSkillContextItems(input.skills, chat
|
|
29755
|
+
const skills = await this.normalizeSkillContextItems(input.skills, chat);
|
|
26370
29756
|
if (!input.effort && !input.model && !input.serviceTier && attachments.length === 0 && files.length === 0 && skills.length === 0) return;
|
|
26371
29757
|
const options = {};
|
|
26372
29758
|
if (attachments.length > 0) options.attachments = attachments;
|
|
@@ -26410,13 +29796,22 @@ var ServeServices = class {
|
|
|
26410
29796
|
};
|
|
26411
29797
|
}));
|
|
26412
29798
|
}
|
|
26413
|
-
async normalizeSkillContextItems(items,
|
|
29799
|
+
async normalizeSkillContextItems(items, chat) {
|
|
26414
29800
|
const normalized = normalizeTurnContextItems(items);
|
|
26415
29801
|
if (normalized.length === 0) return [];
|
|
26416
|
-
const
|
|
26417
|
-
const
|
|
29802
|
+
const state = await this.store.load();
|
|
29803
|
+
const project = this.requireProject(state, chat.projectId);
|
|
29804
|
+
const projectSkillRoots = getProjectSkillRoots(state, project);
|
|
29805
|
+
const skillListRoots = getSkillListRoots(chat, project);
|
|
29806
|
+
const availableSkills = normalizeSkillRecords(await this.codex.listSkills(skillListRoots));
|
|
29807
|
+
const skillsByPath = /* @__PURE__ */ new Map();
|
|
29808
|
+
for (const skill of sortSkillsByRootPreference(availableSkills.filter((candidate) => candidate.enabled), skillListRoots)) {
|
|
29809
|
+
skillsByPath.set(skill.path, skill);
|
|
29810
|
+
const skillIdentity = normalizeProjectSkillPath(skill.path, projectSkillRoots);
|
|
29811
|
+
if (!skillsByPath.has(skillIdentity)) skillsByPath.set(skillIdentity, skill);
|
|
29812
|
+
}
|
|
26418
29813
|
return normalized.map((item) => {
|
|
26419
|
-
const skill = skillsByPath.get(item.path);
|
|
29814
|
+
const skill = skillsByPath.get(normalizeProjectSkillPath(item.path, projectSkillRoots)) ?? skillsByPath.get(item.path);
|
|
26420
29815
|
if (!skill) throw new Error(`Skill context path is not available: ${item.path}`);
|
|
26421
29816
|
return {
|
|
26422
29817
|
name: skill.name,
|
|
@@ -26480,6 +29875,7 @@ var ServeServices = class {
|
|
|
26480
29875
|
}
|
|
26481
29876
|
async processCodexNotification(message) {
|
|
26482
29877
|
const method = message.method ?? "unknown";
|
|
29878
|
+
if (isHiddenCodexWarning(method, message.params)) return;
|
|
26483
29879
|
const chat = await this.findChatByCodexParams(message.params);
|
|
26484
29880
|
const eventType = mapCodexMethodToEvent(method);
|
|
26485
29881
|
if (chat) {
|
|
@@ -27055,6 +30451,7 @@ var ServeServices = class {
|
|
|
27055
30451
|
return;
|
|
27056
30452
|
}
|
|
27057
30453
|
if (method === "warning" || method === "guardianWarning" || method === "configWarning") {
|
|
30454
|
+
if (isHiddenCodexWarning(method, params)) return;
|
|
27058
30455
|
await this.addRichEventMessage({
|
|
27059
30456
|
chatId,
|
|
27060
30457
|
eventData: params,
|
|
@@ -27465,17 +30862,26 @@ function extractCodexText(value) {
|
|
|
27465
30862
|
if (directText) return directText;
|
|
27466
30863
|
return extractCodexText(value.content);
|
|
27467
30864
|
}
|
|
27468
|
-
function
|
|
30865
|
+
function resolveChatMessageTimeline({ activeTurnId, chat, codexMessages, localMessages }) {
|
|
30866
|
+
if (codexMessages.length === 0) return localMessagesWithoutStaleSteeredState(chat, localMessages);
|
|
30867
|
+
const localMessagesForCanonicalTranscript = isChatInActiveTurn(chat) ? localMessages : localMessagesWithoutStaleSteeredState(chat, localMessages);
|
|
30868
|
+
const canonicalLocalTranscriptMatch = isChatInActiveTurn(chat) ? emptyCanonicalLocalTranscriptMatch() : findCanonicalLocalTranscriptMatch(codexMessages, localMessagesForCanonicalTranscript);
|
|
30869
|
+
const deduplicatedCodexMessages = codexMessagesWithoutCanonicalLocalTranscript(codexMessages, canonicalLocalTranscriptMatch.codexMessageIndexes);
|
|
30870
|
+
if (deduplicatedCodexMessages.length === 0) return localMessagesWithoutStaleSteeredState(chat, localMessages);
|
|
30871
|
+
return mergeCodexAndLocalMessages(deduplicatedCodexMessages, localMessagesWithCanonicalStaleSteeredStateCleared(chat, localMessages, canonicalLocalTranscriptMatch), activeTurnId, chat.activeTurnId != null, canonicalLocalTranscriptMatch.localMessageCodexOrderMatches);
|
|
30872
|
+
}
|
|
30873
|
+
function mergeCodexAndLocalMessages(codexMessages, localMessages, activeTurnId, protectActiveLocalTurn, protectedLocalMessageCodexOrderMatches = /* @__PURE__ */ new Map()) {
|
|
27469
30874
|
if (codexMessages.length === 0) return localMessages;
|
|
27470
30875
|
const mergedCodexMessages = [...codexMessages];
|
|
27471
30876
|
const unmatchedCodexMessageIndexes = codexMessages.map((_, index) => index);
|
|
27472
|
-
const localMessageCodexOrderMatches =
|
|
30877
|
+
const localMessageCodexOrderMatches = new Map(protectedLocalMessageCodexOrderMatches);
|
|
27473
30878
|
const steeredLocalMessageCounts = countSteeredLocalMessages(localMessages);
|
|
27474
30879
|
const fallbackTranscriptLocalMessageMatches = findFallbackTranscriptLocalMessageMatches(mergedCodexMessages, localMessages, activeTurnId, protectActiveLocalTurn ? findActiveLocalTurnStartIndex(localMessages) : localMessages.length);
|
|
27475
30880
|
const liveAssistantDeltaCodexOrderLimits = findLiveAssistantDeltaCodexOrderLimits(localMessages, mergedCodexMessages, steeredLocalMessageCounts, activeTurnId);
|
|
27476
30881
|
return assignMergedMessageSortKeys(mergedCodexMessages, localMessages.filter((message) => {
|
|
27477
30882
|
if (message.role === "event" || message.role === "error") return true;
|
|
27478
30883
|
if (message.eventType === "chat.message.queued") return true;
|
|
30884
|
+
if (protectedLocalMessageCodexOrderMatches.has(message.id)) return true;
|
|
27479
30885
|
const fallbackTranscriptCodexIndex = fallbackTranscriptLocalMessageMatches.get(message.id);
|
|
27480
30886
|
if (fallbackTranscriptCodexIndex !== void 0 && unmatchedCodexMessageIndexes.includes(fallbackTranscriptCodexIndex)) {
|
|
27481
30887
|
const fallbackCodexMessage = mergedCodexMessages[fallbackTranscriptCodexIndex];
|
|
@@ -27524,10 +30930,98 @@ function mergeLocalMessageMetadataIntoCodexMessage(codexMessage, localMessage) {
|
|
|
27524
30930
|
}
|
|
27525
30931
|
function localMessagesWithoutStaleSteeredState(chat, localMessages) {
|
|
27526
30932
|
if (isChatInActiveTurn(chat)) return localMessages;
|
|
27527
|
-
return localMessages.map((message) =>
|
|
30933
|
+
return localMessages.map((message) => localMessageWithoutStaleSteeredState(chat, message));
|
|
30934
|
+
}
|
|
30935
|
+
function localMessagesWithCanonicalStaleSteeredStateCleared(chat, localMessages, canonicalLocalTranscriptMatch) {
|
|
30936
|
+
if (isChatInActiveTurn(chat) || canonicalLocalTranscriptMatch.localMessageCodexOrderMatches.size === 0) return localMessages;
|
|
30937
|
+
return localMessages.map((message) => canonicalLocalTranscriptMatch.localMessageCodexOrderMatches.has(message.id) ? localMessageWithoutStaleSteeredState(chat, message) : message);
|
|
30938
|
+
}
|
|
30939
|
+
function localMessageWithoutStaleSteeredState(chat, message) {
|
|
30940
|
+
if (isChatInActiveTurn(chat) || message.eventType !== "chat.message.steered") return message;
|
|
30941
|
+
return {
|
|
27528
30942
|
...message,
|
|
27529
30943
|
eventType: void 0
|
|
27530
|
-
}
|
|
30944
|
+
};
|
|
30945
|
+
}
|
|
30946
|
+
function emptyCanonicalLocalTranscriptMatch() {
|
|
30947
|
+
return {
|
|
30948
|
+
codexMessageIndexes: /* @__PURE__ */ new Set(),
|
|
30949
|
+
localMessageCodexOrderMatches: /* @__PURE__ */ new Map()
|
|
30950
|
+
};
|
|
30951
|
+
}
|
|
30952
|
+
function codexMessagesWithoutCanonicalLocalTranscript(codexMessages, duplicateCodexMessageIndexes) {
|
|
30953
|
+
if (duplicateCodexMessageIndexes.size === 0) return codexMessages;
|
|
30954
|
+
return codexMessages.filter((_, index) => !duplicateCodexMessageIndexes.has(index));
|
|
30955
|
+
}
|
|
30956
|
+
function findCanonicalLocalTranscriptMatch(codexMessages, localMessages) {
|
|
30957
|
+
const matchedEntries = findCanonicalLocalTranscriptEntries(codexMessages, localMessages);
|
|
30958
|
+
if (matchedEntries.length === 0) return emptyCanonicalLocalTranscriptMatch();
|
|
30959
|
+
return {
|
|
30960
|
+
codexMessageIndexes: new Set(matchedEntries.map((entry) => entry.codexIndex)),
|
|
30961
|
+
localMessageCodexOrderMatches: new Map(matchedEntries.map((entry) => [entry.localId, entry.message.codexOrder ?? entry.codexIndex]))
|
|
30962
|
+
};
|
|
30963
|
+
}
|
|
30964
|
+
function findCanonicalLocalTranscriptEntries(codexMessages, localMessages) {
|
|
30965
|
+
const minimumCanonicalTranscriptLength = 4;
|
|
30966
|
+
const matchedCodexEntries = [];
|
|
30967
|
+
let nextLocalIndex = 0;
|
|
30968
|
+
for (const [codexIndex, codexMessage] of codexMessages.entries()) {
|
|
30969
|
+
if (!isTranscriptMessage(codexMessage)) continue;
|
|
30970
|
+
const matchedLocalIndex = findNextCanonicalLocalTranscriptIndex(localMessages, nextLocalIndex, codexMessage);
|
|
30971
|
+
if (matchedLocalIndex === -1) break;
|
|
30972
|
+
const matchedLocalMessage = localMessages[matchedLocalIndex];
|
|
30973
|
+
if (!matchedLocalMessage) break;
|
|
30974
|
+
matchedCodexEntries.push({
|
|
30975
|
+
codexIndex,
|
|
30976
|
+
localId: matchedLocalMessage.id,
|
|
30977
|
+
message: codexMessage
|
|
30978
|
+
});
|
|
30979
|
+
nextLocalIndex = matchedLocalIndex + 1;
|
|
30980
|
+
}
|
|
30981
|
+
const matchedMessages = matchedCodexEntries.map((entry) => entry.message);
|
|
30982
|
+
const hasNewerCodexTranscriptMessage = hasCodexTranscriptMessageAfterMatchedPrefix(codexMessages, matchedCodexEntries);
|
|
30983
|
+
const hasSubstantialCanonicalTranscript = matchedMessages.length >= minimumCanonicalTranscriptLength && matchedMessages.some((message) => message.role === "user") && matchedMessages.filter((message) => message.role === "assistant").length >= 2;
|
|
30984
|
+
const hasOpenUserBoundaryBeforeNewerCodexTranscript = hasNewerCodexTranscriptMessage && matchedMessages[0]?.role === "user" && matchedMessages.some((message) => message.role === "assistant") && matchedMessages[matchedMessages.length - 1]?.role === "user";
|
|
30985
|
+
const hasCompletedExchangeBeforeSameTurnCodexAssistant = matchedMessages[0]?.role === "user" && matchedMessages.some((message) => message.role === "assistant") && matchedMessages[matchedMessages.length - 1]?.role === "assistant" && hasSameTurnAssistantMessageAfterMatchedPrefix(codexMessages, matchedCodexEntries);
|
|
30986
|
+
if (!hasSubstantialCanonicalTranscript && !hasOpenUserBoundaryBeforeNewerCodexTranscript && !hasCompletedExchangeBeforeSameTurnCodexAssistant) return [];
|
|
30987
|
+
if (new Set(matchedMessages.map((message) => message.codexTurnId).filter(Boolean)).size > 1 && !hasOpenUserBoundaryBeforeNewerCodexTranscript) return [];
|
|
30988
|
+
return matchedCodexEntries;
|
|
30989
|
+
}
|
|
30990
|
+
function findNextCanonicalLocalTranscriptIndex(localMessages, startIndex, codexMessage) {
|
|
30991
|
+
for (let localIndex = startIndex; localIndex < localMessages.length; localIndex += 1) {
|
|
30992
|
+
const localMessage = localMessages[localIndex];
|
|
30993
|
+
if (!isTranscriptMessage(localMessage)) {
|
|
30994
|
+
if (isSkippableCanonicalLocalTimelineMessage(localMessage)) continue;
|
|
30995
|
+
return -1;
|
|
30996
|
+
}
|
|
30997
|
+
return messageFingerprint(localMessage) === messageFingerprint(codexMessage) && isLocalMessageAtOrBeforeCodexMessage(localMessage, codexMessage) ? localIndex : -1;
|
|
30998
|
+
}
|
|
30999
|
+
return -1;
|
|
31000
|
+
}
|
|
31001
|
+
function isSkippableCanonicalLocalTimelineMessage(message) {
|
|
31002
|
+
return message.role === "event" || message.role === "error";
|
|
31003
|
+
}
|
|
31004
|
+
function hasCodexTranscriptMessageAfterMatchedPrefix(codexMessages, matchedEntries) {
|
|
31005
|
+
const lastMatchedEntry = matchedEntries[matchedEntries.length - 1];
|
|
31006
|
+
if (!lastMatchedEntry) return false;
|
|
31007
|
+
return codexMessages.some((message, index) => index > lastMatchedEntry.codexIndex && isTranscriptMessage(message));
|
|
31008
|
+
}
|
|
31009
|
+
function hasSameTurnAssistantMessageAfterMatchedPrefix(codexMessages, matchedEntries) {
|
|
31010
|
+
const lastMatchedEntry = matchedEntries[matchedEntries.length - 1];
|
|
31011
|
+
if (!lastMatchedEntry) return false;
|
|
31012
|
+
const lastMatchedMessage = codexMessages[lastMatchedEntry.codexIndex];
|
|
31013
|
+
if (!lastMatchedMessage?.codexTurnId) return false;
|
|
31014
|
+
return codexMessages.some((message, index) => index > lastMatchedEntry.codexIndex && message.codexTurnId === lastMatchedMessage.codexTurnId && message.role === "assistant" && isTranscriptMessage(message));
|
|
31015
|
+
}
|
|
31016
|
+
function isTranscriptMessage(message) {
|
|
31017
|
+
return (message.role === "assistant" || message.role === "user") && !isQueuedMessage(message) && !isPendingSteeredMessage(message);
|
|
31018
|
+
}
|
|
31019
|
+
function isLocalMessageAtOrBeforeCodexMessage(localMessage, codexMessage) {
|
|
31020
|
+
if (codexMessage.hasFallbackTimestamp) return true;
|
|
31021
|
+
const codexTime = Date.parse(codexMessage.createdAt);
|
|
31022
|
+
const localTime = Date.parse(localMessage.createdAt);
|
|
31023
|
+
if (Number.isFinite(codexTime) && Number.isFinite(localTime)) return localTime <= codexTime;
|
|
31024
|
+
return localMessage.createdAt <= codexMessage.createdAt;
|
|
27531
31025
|
}
|
|
27532
31026
|
function insertRecordAtIndex(records, record, index) {
|
|
27533
31027
|
if (index >= records.length) return [...records, record];
|
|
@@ -27554,12 +31048,22 @@ function assignMergedMessageSortKeys(codexMessages, localMessages, allLocalMessa
|
|
|
27554
31048
|
})];
|
|
27555
31049
|
}
|
|
27556
31050
|
function getLocalMessageMergeSortBucket(message, index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId) {
|
|
27557
|
-
if (isPendingSteeredMessage(message)) return orderedCodexMessages
|
|
27558
|
-
if (isQueuedMessage(message)) return orderedCodexMessages
|
|
31051
|
+
if (isPendingSteeredMessage(message)) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 2);
|
|
31052
|
+
if (isQueuedMessage(message)) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 3);
|
|
31053
|
+
const matchedCodexOrder = localMessageCodexOrderMatches.get(message.id);
|
|
31054
|
+
if (matchedCodexOrder !== void 0 && isTranscriptMessage(message)) return matchedCodexOrder * 2;
|
|
27559
31055
|
if (isLocalTimelineEvent(message)) return getLocalTimelineEventMergeSortBucket(index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId);
|
|
27560
31056
|
if (isLiveAssistantDeltaMessage(message)) return getLiveAssistantDeltaMergeSortBucket(message, index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId);
|
|
27561
31057
|
return getStandardLocalMessageMergeSortBucket(message, orderedCodexMessages, index, localMessages, localMessageCodexOrderMatches);
|
|
27562
31058
|
}
|
|
31059
|
+
function getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, offset) {
|
|
31060
|
+
return (orderedCodexMessages.reduce((maxOrder, message, index) => Math.max(maxOrder, message.codexOrder ?? index), -1) + 1) * 2 + offset;
|
|
31061
|
+
}
|
|
31062
|
+
function getBeforeCodexMessageMergeSortBucket(orderedCodexMessages, insertionIndex) {
|
|
31063
|
+
const codexMessage = orderedCodexMessages[insertionIndex];
|
|
31064
|
+
if (!codexMessage) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 1);
|
|
31065
|
+
return (codexMessage.codexOrder ?? insertionIndex) * 2 - 1;
|
|
31066
|
+
}
|
|
27563
31067
|
function getLocalTimelineEventMergeSortBucket(index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId) {
|
|
27564
31068
|
const earlierLocalBoundaryBucket = localMessages.slice(0, index).map((message, index) => ({
|
|
27565
31069
|
index,
|
|
@@ -27575,7 +31079,7 @@ function getLocalTimelineEventMergeSortBucket(index, localMessages, orderedCodex
|
|
|
27575
31079
|
return earlierLocalBoundaryBucket + .5;
|
|
27576
31080
|
}
|
|
27577
31081
|
if (earlierLocalBoundaryBucket !== void 0) return earlierLocalBoundaryBucket + .5;
|
|
27578
|
-
if (laterLocalBoundaryBucket === void 0) return orderedCodexMessages
|
|
31082
|
+
if (laterLocalBoundaryBucket === void 0) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 1);
|
|
27579
31083
|
return laterLocalBoundaryBucket - .5;
|
|
27580
31084
|
}
|
|
27581
31085
|
function getLocalTimelineEventBoundaryMergeSortBucket(message, index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId) {
|
|
@@ -27584,8 +31088,8 @@ function getLocalTimelineEventBoundaryMergeSortBucket(message, index, localMessa
|
|
|
27584
31088
|
const boundaryBucket = getLocalUserBoundaryMergeSortBucket(message, index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches);
|
|
27585
31089
|
if (boundaryBucket !== null) return boundaryBucket;
|
|
27586
31090
|
}
|
|
27587
|
-
if (isPendingSteeredMessage(message)) return orderedCodexMessages
|
|
27588
|
-
if (isQueuedMessage(message)) return orderedCodexMessages
|
|
31091
|
+
if (isPendingSteeredMessage(message)) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 2);
|
|
31092
|
+
if (isQueuedMessage(message)) return getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 3);
|
|
27589
31093
|
if (!isLiveAssistantDeltaMessage(message)) return null;
|
|
27590
31094
|
return getMergedLiveAssistantDeltaMergeSortBucket(message, orderedCodexMessages, localMessageCodexOrderMatches) ?? getLiveAssistantDeltaMergeSortBucket(message, index, localMessages, orderedCodexMessages, localMessageCodexOrderMatches, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId);
|
|
27591
31095
|
}
|
|
@@ -27593,9 +31097,9 @@ function getStandardLocalMessageMergeSortBucket(message, orderedCodexMessages, i
|
|
|
27593
31097
|
const insertionIndex = orderedCodexMessages.findIndex((codexMessage) => codexMessage.createdAt > message.createdAt);
|
|
27594
31098
|
if (insertionIndex !== -1 && orderedCodexMessages[insertionIndex]?.hasFallbackTimestamp) {
|
|
27595
31099
|
const nextTrustedInsertionIndex = orderedCodexMessages.findIndex((codexMessage, index) => index > insertionIndex && !codexMessage.hasFallbackTimestamp && codexMessage.createdAt > message.createdAt);
|
|
27596
|
-
return applyEarlierLocalCodexBoundary(nextTrustedInsertionIndex === -1 ? orderedCodexMessages
|
|
31100
|
+
return applyEarlierLocalCodexBoundary(nextTrustedInsertionIndex === -1 ? getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 1) : getBeforeCodexMessageMergeSortBucket(orderedCodexMessages, nextTrustedInsertionIndex), index, localMessages, localMessageCodexOrderMatches);
|
|
27597
31101
|
}
|
|
27598
|
-
return applyEarlierLocalCodexBoundary(insertionIndex === -1 ? orderedCodexMessages
|
|
31102
|
+
return applyEarlierLocalCodexBoundary(insertionIndex === -1 ? getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 1) : getBeforeCodexMessageMergeSortBucket(orderedCodexMessages, insertionIndex), index, localMessages, localMessageCodexOrderMatches);
|
|
27599
31103
|
}
|
|
27600
31104
|
function applyEarlierLocalCodexBoundary(bucket, index, localMessages, localMessageCodexOrderMatches) {
|
|
27601
31105
|
if (index === void 0 || !localMessages || !localMessageCodexOrderMatches) return bucket;
|
|
@@ -27626,9 +31130,9 @@ function getLiveAssistantDeltaMergeSortBucket(message, index, localMessages, ord
|
|
|
27626
31130
|
const boundaryInsertionIndex = findLiveAssistantDeltaBoundaryInsertionIndex(message, index, localMessages, orderedCodexMessages, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId);
|
|
27627
31131
|
if (boundaryInsertionIndex === null) {
|
|
27628
31132
|
const earlierMatchedCodexOrder = getEarlierLocalCodexOrder(index, localMessages, localMessageCodexOrderMatches);
|
|
27629
|
-
return earlierMatchedCodexOrder === void 0 ? orderedCodexMessages
|
|
31133
|
+
return earlierMatchedCodexOrder === void 0 ? getAfterCodexMessagesMergeSortBucket(orderedCodexMessages, 1) : earlierMatchedCodexOrder * 2 + .5;
|
|
27630
31134
|
}
|
|
27631
|
-
return applyEarlierLocalCodexBoundary(boundaryInsertionIndex
|
|
31135
|
+
return applyEarlierLocalCodexBoundary(getBeforeCodexMessageMergeSortBucket(orderedCodexMessages, boundaryInsertionIndex), index, localMessages, localMessageCodexOrderMatches);
|
|
27632
31136
|
}
|
|
27633
31137
|
function findLiveAssistantDeltaBoundaryInsertionIndex(message, index, localMessages, orderedCodexMessages, liveAssistantDeltaCodexOrderLimits, steeredLocalMessageCounts, activeTurnId) {
|
|
27634
31138
|
if (!isLiveAssistantDeltaMessage(message)) return null;
|
|
@@ -28184,6 +31688,40 @@ function normalizeSkillRecords(value) {
|
|
|
28184
31688
|
};
|
|
28185
31689
|
}).filter((skill) => Boolean(skill));
|
|
28186
31690
|
}
|
|
31691
|
+
function getProjectSkillRoots(state, project) {
|
|
31692
|
+
return Array.from(new Set([project.rootPath, ...state.chats.filter((chat) => chat.projectId === project.id).map((chat) => chat.worktreePath)])).sort((left, right) => right.length - left.length);
|
|
31693
|
+
}
|
|
31694
|
+
function getSkillListRoots(chat, project) {
|
|
31695
|
+
return Array.from(new Set([chat.worktreePath, project.rootPath]));
|
|
31696
|
+
}
|
|
31697
|
+
function sortSkillsByRootPreference(skills, roots) {
|
|
31698
|
+
return [...skills].sort((left, right) => getPathRootIndex(left.path, roots) - getPathRootIndex(right.path, roots));
|
|
31699
|
+
}
|
|
31700
|
+
function getPathRootIndex(path, roots) {
|
|
31701
|
+
if (!isAbsolute(path)) return roots.length;
|
|
31702
|
+
const rootIndex = roots.findIndex((root) => isPathInside(root, path));
|
|
31703
|
+
return rootIndex === -1 ? roots.length : rootIndex;
|
|
31704
|
+
}
|
|
31705
|
+
function normalizeRecentProjectSkillRecordPaths(records, projectSkillRoots) {
|
|
31706
|
+
const seenSkillPaths = /* @__PURE__ */ new Set();
|
|
31707
|
+
return records.map((record) => ({
|
|
31708
|
+
...record,
|
|
31709
|
+
path: normalizeProjectSkillPath(record.path, projectSkillRoots)
|
|
31710
|
+
})).filter((record) => {
|
|
31711
|
+
if (seenSkillPaths.has(record.path)) return false;
|
|
31712
|
+
seenSkillPaths.add(record.path);
|
|
31713
|
+
return true;
|
|
31714
|
+
});
|
|
31715
|
+
}
|
|
31716
|
+
function normalizeProjectSkillPath(skillPath, projectSkillRoots) {
|
|
31717
|
+
const trimmedSkillPath = skillPath.trim();
|
|
31718
|
+
if (!isAbsolute(trimmedSkillPath)) return trimmedSkillPath;
|
|
31719
|
+
for (const root of projectSkillRoots) {
|
|
31720
|
+
const relativeSkillPath = relative(root, trimmedSkillPath);
|
|
31721
|
+
if (relativeSkillPath && !relativeSkillPath.startsWith(`..${sep}`) && relativeSkillPath !== ".." && !isAbsolute(relativeSkillPath)) return relativeSkillPath.split(sep).join("/");
|
|
31722
|
+
}
|
|
31723
|
+
return trimmedSkillPath;
|
|
31724
|
+
}
|
|
28187
31725
|
function normalizeFileRecords(value) {
|
|
28188
31726
|
return (getRecordArray(value, "files") ?? []).map((file) => {
|
|
28189
31727
|
const matchType = getRecordString(file, "match_type");
|
|
@@ -28345,6 +31883,19 @@ function sanitizeCodexEventParams(method, params) {
|
|
|
28345
31883
|
}
|
|
28346
31884
|
return params;
|
|
28347
31885
|
}
|
|
31886
|
+
const hiddenCodexWarningMessages = new Set(["automatic approval review approved"]);
|
|
31887
|
+
function isHiddenCodexWarning(method, params) {
|
|
31888
|
+
if (method !== "warning" && method !== "guardianWarning" && method !== "configWarning") return false;
|
|
31889
|
+
const object = getParamObject(params);
|
|
31890
|
+
return [
|
|
31891
|
+
summarizeCodexEvent(method, params),
|
|
31892
|
+
typeof object?.message === "string" ? object.message : null,
|
|
31893
|
+
typeof object?.summary === "string" ? object.summary : null
|
|
31894
|
+
].some((candidate) => typeof candidate === "string" && hiddenCodexWarningMessages.has(normalizeCodexWarningMessage(candidate)));
|
|
31895
|
+
}
|
|
31896
|
+
function normalizeCodexWarningMessage(message) {
|
|
31897
|
+
return message.trim().replace(/\s+/g, " ").toLowerCase();
|
|
31898
|
+
}
|
|
28348
31899
|
function sanitizeCodexEventItem(item) {
|
|
28349
31900
|
const itemType = getRecordString(item, "type");
|
|
28350
31901
|
if (itemType === "commandExecution") return stripRecordKey(item, "aggregatedOutput");
|
|
@@ -28548,6 +32099,7 @@ const deleteWorktreeSchema = worktreeSchema.extend({
|
|
|
28548
32099
|
force: boolean().optional(),
|
|
28549
32100
|
keepBranch: boolean().optional()
|
|
28550
32101
|
});
|
|
32102
|
+
const recentProjectSkillSchema = object({ path: string().min(1, "Skill path is required") });
|
|
28551
32103
|
const sendMessageSchema = object({
|
|
28552
32104
|
text: string().min(1, "Message text is required"),
|
|
28553
32105
|
attachments: array(attachmentSchema).optional(),
|
|
@@ -28734,6 +32286,28 @@ const rpcRoutes = new Hono().get("/health", async (c) => {
|
|
|
28734
32286
|
} catch (error) {
|
|
28735
32287
|
return handleApiError(c, error);
|
|
28736
32288
|
}
|
|
32289
|
+
}).get("/projects/:projectId/skills", async (c) => {
|
|
32290
|
+
try {
|
|
32291
|
+
const skills = await getServeServices().listProjectSkills(c.req.param("projectId"));
|
|
32292
|
+
return c.json({ skills }, 200);
|
|
32293
|
+
} catch (error) {
|
|
32294
|
+
return handleApiError(c, error);
|
|
32295
|
+
}
|
|
32296
|
+
}).get("/projects/:projectId/recent-skills", async (c) => {
|
|
32297
|
+
try {
|
|
32298
|
+
const recentSkills = await getServeServices().listRecentProjectSkills(c.req.param("projectId"));
|
|
32299
|
+
return c.json({ recentSkills }, 200);
|
|
32300
|
+
} catch (error) {
|
|
32301
|
+
return handleApiError(c, error);
|
|
32302
|
+
}
|
|
32303
|
+
}).post("/projects/:projectId/recent-skills", jsonBody(recentProjectSkillSchema), async (c) => {
|
|
32304
|
+
try {
|
|
32305
|
+
const body = c.req.valid("json");
|
|
32306
|
+
const recentSkills = await getServeServices().rememberRecentProjectSkill(c.req.param("projectId"), body.path);
|
|
32307
|
+
return c.json({ recentSkills }, 200);
|
|
32308
|
+
} catch (error) {
|
|
32309
|
+
return handleApiError(c, error);
|
|
32310
|
+
}
|
|
28737
32311
|
}).get("/projects/:projectId/github/checkout-targets", async (c) => {
|
|
28738
32312
|
try {
|
|
28739
32313
|
const github = await getServeServices().listProjectGitHubCheckoutTargets(c.req.param("projectId"));
|
|
@@ -29144,4 +32718,4 @@ function createApp() {
|
|
|
29144
32718
|
//#endregion
|
|
29145
32719
|
export { EventHub as a, getServeServices as i, rpcRoutes as n, createSseResponse as o, ServeServices as r, parseLastEventId as s, createApp as t };
|
|
29146
32720
|
|
|
29147
|
-
//# sourceMappingURL=app-
|
|
32721
|
+
//# sourceMappingURL=app-CYTfYqUa.mjs.map
|