@moldea.ai/cli 14.0.0 → 14.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/portable/SHA256SUMS +16 -16
  3. package/dist/portable/analysis-worker.mjs +110 -133
  4. package/dist/portable/chunk-1306b995.mjs +2 -0
  5. package/dist/portable/chunk-24ea7c23.mjs +328 -0
  6. package/dist/portable/chunk-2cc3bf5c.mjs +399 -0
  7. package/dist/portable/chunk-2e9d4c63.mjs +95 -0
  8. package/dist/portable/chunk-43b8574a.mjs +1837 -0
  9. package/dist/portable/chunk-517c6bfb.mjs +2 -0
  10. package/dist/portable/chunk-8f198616.mjs +4414 -0
  11. package/dist/portable/chunk-936e5d09.mjs +112519 -0
  12. package/dist/portable/chunk-98d84174.mjs +422 -0
  13. package/dist/portable/chunk-9e42770a.mjs +3114 -0
  14. package/dist/portable/chunk-cea1378f.mjs +50 -0
  15. package/dist/portable/chunk-d6656fa6.mjs +14 -0
  16. package/dist/portable/chunk-d9e49acd.mjs +302 -0
  17. package/dist/portable/moldea.mjs +1995 -2868
  18. package/dist/portable/node-runner.mjs +77 -106
  19. package/package.json +1 -1
  20. package/dist/portable/chunk-131f8005.mjs +0 -115
  21. package/dist/portable/chunk-2ba7e89e.mjs +0 -26
  22. package/dist/portable/chunk-459da9cf.mjs +0 -4138
  23. package/dist/portable/chunk-728df961.mjs +0 -544
  24. package/dist/portable/chunk-8d6114d2.mjs +0 -588
  25. package/dist/portable/chunk-90403e67.mjs +0 -2
  26. package/dist/portable/chunk-94b5ac22.mjs +0 -59
  27. package/dist/portable/chunk-a5514957.mjs +0 -5870
  28. package/dist/portable/chunk-b98ca669.mjs +0 -2
  29. package/dist/portable/chunk-c13db66a.mjs +0 -380
  30. package/dist/portable/chunk-d5af3eda.mjs +0 -2926
  31. package/dist/portable/chunk-ec3f49d3.mjs +0 -367
  32. package/dist/portable/chunk-fcbcf4e3.mjs +0 -147458
