@incajs/cli 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,733 @@
1
+ import e, { isAbsolute as t } from "node:path";
2
+ import n, { lstatSync as r, realpathSync as i, statSync as a } from "node:fs";
3
+ import { format as o, inspect as s } from "node:util";
4
+ import { URL as c, fileURLToPath as l, pathToFileURL as u } from "node:url";
5
+ import d from "node:assert";
6
+ import f from "node:process";
7
+ //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
8
+ var p = /^[A-Za-z]:\//;
9
+ function m(e = "") {
10
+ return e && e.replace(/\\/g, "/").replace(p, (e) => e.toUpperCase());
11
+ }
12
+ var h = /^[/\\]{2}/, g = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _ = /^[A-Za-z]:$/, ee = /.(\.[^./]+|\.)$/, v = function(e) {
13
+ if (e.length === 0) return ".";
14
+ e = m(e);
15
+ let t = e.match(h), n = b(e), r = e[e.length - 1] === "/";
16
+ return e = y(e, !n), e.length === 0 ? n ? "/" : r ? "./" : "." : (r && (e += "/"), _.test(e) && (e += "/"), t ? n ? `//${e}` : `//./${e}` : n && !b(e) ? `/${e}` : e);
17
+ }, te = function(...e) {
18
+ let t = "";
19
+ for (let n of e) if (n) {
20
+ if (t.length > 0) {
21
+ let e = t[t.length - 1] === "/", r = n[0] === "/";
22
+ t += e && r ? n.slice(1) : e || r ? n : `/${n}`;
23
+ } else t += n;
24
+ }
25
+ return v(t);
26
+ };
27
+ function ne() {
28
+ return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
29
+ }
30
+ var re = function(...e) {
31
+ e = e.map((e) => m(e));
32
+ let t = "", n = !1;
33
+ for (let r = e.length - 1; r >= -1 && !n; r--) {
34
+ let i = r >= 0 ? e[r] : ne();
35
+ i && i.length !== 0 && (t = `${i}/${t}`, n = b(i));
36
+ }
37
+ return t = y(t, !n), n && !b(t) ? `/${t}` : t.length > 0 ? t : ".";
38
+ };
39
+ function y(e, t) {
40
+ let n = "", r = 0, i = -1, a = 0, o = null;
41
+ for (let s = 0; s <= e.length; ++s) {
42
+ if (s < e.length) o = e[s];
43
+ else if (o === "/") break;
44
+ else o = "/";
45
+ if (o === "/") {
46
+ if (i !== s - 1 && a !== 1) {
47
+ if (a === 2) {
48
+ if (n.length < 2 || r !== 2 || n[n.length - 1] !== "." || n[n.length - 2] !== ".") {
49
+ if (n.length > 2) {
50
+ let e = n.lastIndexOf("/");
51
+ e === -1 ? (n = "", r = 0) : (n = n.slice(0, e), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
52
+ continue;
53
+ }
54
+ if (n.length > 0) {
55
+ n = "", r = 0, i = s, a = 0;
56
+ continue;
57
+ }
58
+ }
59
+ t && (n += n.length > 0 ? "/.." : "..", r = 2);
60
+ } else n.length > 0 ? n += `/${e.slice(i + 1, s)}` : n = e.slice(i + 1, s), r = s - i - 1;
61
+ }
62
+ i = s, a = 0;
63
+ } else o === "." && a !== -1 ? ++a : a = -1;
64
+ }
65
+ return n;
66
+ }
67
+ var b = function(e) {
68
+ return g.test(e);
69
+ }, ie = function(e) {
70
+ if (e === "..") return "";
71
+ let t = ee.exec(m(e));
72
+ return t && t[1] || "";
73
+ }, ae = function(e) {
74
+ let t = m(e).replace(/\/$/, "").split("/").slice(0, -1);
75
+ return t.length === 1 && _.test(t[0]) && (t[0] += "/"), t.join("/") || (b(e) ? "/" : ".");
76
+ }, oe = function(e, t) {
77
+ let n = m(e).split("/"), r = "";
78
+ for (let e = n.length - 1; e >= 0; e--) {
79
+ let t = n[e];
80
+ if (t) {
81
+ r = t;
82
+ break;
83
+ }
84
+ }
85
+ return t && r.endsWith(t) ? r.slice(0, -t.length) : r;
86
+ }, x = /* @__PURE__ */ "_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib".split("."), se = /^([A-Z][a-z\d]*)+$/, ce = /* @__PURE__ */ new Set([
87
+ "string",
88
+ "function",
89
+ "number",
90
+ "object",
91
+ "Function",
92
+ "Object",
93
+ "boolean",
94
+ "bigint",
95
+ "symbol"
96
+ ]), S = /* @__PURE__ */ new Map();
97
+ function C(e, t = "and") {
98
+ switch (e.length) {
99
+ case 0: return "";
100
+ case 1: return `${e[0]}`;
101
+ case 2: return `${e[0]} ${t} ${e[1]}`;
102
+ case 3: return `${e[0]}, ${e[1]}, ${t} ${e[2]}`;
103
+ default: return `${e.slice(0, -1).join(", ")}, ${t} ${e.at(-1)}`;
104
+ }
105
+ }
106
+ function w(e) {
107
+ let t = 0, n = /%[dfijoOs]/g;
108
+ for (; n.exec(e) !== null;) t++;
109
+ return t;
110
+ }
111
+ function T(e, t, n) {
112
+ return S.set(e, t), le(n, e);
113
+ }
114
+ var E = Symbol("kIsNodeError");
115
+ function le(e, t) {
116
+ let n = S.get(t), r = typeof n == "string" ? w(n) : -1;
117
+ switch (r) {
118
+ case 0: {
119
+ class i extends e {
120
+ code = t;
121
+ constructor(...e) {
122
+ d.ok(e.length === 0, `Code: ${t}; The provided arguments length (${e.length}) does not match the required ones (${r}).`), super(n);
123
+ }
124
+ get ["constructor"]() {
125
+ return e;
126
+ }
127
+ get [E]() {
128
+ return !0;
129
+ }
130
+ toString() {
131
+ return `${this.name} [${t}]: ${this.message}`;
132
+ }
133
+ }
134
+ return i;
135
+ }
136
+ case -1: {
137
+ class n extends e {
138
+ code = t;
139
+ constructor(...e) {
140
+ super(), Object.defineProperty(this, "message", {
141
+ value: ue(t, e, this),
142
+ enumerable: !1,
143
+ writable: !0,
144
+ configurable: !0
145
+ });
146
+ }
147
+ get ["constructor"]() {
148
+ return e;
149
+ }
150
+ get [E]() {
151
+ return !0;
152
+ }
153
+ toString() {
154
+ return `${this.name} [${t}]: ${this.message}`;
155
+ }
156
+ }
157
+ return n;
158
+ }
159
+ default: {
160
+ class i extends e {
161
+ code = t;
162
+ constructor(...e) {
163
+ d.ok(e.length === r, `Code: ${t}; The provided arguments length (${e.length}) does not match the required ones (${r}).`), e.unshift(n), super(Reflect.apply(o, null, e));
164
+ }
165
+ get ["constructor"]() {
166
+ return e;
167
+ }
168
+ get [E]() {
169
+ return !0;
170
+ }
171
+ toString() {
172
+ return `${this.name} [${t}]: ${this.message}`;
173
+ }
174
+ }
175
+ return i;
176
+ }
177
+ }
178
+ }
179
+ function ue(e, t, n) {
180
+ let r = S.get(e);
181
+ if (d.ok(r !== void 0, "expected `message` to be found"), typeof r == "function") return d.ok(r.length <= t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`), Reflect.apply(r, n, t);
182
+ let i = w(r);
183
+ return d.ok(i === t.length, `Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${i}).`), t.length === 0 ? r : (t.unshift(r), Reflect.apply(o, null, t));
184
+ }
185
+ function de(e) {
186
+ if (e === null) return "null";
187
+ if (e === void 0) return "undefined";
188
+ let t = typeof e;
189
+ switch (t) {
190
+ case "bigint": return `type bigint (${e}n)`;
191
+ case "number": return e === 0 ? 1 / e == -Infinity ? "type number (-0)" : "type number (0)" : Number.isNaN(e) ? "type number (NaN)" : e === Infinity ? "type number (Infinity)" : e === -Infinity ? "type number (-Infinity)" : `type number (${e})`;
192
+ case "boolean": return e ? "type boolean (true)" : "type boolean (false)";
193
+ case "symbol": return `type symbol (${String(e)})`;
194
+ case "function": return `function ${e.name}`;
195
+ case "object": return e.constructor && e.constructor.name ? `an instance of ${e.constructor.name}` : `${s(e, { depth: -1 })}`;
196
+ case "string": {
197
+ let t = e;
198
+ return t.length > 28 && (t = `${t.slice(0, 25)}...`), t.includes("'") ? `type string (${JSON.stringify(t)})` : `type string ('${t}')`;
199
+ }
200
+ default: {
201
+ let n = s(e, { colors: !1 });
202
+ return n.length > 28 && (n = `${n.slice(0, 25)}...`), `type ${t} (${n})`;
203
+ }
204
+ }
205
+ }
206
+ T("ERR_INVALID_ARG_TYPE", (e, t, n) => {
207
+ d.ok(typeof e == "string", "'name' must be a string"), Array.isArray(t) || (t = [t]);
208
+ let r = "The ";
209
+ if (e.endsWith(" argument")) r += `${e} `;
210
+ else {
211
+ let t = e.includes(".") ? "property" : "argument";
212
+ r += `"${e}" ${t} `;
213
+ }
214
+ r += "must be ";
215
+ let i = [], a = [], o = [];
216
+ for (let e of t) d.ok(typeof e == "string", "All expected entries have to be of type string"), ce.has(e) ? i.push(e.toLowerCase()) : se.exec(e) === null ? (d.ok(e !== "object", "The value \"object\" should be written as \"Object\""), o.push(e)) : a.push(e);
217
+ if (a.length > 0) {
218
+ let e = i.indexOf("object");
219
+ e !== -1 && (i.splice(e, 1), a.push("Object"));
220
+ }
221
+ return i.length > 0 && (r += `${i.length > 1 ? "one of type" : "of type"} ${C(i, "or")}`, (a.length > 0 || o.length > 0) && (r += " or ")), a.length > 0 && (r += `an instance of ${C(a, "or")}`, o.length > 0 && (r += " or ")), o.length > 0 && (o.length > 1 ? r += `one of ${C(o, "or")}` : (o[0]?.toLowerCase() !== o[0] && (r += "an "), r += `${o[0]}`)), r += `. Received ${de(n)}`, r;
222
+ }, TypeError);
223
+ var D = T("ERR_INVALID_MODULE_SPECIFIER", (e, t, n) => `Invalid module "${e}" ${t}${n ? ` imported from ${n}` : ""}`, TypeError), O = T("ERR_INVALID_PACKAGE_CONFIG", (e, t, n) => `Invalid package config ${e}${t ? ` while importing ${t}` : ""}${n ? `. ${n}` : ""}`, Error), fe = T("ERR_INVALID_PACKAGE_TARGET", (e, t, n, r = !1, i) => {
224
+ let a = typeof n == "string" && !r && n.length > 0 && !n.startsWith("./");
225
+ return t === "." ? (d.ok(r === !1), `Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i ? ` imported from ${i}` : ""}${a ? "; targets must start with \"./\"" : ""}`) : `Invalid "${r ? "imports" : "exports"}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i ? ` imported from ${i}` : ""}${a ? "; targets must start with \"./\"" : ""}`;
226
+ }, Error), k = T("ERR_MODULE_NOT_FOUND", function(e, t, n = !1) {
227
+ return n && typeof n == "string" && (this.url = `${n}`), `Cannot find ${n ? "module" : "package"} '${e}' imported from ${t}`;
228
+ }, Error), pe = T("ERR_PACKAGE_IMPORT_NOT_DEFINED", (e, t, n) => `Package import specifier "${e}" is not defined${t ? ` in package ${t || ""}package.json` : ""} imported from ${n}`, TypeError), me = T("ERR_PACKAGE_PATH_NOT_EXPORTED", (e, t, n) => t === "." ? `No "exports" main defined in ${e}package.json${n ? ` imported from ${n}` : ""}` : `Package subpath '${t}' is not defined by "exports" in ${e}package.json${n ? ` imported from ${n}` : ""}`, Error), he = T("ERR_UNSUPPORTED_DIR_IMPORT", function(e, t, n = void 0) {
229
+ return this.url = n, `Directory import '${e}' is not supported resolving ES modules imported from ${t}`;
230
+ }, Error), A = T("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError), ge = T("ERR_UNKNOWN_FILE_EXTENSION", (e, t) => `Unknown file extension "${e}" for ${t}`, TypeError);
231
+ T("ERR_INVALID_ARG_VALUE", (e, t, n = "is invalid") => {
232
+ let r = s(t);
233
+ return r.length > 128 && (r = `${r.slice(0, 128)}...`), `The ${e.includes(".") ? "property" : "argument"} '${e}' ${n}. Received ${r}`;
234
+ }, TypeError);
235
+ var j = {}.hasOwnProperty, M = /* @__PURE__ */ new Map();
236
+ function N(t, { base: r, specifier: i }) {
237
+ let a = M.get(t);
238
+ if (a) return a;
239
+ let o;
240
+ try {
241
+ o = n.readFileSync(e.toNamespacedPath(t), "utf8");
242
+ } catch (e) {
243
+ let t = e;
244
+ if (t.code !== "ENOENT") throw t;
245
+ }
246
+ let s = {
247
+ exists: !1,
248
+ pjsonPath: t,
249
+ main: void 0,
250
+ name: void 0,
251
+ type: "none",
252
+ exports: void 0,
253
+ imports: void 0
254
+ };
255
+ if (o !== void 0) {
256
+ let e;
257
+ try {
258
+ e = JSON.parse(o);
259
+ } catch (e) {
260
+ let n = new O(t, (r ? `"${i}" from ` : "") + l(r || i), e.message);
261
+ throw n.cause = e, n;
262
+ }
263
+ s.exists = !0, j.call(e, "name") && typeof e.name == "string" && (s.name = e.name), j.call(e, "main") && typeof e.main == "string" && (s.main = e.main), j.call(e, "exports") && (s.exports = e.exports), j.call(e, "imports") && (s.imports = e.imports), j.call(e, "type") && (e.type === "commonjs" || e.type === "module") && (s.type = e.type);
264
+ }
265
+ return M.set(t, s), s;
266
+ }
267
+ function P(e) {
268
+ let t = new URL("package.json", e);
269
+ for (; !t.pathname.endsWith("node_modules/package.json");) {
270
+ let n = N(l(t), { specifier: e });
271
+ if (n.exists) return n;
272
+ let r = t;
273
+ if (t = new URL("../package.json", t), t.pathname === r.pathname) break;
274
+ }
275
+ return {
276
+ pjsonPath: l(t),
277
+ exists: !1,
278
+ type: "none"
279
+ };
280
+ }
281
+ var _e = {}.hasOwnProperty, ve = {
282
+ __proto__: null,
283
+ ".json": "json",
284
+ ".cjs": "commonjs",
285
+ ".cts": "commonjs",
286
+ ".js": "module",
287
+ ".ts": "module",
288
+ ".mts": "module",
289
+ ".mjs": "module"
290
+ }, F = {
291
+ __proto__: null,
292
+ "data:": be,
293
+ "file:": Ce,
294
+ "node:": () => "builtin"
295
+ };
296
+ function ye(e) {
297
+ return e && /^\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?$/i.test(e) ? "module" : e === "application/json" ? "json" : null;
298
+ }
299
+ function be(e) {
300
+ let { 1: t } = /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/.exec(e.pathname) || [
301
+ null,
302
+ null,
303
+ null
304
+ ];
305
+ return ye(t);
306
+ }
307
+ var xe = 46, I = 47;
308
+ function Se(e) {
309
+ let t = e.pathname;
310
+ for (let e = t.length - 1; e > 0; e--) switch (t.charCodeAt(e)) {
311
+ case I: return "";
312
+ case xe: return t.charCodeAt(e - 1) === I ? "" : t.slice(e);
313
+ }
314
+ return "";
315
+ }
316
+ function Ce(e, t, n) {
317
+ let r = Se(e);
318
+ if (r === ".js") {
319
+ let { type: t } = P(e);
320
+ return t === "none" ? "commonjs" : t;
321
+ }
322
+ if (r === "") {
323
+ let { type: t } = P(e);
324
+ return t === "module" ? "module" : t === "none" ? "commonjs" : t;
325
+ }
326
+ let i = ve[r];
327
+ if (i) return i;
328
+ if (!n) throw new ge(r, l(e));
329
+ }
330
+ function we(e, t) {
331
+ let n = e.protocol;
332
+ return _e.call(F, n) && F[n](e, t, !0) || null;
333
+ }
334
+ var L = RegExp.prototype[Symbol.replace], R = {}.hasOwnProperty, z = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, B = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, Te = /^\.|%|\\/, V = /\*/g, Ee = /%2f|%5c/i, H = /* @__PURE__ */ new Set(), De = /[/\\]{2}/;
335
+ function U(e, t, n, r, i, a, o) {
336
+ if (f.noDeprecation) return;
337
+ let s = l(r), c = De.exec(o ? e : t) !== null;
338
+ f.emitWarning(`Use of deprecated ${c ? "double slash" : "leading or trailing slash matching"} resolving "${e}" for module request "${t}" ${t === n ? "" : `matched to "${n}" `}in the "${i ? "imports" : "exports"}" field module resolution of the package at ${s}${a ? ` imported from ${l(a)}` : ""}.`, "DeprecationWarning", "DEP0166");
339
+ }
340
+ function W(t, n, r, i) {
341
+ if (f.noDeprecation || we(t, { parentURL: r.href }) !== "module") return;
342
+ let a = l(t.href), o = l(new c(".", n)), s = l(r);
343
+ i ? e.resolve(o, i) !== a && f.emitWarning(`Package ${o} has a "main" field set to "${i}", excluding the full filename and extension to the resolved file at "${a.slice(o.length)}", imported from ${s}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151") : f.emitWarning(`No "main" or "exports" field defined in the package.json for ${o} resolving the main entry point "${a.slice(o.length)}", imported from ${s}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
344
+ }
345
+ function G(e) {
346
+ try {
347
+ return a(e);
348
+ } catch {}
349
+ }
350
+ function K(e) {
351
+ let t = a(e, { throwIfNoEntry: !1 });
352
+ return (t ? t.isFile() : void 0) ?? !1;
353
+ }
354
+ function Oe(e, t, n) {
355
+ let r;
356
+ if (t.main !== void 0) {
357
+ if (r = new c(t.main, e), K(r)) return r;
358
+ let i = [
359
+ `./${t.main}.js`,
360
+ `./${t.main}.json`,
361
+ `./${t.main}.node`,
362
+ `./${t.main}/index.js`,
363
+ `./${t.main}/index.json`,
364
+ `./${t.main}/index.node`
365
+ ], a = -1;
366
+ for (; ++a < i.length && (r = new c(i[a], e), !K(r));) r = void 0;
367
+ if (r) return W(r, e, n, t.main), r;
368
+ }
369
+ let i = [
370
+ "./index.js",
371
+ "./index.json",
372
+ "./index.node"
373
+ ], a = -1;
374
+ for (; ++a < i.length && (r = new c(i[a], e), !K(r));) r = void 0;
375
+ if (r) return W(r, e, n, t.main), r;
376
+ throw new k(l(new c(".", e)), l(n));
377
+ }
378
+ function ke(t, n, r) {
379
+ if (Ee.exec(t.pathname) !== null) throw new D(t.pathname, String.raw`must not include encoded "/" or "\" characters`, l(n));
380
+ let a;
381
+ try {
382
+ a = l(t);
383
+ } catch (e) {
384
+ throw Object.defineProperty(e, "input", { value: String(t) }), Object.defineProperty(e, "module", { value: String(n) }), e;
385
+ }
386
+ let o = G(a.endsWith("/") ? a.slice(-1) : a);
387
+ if (o && o.isDirectory()) {
388
+ let e = new he(a, l(n));
389
+ throw e.url = String(t), e;
390
+ }
391
+ if (!o || !o.isFile()) {
392
+ let e = new k(a || t.pathname, n && l(n), !0);
393
+ throw e.url = String(t), e;
394
+ }
395
+ if (!r) {
396
+ let n = i(a), { search: r, hash: o } = t;
397
+ t = u(n + (a.endsWith(e.sep) ? "/" : "")), t.search = r, t.hash = o;
398
+ }
399
+ return t;
400
+ }
401
+ function Ae(e, t, n) {
402
+ return new pe(e, t && l(new c(".", t)), l(n));
403
+ }
404
+ function q(e, t, n) {
405
+ return new me(l(new c(".", t)), e, n && l(n));
406
+ }
407
+ function je(e, t, n, r, i) {
408
+ throw new D(e, `request is not a valid match in pattern "${t}" for the "${r ? "imports" : "exports"}" resolution of ${l(n)}`, i && l(i));
409
+ }
410
+ function J(e, t, n, r, i) {
411
+ return t = typeof t == "object" && t ? JSON.stringify(t, null, "") : `${t}`, new fe(l(new c(".", n)), e, t, r, i && l(i));
412
+ }
413
+ function Me(e, t, n, r, i, a, o, s, l) {
414
+ if (t !== "" && !a && e.at(-1) !== "/") throw J(n, e, r, o, i);
415
+ if (!e.startsWith("./")) {
416
+ if (o && !e.startsWith("../") && !e.startsWith("/")) {
417
+ let n = !1;
418
+ try {
419
+ new c(e), n = !0;
420
+ } catch {}
421
+ if (!n) return Q(a ? L.call(V, e, () => t) : e + t, r, l);
422
+ }
423
+ throw J(n, e, r, o, i);
424
+ }
425
+ if (z.exec(e.slice(2)) !== null) {
426
+ if (B.exec(e.slice(2)) === null) {
427
+ if (!s) {
428
+ let s = a ? n.replace("*", () => t) : n + t;
429
+ U(a ? L.call(V, e, () => t) : e, s, n, r, o, i, !0);
430
+ }
431
+ } else throw J(n, e, r, o, i);
432
+ }
433
+ let u = new c(e, r), d = u.pathname, f = new c(".", r).pathname;
434
+ if (!d.startsWith(f)) throw J(n, e, r, o, i);
435
+ if (t === "") return u;
436
+ if (z.exec(t) !== null) {
437
+ let c = a ? n.replace("*", () => t) : n + t;
438
+ B.exec(t) === null ? s || U(a ? L.call(V, e, () => t) : e, c, n, r, o, i, !1) : je(c, n, r, o, i);
439
+ }
440
+ return a ? new c(L.call(V, u.href, () => t)) : new c(t, u);
441
+ }
442
+ function Ne(e) {
443
+ let t = Number(e);
444
+ return `${t}` === e && t >= 0 && t < 4294967295;
445
+ }
446
+ function Y(e, t, n, r, i, a, o, s, c) {
447
+ if (typeof t == "string") return Me(t, n, r, e, i, a, o, s, c);
448
+ if (Array.isArray(t)) {
449
+ let l = t;
450
+ if (l.length === 0) return null;
451
+ let u, d = -1;
452
+ for (; ++d < l.length;) {
453
+ let t = l[d], f;
454
+ try {
455
+ f = Y(e, t, n, r, i, a, o, s, c);
456
+ } catch (e) {
457
+ let t = e;
458
+ if (u = t, t.code === "ERR_INVALID_PACKAGE_TARGET") continue;
459
+ throw e;
460
+ }
461
+ if (f !== void 0) {
462
+ if (f === null) {
463
+ u = null;
464
+ continue;
465
+ }
466
+ return f;
467
+ }
468
+ }
469
+ if (u == null) return u;
470
+ throw u;
471
+ }
472
+ if (typeof t == "object" && t) {
473
+ let u = Object.getOwnPropertyNames(t), d = -1;
474
+ for (; ++d < u.length;) {
475
+ let t = u[d];
476
+ if (Ne(t)) throw new O(l(e), l(i), "\"exports\" cannot contain numeric property keys.");
477
+ }
478
+ for (d = -1; ++d < u.length;) {
479
+ let l = u[d];
480
+ if (l === "default" || c && c.has(l)) {
481
+ let u = t[l], d = Y(e, u, n, r, i, a, o, s, c);
482
+ if (d === void 0) continue;
483
+ return d;
484
+ }
485
+ }
486
+ return;
487
+ }
488
+ if (t === null) return null;
489
+ throw J(r, t, e, o, i);
490
+ }
491
+ function Pe(e, t, n) {
492
+ if (typeof e == "string" || Array.isArray(e)) return !0;
493
+ if (typeof e != "object" || !e) return !1;
494
+ let r = Object.getOwnPropertyNames(e), i = !1, a = 0, o = -1;
495
+ for (; ++o < r.length;) {
496
+ let e = r[o], s = e === "" || e[0] !== ".";
497
+ if (a++ === 0) i = s;
498
+ else if (i !== s) throw new O(l(t), l(n), "\"exports\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.");
499
+ }
500
+ return i;
501
+ }
502
+ function Fe(e, t, n) {
503
+ if (f.noDeprecation) return;
504
+ let r = l(t);
505
+ H.has(r + "|" + e) || (H.add(r + "|" + e), f.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n ? ` imported from ${l(n)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155"));
506
+ }
507
+ function X(e, t, n, r, i) {
508
+ let a = n.exports;
509
+ if (Pe(a, e, r) && (a = { ".": a }), R.call(a, t) && !t.includes("*") && !t.endsWith("/")) {
510
+ let n = a[t], o = Y(e, n, "", t, r, !1, !1, !1, i);
511
+ if (o == null) throw q(t, e, r);
512
+ return o;
513
+ }
514
+ let o = "", s = "", c = Object.getOwnPropertyNames(a), l = -1;
515
+ for (; ++l < c.length;) {
516
+ let n = c[l], i = n.indexOf("*");
517
+ if (i !== -1 && t.startsWith(n.slice(0, i))) {
518
+ t.endsWith("/") && Fe(t, e, r);
519
+ let a = n.slice(i + 1);
520
+ t.length >= n.length && t.endsWith(a) && Z(o, n) === 1 && n.lastIndexOf("*") === i && (o = n, s = t.slice(i, t.length - a.length));
521
+ }
522
+ }
523
+ if (o) {
524
+ let n = a[o], c = Y(e, n, s, o, r, !0, !1, t.endsWith("/"), i);
525
+ if (c == null) throw q(t, e, r);
526
+ return c;
527
+ }
528
+ throw q(t, e, r);
529
+ }
530
+ function Z(e, t) {
531
+ let n = e.indexOf("*"), r = t.indexOf("*"), i = n === -1 ? e.length : n + 1, a = r === -1 ? t.length : r + 1;
532
+ return i > a ? -1 : a > i || n === -1 ? 1 : r === -1 || e.length > t.length ? -1 : +(t.length > e.length);
533
+ }
534
+ function Ie(e, t, n) {
535
+ if (e === "#" || e.endsWith("/")) throw new D(e, "is not a valid internal imports specifier name", l(t));
536
+ let r, i = P(t);
537
+ if (i.exists) {
538
+ r = u(i.pjsonPath);
539
+ let a = i.imports;
540
+ if (a) {
541
+ if (R.call(a, e) && !e.includes("*")) {
542
+ let i = Y(r, a[e], "", e, t, !1, !0, !1, n);
543
+ if (i != null) return i;
544
+ } else {
545
+ let i = "", o = "", s = Object.getOwnPropertyNames(a), c = -1;
546
+ for (; ++c < s.length;) {
547
+ let t = s[c], n = t.indexOf("*");
548
+ if (n !== -1 && e.startsWith(t.slice(0, n))) {
549
+ let r = t.slice(n + 1);
550
+ e.length >= t.length && e.endsWith(r) && Z(i, t) === 1 && t.lastIndexOf("*") === n && (i = t, o = e.slice(n, e.length - r.length));
551
+ }
552
+ }
553
+ if (i) {
554
+ let e = a[i], s = Y(r, e, o, i, t, !0, !0, !1, n);
555
+ if (s != null) return s;
556
+ }
557
+ }
558
+ }
559
+ }
560
+ throw Ae(e, r, t);
561
+ }
562
+ function Le(e, t) {
563
+ let n = e.indexOf("/"), r = !0, i = !1;
564
+ e[0] === "@" && (i = !0, n === -1 || e.length === 0 ? r = !1 : n = e.indexOf("/", n + 1));
565
+ let a = n === -1 ? e : e.slice(0, n);
566
+ if (Te.exec(a) !== null && (r = !1), !r) throw new D(e, "is not a valid package name", l(t));
567
+ return {
568
+ packageName: a,
569
+ packageSubpath: "." + (n === -1 ? "" : e.slice(n)),
570
+ isScoped: i
571
+ };
572
+ }
573
+ function Q(e, t, n) {
574
+ if (x.includes(e)) return new c("node:" + e);
575
+ let { packageName: r, packageSubpath: i, isScoped: a } = Le(e, t), o = P(t);
576
+ if (o.exists && o.name === r && o.exports !== void 0 && o.exports !== null) return X(u(o.pjsonPath), i, o, t, n);
577
+ let s = new c("./node_modules/" + r + "/package.json", t), d = l(s), f;
578
+ do {
579
+ let o = G(d.slice(0, -13));
580
+ if (!o || !o.isDirectory()) {
581
+ f = d, s = new c((a ? "../../../../node_modules/" : "../../../node_modules/") + r + "/package.json", s), d = l(s);
582
+ continue;
583
+ }
584
+ let u = N(d, {
585
+ base: t,
586
+ specifier: e
587
+ });
588
+ return u.exports !== void 0 && u.exports !== null ? X(s, i, u, t, n) : i === "." ? Oe(s, u, t) : new c(i, s);
589
+ } while (d.length !== f.length);
590
+ throw new k(r, l(t), !1);
591
+ }
592
+ function Re(e) {
593
+ return !(e[0] !== "." || e.length !== 1 && e[1] !== "/" && (e[1] !== "." || e.length !== 2 && e[2] !== "/"));
594
+ }
595
+ function ze(e) {
596
+ return e === "" ? !1 : e[0] === "/" || Re(e);
597
+ }
598
+ function Be(e, t, n, r) {
599
+ let i = t.protocol, a = i === "data:", o;
600
+ if (ze(e)) try {
601
+ o = new c(e, t);
602
+ } catch (n) {
603
+ let r = new A(e, t);
604
+ throw r.cause = n, r;
605
+ }
606
+ else if (i === "file:" && e[0] === "#") o = Ie(e, t, n);
607
+ else try {
608
+ o = new c(e);
609
+ } catch (r) {
610
+ if (a && !x.includes(e)) {
611
+ let n = new A(e, t);
612
+ throw n.cause = r, n;
613
+ }
614
+ o = Q(e, t, n);
615
+ }
616
+ return d.ok(o !== void 0, "expected to be defined"), o.protocol === "file:" ? ke(o, t, r) : o;
617
+ }
618
+ var Ve = /* #__PURE__ */ new Set(["node", "import"]), He = "2:6:import4:node", Ue = process.platform === "win32", We = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
619
+ function Ge(e, t) {
620
+ let n = nt(e);
621
+ if ("external" in n) return n.external;
622
+ let a = n.specifier, o = n.url, s = n.absolutePath, c, l;
623
+ if (t?.cache !== !1 && (c = Ze(s || a, t), l = t?.cache && typeof t?.cache == "object" ? t.cache : We), l) {
624
+ let e = l.get(c);
625
+ if (typeof e == "string") return e;
626
+ if (e instanceof Error) {
627
+ if (t?.try) return;
628
+ throw e;
629
+ }
630
+ }
631
+ if (s) try {
632
+ let e = r(s);
633
+ if (e.isSymbolicLink() && (s = i(s), o = u(s)), e.isFile()) return l && l.set(c, o.href), o.href;
634
+ } catch (e) {
635
+ if (e?.code !== "ENOENT") throw l && l.set(c, e), e;
636
+ }
637
+ let d = t?.conditions ? new Set(t.conditions) : Ve, f = a || o.href, p = Je(t?.from), m = t?.suffixes || [""], h = t?.extensions ? ["", ...t.extensions] : [""], g;
638
+ for (let e of p) {
639
+ for (let t of m) {
640
+ let n = $e(f, t);
641
+ n === "." && (n += "/.");
642
+ for (let t of h) if (g = qe(n + t, e, d), g) break;
643
+ if (g) break;
644
+ }
645
+ if (g) break;
646
+ }
647
+ if (!g) {
648
+ let n = /* @__PURE__ */ Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Xe(e)).join(", ")})`);
649
+ if (n.code = "ERR_MODULE_NOT_FOUND", l && l.set(c, n), t?.try) return;
650
+ throw n;
651
+ }
652
+ return l && l.set(c, g.href), g.href;
653
+ }
654
+ function Ke(e, t) {
655
+ let n = Ge(e, t);
656
+ if (!n || !n.startsWith("file://") && t?.try) return;
657
+ let r = l(n);
658
+ return Ue ? et(r) : r;
659
+ }
660
+ function qe(e, t, n) {
661
+ try {
662
+ return Be(e, t, n);
663
+ } catch {}
664
+ }
665
+ function Je(e) {
666
+ let t = (Array.isArray(e) ? e : [e]).flatMap((e) => Ye(e));
667
+ return t.length === 0 ? [u("./")] : t;
668
+ }
669
+ function Ye(e) {
670
+ if (!e) return [];
671
+ if (tt(e)) return [e];
672
+ if (typeof e != "string") return [];
673
+ if (/^(?:node|data|http|https|file):/.test(e)) return new URL(e);
674
+ try {
675
+ return e.endsWith("/") || a(e).isDirectory() ? u(e + "/") : u(e);
676
+ } catch {
677
+ return [u(e + "/"), u(e)];
678
+ }
679
+ }
680
+ function Xe(e) {
681
+ try {
682
+ return l(e);
683
+ } catch {
684
+ return e;
685
+ }
686
+ }
687
+ function Ze(e, t) {
688
+ let n;
689
+ return Array.isArray(t?.from) ? n = t.from : t?.from && (n = [t.from]), $([e]) + Qe(t?.conditions) + $(t?.extensions) + $(n) + $(t?.suffixes);
690
+ }
691
+ function Qe(e) {
692
+ return e ? $([...new Set(e)].sort()) : He;
693
+ }
694
+ function $(e) {
695
+ if (!e) return "-";
696
+ let t = `${e.length}:`;
697
+ for (let n of e) {
698
+ let e = String(n);
699
+ t += `${e.length}:${e}`;
700
+ }
701
+ return t;
702
+ }
703
+ function $e(e, t) {
704
+ return !e || !t || t === "/" ? e : (e.endsWith("/") ? e : e + "/") + (t.startsWith("/") ? t.slice(1) : t);
705
+ }
706
+ function et(e) {
707
+ return e.replace(/\\/g, "/").replace(/^[a-z]:\//, (e) => e.toUpperCase());
708
+ }
709
+ function tt(e) {
710
+ return e instanceof URL || e?.constructor?.name === "URL";
711
+ }
712
+ function nt(e) {
713
+ if (typeof e == "string") {
714
+ if (e.startsWith("file:")) {
715
+ let t = new URL(e);
716
+ return {
717
+ url: t,
718
+ absolutePath: l(t)
719
+ };
720
+ }
721
+ return t(e) ? {
722
+ url: u(e),
723
+ absolutePath: e
724
+ } : /^(?:node|data|http|https):/.test(e) ? { external: e } : x.includes(e) && !e.includes(":") ? { external: `node:${e}` } : { specifier: e };
725
+ }
726
+ if (tt(e)) return e.protocol === "file:" ? {
727
+ url: e,
728
+ absolutePath: l(e)
729
+ } : { external: e.href };
730
+ throw TypeError("id must be a `string` or `URL`");
731
+ }
732
+ //#endregion
733
+ export { b as a, re as c, ie as i, oe as n, te as o, ae as r, v as s, Ke as t };