@@ -0,0 +1,399 @@
1
+ //#region ../../node_modules/.pnpm/jg-exception@1.7.1/node_modules/jg-exception/dist/shared/constants.js
2
+ var e = (e) => {
3
+ let t = new WeakMap();
4
+ return JSON.stringify(e, function(e, n) {
5
+ if (typeof n == "object" && n) {
6
+ let e = (t.get(this) ?? 0) + 1;
7
+ if (e > 256) throw RangeError("The value is nested too deeply to serialize.");
8
+ t.set(n, e);
9
+ }
10
+ return n;
11
+ });
12
+ }, t = (e, t) => {
13
+ let n = [];
14
+ return t.forEach((t) => {
15
+ let r = e.indexOf(t);
16
+ for (; r !== -1;) n.push({
17
+ start: r,
18
+ end: r + t.length
19
+ }), r = e.indexOf(t, r + 1);
20
+ }), n;
21
+ }, n = (e) => {
22
+ let t = [...e].sort((e, t) => e.start - t.start || t.end - e.end), n = [];
23
+ return t.forEach((e) => {
24
+ let t = n.at(-1);
25
+ if (!t || e.start >= t.end) {
26
+ n.push({ ...e });
27
+ return;
28
+ }
29
+ e.end > t.end && (t.end = e.end);
30
+ }), n;
31
+ }, r = (e, r) => {
32
+ let i = [...new Set(r.filter((e) => e.length > 0))];
33
+ if (!i.length) return e;
34
+ let a = n(t(e, i));
35
+ if (!a.length) return e;
36
+ let o = [], s = 0;
37
+ return a.forEach((t) => {
38
+ o.push(e.slice(s, t.start), "[redacted]"), s = t.end;
39
+ }), o.push(e.slice(s)), o.join("");
40
+ }, i = (e) => {
41
+ if (typeof e != "object" || !e) return null;
42
+ let { code: t } = e;
43
+ return typeof t == "string" && t.length > 0 ? t : null;
44
+ }, a = (e, t) => t.length > 0 && (typeof e == "string" ? e : i(e)) === t, o = Symbol.for("jg-exception.Exception"), s = ["expected", "critical"], c = new Set([
45
+ "name",
46
+ "message",
47
+ "stack",
48
+ "cause"
49
+ ]), l = new Set(["severity", "shouldLog"]), u = 32, d = /^(?:0|[1-9]\d*)$/, f = (e, t) => {
50
+ let n = e;
51
+ for (let e = 0; n !== null && e < u; e += 1) {
52
+ let e = Reflect.getOwnPropertyDescriptor(n, t);
53
+ if (e !== void 0) return e;
54
+ n = Reflect.getPrototypeOf(n);
55
+ }
56
+ return {};
57
+ }, p = Reflect.get(f(Error(), "stack"), "get"), m = (e, t) => {
58
+ if ("value" in t) return t.value;
59
+ let n = Reflect.get(t, "get");
60
+ return typeof n == "function" && n === p ? Reflect.apply(n, e, []) : void 0;
61
+ }, h = (e, t, n) => {
62
+ try {
63
+ return m(e, n ? f(e, t) : Reflect.getOwnPropertyDescriptor(e, t) ?? {});
64
+ } catch {
65
+ return;
66
+ }
67
+ }, g = (e) => {
68
+ let t;
69
+ try {
70
+ t = Reflect.ownKeys(e);
71
+ } catch {
72
+ return [];
73
+ }
74
+ return t.flatMap((t) => {
75
+ if (typeof t != "string") return [];
76
+ try {
77
+ let n = Reflect.getOwnPropertyDescriptor(e, t);
78
+ return n?.enumerable === !0 && "value" in n ? [[t, n.value]] : [];
79
+ } catch {
80
+ return [];
81
+ }
82
+ });
83
+ }, _ = (e, t, n, r) => {
84
+ Object.defineProperty(e, t, {
85
+ value: n,
86
+ enumerable: r,
87
+ writable: !0,
88
+ configurable: !0
89
+ });
90
+ }, v = (e) => e === null || typeof e != "object" && typeof e != "function", y = (e, t) => {
91
+ if (typeof e == "string") return r(e, t);
92
+ if (e == null) return e;
93
+ let n = String(e), i = r(n, t);
94
+ return i === n ? e : i;
95
+ }, b = (e, t, n, r) => {
96
+ if (typeof e != "object" || !e) return typeof e == "function" || typeof e == "symbol" || typeof e == "bigint" ? void 0 : y(e, t);
97
+ if (!n.has(e)) {
98
+ if (r >= 256) throw RangeError("The data is nested too deeply to copy.");
99
+ n.add(e);
100
+ try {
101
+ let i = g(e);
102
+ if (Array.isArray(e)) {
103
+ let e = [];
104
+ for (let [a, o] of i) d.test(a) && (e[Number(a)] = b(o, t, n, r + 1) ?? null);
105
+ return e;
106
+ }
107
+ let a = {};
108
+ for (let [e, o] of i) {
109
+ let i = b(o, t, n, r + 1);
110
+ i !== void 0 && _(a, e, i, !0);
111
+ }
112
+ return a;
113
+ } finally {
114
+ n.delete(e);
115
+ }
116
+ }
117
+ }, x = (e, t) => {
118
+ try {
119
+ return b(e, t, new Set(), 0);
120
+ } catch {
121
+ return null;
122
+ }
123
+ }, S = (e, t, n) => {
124
+ let { values: i, exceptionClass: a, snapshots: s } = t, u = h(e, o, !1) === !0, d = h(e, "message", !1), f = Reflect.construct(Error, [typeof d == "string" ? r(d, i) : ""], u ? a : Error);
125
+ s.set(e, f);
126
+ let p = h(e, "name", !0);
127
+ _(f, "name", typeof p == "string" ? r(p, i) : "Error", !1);
128
+ let m = h(e, "stack", !0);
129
+ typeof m == "string" ? _(f, "stack", r(m, i), !1) : Reflect.deleteProperty(f, "stack");
130
+ for (let [t, n] of g(e)) !(c.has(t) || u && t === "data") && v(n) && _(f, t, u && l.has(t) ? n : y(n, i), !0);
131
+ if (u) {
132
+ Object.defineProperty(f, o, { value: !0 });
133
+ let t = h(e, "data", !1);
134
+ _(f, "data", t === void 0 ? void 0 : x(t, i), !0);
135
+ }
136
+ let b;
137
+ try {
138
+ b = Reflect.getOwnPropertyDescriptor(e, "cause") !== void 0;
139
+ } catch {
140
+ b = !1;
141
+ }
142
+ return b && n < 256 && _(f, "cause", C(h(e, "cause", !1), t, n + 1), !1), f;
143
+ }, C = (e, t, n) => v(e) ? y(e, t.values) : t.snapshots.has(e) ? t.snapshots.get(e) : S(e, t, n), w = (e) => {
144
+ let t = new Set();
145
+ try {
146
+ for (let n of Array.isArray(e) ? e : []) if (typeof n == "string" && n.length > 0) {
147
+ t.add(n);
148
+ try {
149
+ t.add(encodeURIComponent(n));
150
+ } catch {}
151
+ }
152
+ } catch {}
153
+ return [...t];
154
+ }, T = (e, t, n) => {
155
+ let i = w(t);
156
+ if (i.length === 0) return e;
157
+ let a;
158
+ try {
159
+ a = r(Error(e.message).message, i);
160
+ } catch {
161
+ a = "";
162
+ }
163
+ return {
164
+ message: a,
165
+ data: e.data === void 0 ? void 0 : x(e.data, i),
166
+ cause: C(e.cause, {
167
+ values: i,
168
+ exceptionClass: n,
169
+ snapshots: new Map()
170
+ }, 1)
171
+ };
172
+ }, E = (t) => {
173
+ try {
174
+ let n = e(t);
175
+ return n === void 0 ? null : JSON.parse(n);
176
+ } catch {
177
+ return null;
178
+ }
179
+ }, D = (e) => s.includes(e), O = class e extends Error {
180
+ code;
181
+ data;
182
+ constructor(t, n) {
183
+ let { code: r, data: i, cause: a, redact: s, severity: c, shouldLog: l } = n ?? { code: "" }, u = T({
184
+ message: t,
185
+ data: i,
186
+ cause: a
187
+ }, s, e);
188
+ super(u.message, u.cause === void 0 ? void 0 : { cause: u.cause }), this.name = "Exception", this.code = typeof r == "string" && r.length > 0 ? r : "UNKNOWN_ERROR", this.data = u.data, D(c) && (this.severity = c), l === !0 && (this.shouldLog = !0), Object.defineProperty(this, o, { value: !0 });
189
+ }
190
+ toJSON() {
191
+ return {
192
+ name: this.name,
193
+ code: this.code,
194
+ message: this.message,
195
+ data: E(this.data)
196
+ };
197
+ }
198
+ toString() {
199
+ return `${this.name} [${this.code}]: ${this.message}`;
200
+ }
201
+ }, k = {
202
+ MIXED_OR_UNSUPPORTED_DATA_TYPES: "MIXED_OR_UNSUPPORTED_DATA_TYPES",
203
+ UNSUPPORTED_DATA_TYPE: "UNSUPPORTED_DATA_TYPE",
204
+ INVALID_OR_EMPTY_ARRAY: "INVALID_OR_EMPTY_ARRAY",
205
+ INVALID_OR_EMPTY_OBJECT: "INVALID_OR_EMPTY_OBJECT",
206
+ UNABLE_TO_SERIALIZE_JSON: "UNABLE_TO_SERIALIZE_JSON",
207
+ UNABLE_TO_DESERIALIZE_JSON: "UNABLE_TO_DESERIALIZE_JSON",
208
+ INVALID_BATCH_SIZE: "INVALID_BATCH_SIZE",
209
+ UNABLE_TO_SLUGIFY_STRING: "UNABLE_TO_SLUGIFY_STRING",
210
+ INVALID_TIME_STRING: "INVALID_TIME_STRING",
211
+ INVALID_AUTHORIZATION_HEADER: "INVALID_AUTHORIZATION_HEADER",
212
+ INVALID_EMAIL_ADDRESS: "INVALID_EMAIL_ADDRESS",
213
+ INVALID_BASE64URL: "INVALID_BASE64URL",
214
+ WAIT_UNTIL_TIMED_OUT: "WAIT_UNTIL_TIMED_OUT",
215
+ INVALID_CURSOR: "INVALID_CURSOR",
216
+ INVALID_DATE: "INVALID_DATE",
217
+ INVALID_DAY_COUNT: "INVALID_DAY_COUNT",
218
+ INVALID_DATE_RANGE: "INVALID_DATE_RANGE",
219
+ INVALID_BYTE_LIMIT: "INVALID_BYTE_LIMIT",
220
+ INVALID_YOUTUBE_VIDEO_ID: "INVALID_YOUTUBE_VIDEO_ID",
221
+ INVALID_CONCURRENCY_LIMIT: "INVALID_CONCURRENCY_LIMIT",
222
+ INVALID_QUEUE_LIMIT: "INVALID_QUEUE_LIMIT",
223
+ REQUEST_QUEUE_FULL: "REQUEST_QUEUE_FULL",
224
+ REQUEST_COOLDOWN_ACTIVE: "REQUEST_COOLDOWN_ACTIVE",
225
+ REQUEST_COORDINATOR_CLOSED: "REQUEST_COORDINATOR_CLOSED",
226
+ CURSOR_TOO_LONG: "CURSOR_TOO_LONG",
227
+ TASK_RUNNER_CLOSED: "TASK_RUNNER_CLOSED",
228
+ TASK_RUNNER_BUSY: "TASK_RUNNER_BUSY",
229
+ DEADLINE_EXCEEDED: "DEADLINE_EXCEEDED",
230
+ INVALID_DEADLINE: "INVALID_DEADLINE",
231
+ INVALID_MARKED_REGION: "INVALID_MARKED_REGION"
232
+ }, A = (e, t = -(2 ** 53 - 1), n = 2 ** 53 - 1) => typeof e == "number" && e >= t && e <= n, j = (e, t, n) => A(e, t, n) && Number.isInteger(e), M = (e, t) => typeof e == "object" && !!e && !Array.isArray(e) && (t || Object.keys(e).length > 0), N = (e, t) => Array.isArray(e) && (t || e.length > 0), P = (e) => {
233
+ if (!M(e, !0) && !N(e, !0)) throw new O(`The JSON value must be an object or an array in order to be stringified. Received: ${String(e)}`, { code: k.UNSUPPORTED_DATA_TYPE });
234
+ }, F = (e, t) => {
235
+ if (typeof t != "string" || !t.length) throw new O(`Stringifying the JSON value '${String(e)}' produced an invalid result: ${String(t)}.`, { code: k.UNABLE_TO_SERIALIZE_JSON });
236
+ }, I = (e) => {
237
+ if (!Number.isSafeInteger(e) || e < 0) throw new O("The byte limit must be a non-negative safe integer.", {
238
+ code: k.INVALID_BYTE_LIMIT,
239
+ data: { maxBytes: String(e) }
240
+ });
241
+ }, L = (e) => e.reduce((e, t) => typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][\w$]*$/.test(t) ? `${e}.${t}` : `${e}[${JSON.stringify(t)}]`, "$"), R = (e, t) => {
242
+ throw new O(`Failed to stringify the JSON value deterministically: the value at ${L(e)} ${t}.`, { code: k.UNABLE_TO_SERIALIZE_JSON });
243
+ }, z = (e, t) => {
244
+ let n = typeof e == "object" && e && typeof e.toJSON == "function" ? e.toJSON(t) : e;
245
+ return n instanceof Number ? Number(n) : n instanceof String || n instanceof Boolean ? n.valueOf() : n;
246
+ }, B = (e, t, n, r) => {
247
+ switch (typeof e) {
248
+ case "string":
249
+ case "boolean": return JSON.stringify(e);
250
+ case "number": return t && !Number.isFinite(e) && R(r, `is ${String(e)}, which JSON can't hold`), JSON.stringify(e);
251
+ case "bigint": return R(r, "is a BigInt, which JSON can't hold");
252
+ case "undefined":
253
+ case "function":
254
+ case "symbol": return t ? R(r, `is ${typeof e}`) : void 0;
255
+ }
256
+ if (e === null) return "null";
257
+ let i = e;
258
+ n.has(i) && R(r, "refers back to an object that contains it");
259
+ let a = Array.isArray(i);
260
+ if (t && !a) {
261
+ let e = Object.getPrototypeOf(i);
262
+ e !== Object.prototype && e !== null && R(r, "is not a plain object"), Object.getOwnPropertySymbols(i).length > 0 && R(r, "has a symbol key");
263
+ }
264
+ n.add(i);
265
+ let o = [];
266
+ if (a) for (let e = 0; e < i.length; e += 1) {
267
+ t && !Object.hasOwn(i, e) && R([...r, e], "is a hole in the array"), r.push(e);
268
+ let a = t ? i[e] : z(i[e], String(e));
269
+ o.push(B(a, t, n, r) ?? "null"), r.pop();
270
+ }
271
+ else {
272
+ let e = i;
273
+ for (let i of Object.keys(e).sort()) {
274
+ r.push(i);
275
+ let a = B(t ? e[i] : z(e[i], i), t, n, r);
276
+ a !== void 0 && o.push(`${JSON.stringify(i)}:${a}`), r.pop();
277
+ }
278
+ }
279
+ return n.delete(i), a ? `[${o.join(",")}]` : `{${o.join(",")}}`;
280
+ }, V = (e, { strict: t = !1 } = {}) => {
281
+ P(e);
282
+ try {
283
+ let n = B(t ? e : z(e, ""), t, new Set(), []);
284
+ return F(e, n), n;
285
+ } catch (t) {
286
+ throw i(t) === k.UNABLE_TO_SERIALIZE_JSON ? t : new O(`Failed to stringify the JSON value deterministically '${String(e)}'.`, {
287
+ code: k.UNABLE_TO_SERIALIZE_JSON,
288
+ cause: t
289
+ });
290
+ }
291
+ }, H = 64, U = new Set([
292
+ 8,
293
+ 9,
294
+ 10,
295
+ 12,
296
+ 13,
297
+ 34,
298
+ 92
299
+ ]), W = (e, t) => {
300
+ let n = 2;
301
+ for (let r = 0; r < e.length && n <= t; r += 1) {
302
+ let t = e.charCodeAt(r);
303
+ U.has(t) ? n += 2 : t < 32 ? n += 6 : t < 128 ? n += 1 : t < 2048 ? n += 2 : t >= 55296 && t <= 56319 && (e.charCodeAt(r + 1) & 64512) == 56320 ? (n += 4, r += 1) : n += t >= 55296 && t <= 57343 ? 6 : 3;
304
+ }
305
+ return n;
306
+ }, G = (e, t, n, r) => {
307
+ if (r > H) throw new O(`The value is nested more than ${H} levels deep.`, { code: k.UNABLE_TO_SERIALIZE_JSON });
308
+ switch (typeof e) {
309
+ case "string": return W(e, t);
310
+ case "number": return Number.isFinite(e) ? String(e).length : 4;
311
+ case "boolean": return e ? 4 : 5;
312
+ case "bigint": throw new O("The value holds a BigInt, which JSON can't hold.", { code: k.UNABLE_TO_SERIALIZE_JSON });
313
+ case "undefined":
314
+ case "function":
315
+ case "symbol": return;
316
+ }
317
+ if (e === null) return 4;
318
+ let i = e;
319
+ if (n.has(i)) throw new O("The value refers back to an object that contains it.", { code: k.UNABLE_TO_SERIALIZE_JSON });
320
+ n.add(i);
321
+ let a = 2, o = 0;
322
+ if (Array.isArray(i)) for (let e = 0; e < i.length && a <= t; e += 1) {
323
+ let s = z(i[e], String(e));
324
+ a += (o === 0 ? 0 : 1) + (G(s, t, n, r + 1) ?? 4), o += 1;
325
+ }
326
+ else {
327
+ let e = i;
328
+ for (let i of Object.keys(e)) {
329
+ if (a > t) break;
330
+ let s = G(z(e[i], i), t, n, r + 1);
331
+ s !== void 0 && (a += (o === 0 ? 0 : 1) + W(i, t) + 1 + s, o += 1);
332
+ }
333
+ }
334
+ return n.delete(i), a;
335
+ }, K = (e, t) => {
336
+ I(t);
337
+ let n;
338
+ try {
339
+ n = G(z(e, ""), t, new Set(), 0);
340
+ } catch (e) {
341
+ throw i(e) === k.UNABLE_TO_SERIALIZE_JSON ? e : new O("Failed to measure the JSON value.", {
342
+ code: k.UNABLE_TO_SERIALIZE_JSON,
343
+ cause: e
344
+ });
345
+ }
346
+ if (n === void 0) throw new O(`JSON.stringify writes nothing for ${typeof e} values.`, { code: k.UNABLE_TO_SERIALIZE_JSON });
347
+ return n;
348
+ }, q = [
349
+ "create-core",
350
+ "normalize-text",
351
+ "calculate-content-digest",
352
+ "parse-manifest",
353
+ "match-manifest-scope",
354
+ "parse-decision",
355
+ "create-project-inspection",
356
+ "read-canonical-content-page",
357
+ "validate-project"
358
+ ], J = { INVALID_RESOURCE_LIMIT: "A Core resource limit is invalid." }, Y = {
359
+ ABORTED: "The Core operation was aborted.",
360
+ CONTENT_INVALID: "The canonical content is not valid UTF-8 text.",
361
+ INVALID_ARGUMENT: "The Core operation received an invalid argument.",
362
+ INSPECTION_BUSY: "Project inspection capacity is busy. Try again shortly.",
363
+ INSPECTION_TIMEOUT: "The isolated project inspection timed out.",
364
+ INSPECTION_PROCESS_FAILED: "The isolated project inspection failed.",
365
+ RESOURCE_LIMIT_EXCEEDED: "A Core resource limit was exceeded."
366
+ }, X = {
367
+ ABORTED: !0,
368
+ CONTENT_INVALID: !1,
369
+ INVALID_ARGUMENT: !1,
370
+ INSPECTION_BUSY: !0,
371
+ INSPECTION_TIMEOUT: !0,
372
+ INSPECTION_PROCESS_FAILED: !1,
373
+ RESOURCE_LIMIT_EXCEEDED: !1
374
+ }, Z = (e) => q.some((t) => t === e), Q = (e) => typeof e == "string" && Object.hasOwn(J, e), $ = (e) => typeof e == "string" && Object.hasOwn(Y, e), ee = class extends O {
375
+ code;
376
+ operation;
377
+ constructor(e) {
378
+ super(J[e.code], {
379
+ code: e.code,
380
+ cause: e.cause
381
+ }), this.code = e.code, this.name = "CoreConfigurationException", this.operation = e.operation;
382
+ }
383
+ }, te = class extends O {
384
+ code;
385
+ operation;
386
+ retryable;
387
+ limit;
388
+ limitMaximum;
389
+ nextAction;
390
+ observedUsage;
391
+ constructor(e) {
392
+ super(Y[e.code], {
393
+ code: e.code,
394
+ cause: e.cause
395
+ }), this.code = e.code, this.name = "CoreOperationException", this.operation = e.operation, this.retryable = X[e.code], this.limit = e.limit ?? null, this.limitMaximum = e.limitMaximum ?? null, this.nextAction = e.nextAction ?? null, this.observedUsage = e.observedUsage ?? null;
396
+ }
397
+ };
398
+ //#endregion
399
+ export { $ as a, I as c, k as d, O as f, Z as i, j as l, a as m, te as n, K as o, i as p, Q as r, V as s, ee as t, M as u };
@@ -0,0 +1,95 @@
1
+ import { u as e } from "./chunk-2cc3bf5c.mjs";
2
+ import { c as t, i as n, l as r } from "./chunk-98d84174.mjs";
3
+ import { Buffer as i } from "node:buffer";
4
+ //#region ../core/dist/chunks/repository-rpc-DVgCPLGx.js
5
+ var a = () => {
6
+ throw new n({
7
+ code: "INVALID_SOURCE_DATA",
8
+ operation: "create-reader",
9
+ path: null,
10
+ retryable: !1
11
+ });
12
+ }, o = (e) => typeof e == "number" && Number.isSafeInteger(e) && e >= 0, s = (e, t) => Object.keys(e).length === t.length && t.every((t) => Object.hasOwn(e, t)), c = (t) => !e(t, !0) || !s(t, ["id", "sourceKind"]) || typeof t.id != "string" || t.id.length === 0 || typeof t.sourceKind != "string" || t.sourceKind.length === 0 ? a() : {
13
+ id: t.id,
14
+ sourceKind: t.sourceKind
15
+ }, l = (n) => {
16
+ if (n === null) return null;
17
+ if (!e(n, !0)) return a();
18
+ let r = n;
19
+ return !s(r, [
20
+ "path",
21
+ "type",
22
+ "byteLength",
23
+ "contentIdentity"
24
+ ]) || !t(r.path) || r.type !== "file" && r.type !== "directory" && r.type !== "symlink" || r.byteLength !== null && !o(r.byteLength) || r.contentIdentity !== null && typeof r.contentIdentity != "string" ? a() : {
25
+ path: r.path,
26
+ type: r.type,
27
+ byteLength: r.byteLength,
28
+ contentIdentity: r.contentIdentity
29
+ };
30
+ }, u = (t) => {
31
+ if (!e(t, !0)) return a();
32
+ let n = t;
33
+ if (!s(n, [
34
+ "entries",
35
+ "isComplete",
36
+ "nextCursor",
37
+ "snapshot"
38
+ ]) || !Array.isArray(n.entries) || n.entries.length > 128 || typeof n.isComplete != "boolean" || n.nextCursor !== null && typeof n.nextCursor != "string") return a();
39
+ let r = [];
40
+ for (let e of n.entries) {
41
+ let t = l(e);
42
+ if (t === null) return a();
43
+ r.push(t);
44
+ }
45
+ return {
46
+ entries: r,
47
+ isComplete: n.isComplete,
48
+ nextCursor: n.nextCursor,
49
+ snapshot: c(n.snapshot)
50
+ };
51
+ }, d = (e) => e === null ? null : typeof e != "string" || i.byteLength(e, "utf8") > 4096 ? a() : e, f = (t) => {
52
+ if (!e(t, !0)) return a();
53
+ let n = t;
54
+ if (!s(n, [
55
+ "bytes",
56
+ "isComplete",
57
+ "nextOffset",
58
+ "offset",
59
+ "snapshot",
60
+ "totalBytes"
61
+ ]) || typeof n.bytes != "string" || n.bytes.length > 87384 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(n.bytes) || typeof n.isComplete != "boolean" || !o(n.offset) || !o(n.totalBytes) || n.nextOffset !== null && !o(n.nextOffset)) return a();
62
+ let r = i.from(n.bytes, "base64");
63
+ return r.byteLength > 65536 || r.toString("base64") !== n.bytes ? a() : {
64
+ bytes: r,
65
+ isComplete: n.isComplete,
66
+ nextOffset: n.nextOffset,
67
+ offset: n.offset,
68
+ snapshot: c(n.snapshot),
69
+ totalBytes: n.totalBytes
70
+ };
71
+ }, p = (e, t) => {
72
+ if (!(e.bytes instanceof Uint8Array) || e.bytes.byteLength > t) return a();
73
+ let n = {
74
+ ...e,
75
+ bytes: i.from(e.bytes.buffer, e.bytes.byteOffset, e.bytes.byteLength).toString("base64")
76
+ };
77
+ return f(n), n;
78
+ }, m = async (e, t, n) => {
79
+ let i = (t) => t === "repository" ? e.repository : e.instructions ?? a();
80
+ if (t.method === "readLinkText") return d(await i(t.source).readLinkText(r(t.path), { signal: n }));
81
+ if (t.method === "getEntry") return l(await i(t.source).getEntry(r(t.path), { signal: n }));
82
+ let o = e.repository;
83
+ return t.method === "listEntriesPage" ? u(await o.listEntriesPage({
84
+ maxEntries: t.maxEntries,
85
+ signal: n,
86
+ ...t.prefix === void 0 ? {} : { prefix: r(t.prefix) },
87
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor }
88
+ })) : p(await i(t.source).readFilePage(r(t.path), {
89
+ maxBytes: t.maxBytes,
90
+ offset: t.offset,
91
+ signal: n
92
+ }), t.maxBytes);
93
+ };
94
+ //#endregion
95
+ export { d as a, f as i, l as n, u as r, m as t };