@incajs/cli 0.0.10 → 0.0.12

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.
@@ -1,1262 +0,0 @@
1
- import e, { isAbsolute as t, resolve as n } from "node:path";
2
- import r, { existsSync as i, lstatSync as a, readFileSync as o, realpathSync as s, statSync as c } from "node:fs";
3
- import { readFile as l, rm as u } from "node:fs/promises";
4
- import * as d from "node:util";
5
- import { format as f, inspect as p } from "node:util";
6
- import { URL as m, fileURLToPath as h, pathToFileURL as g } from "node:url";
7
- import { homedir as _ } from "node:os";
8
- import v from "node:assert";
9
- import y from "node:process";
10
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
11
- var ee = /^[A-Za-z]:\//;
12
- function b(e = "") {
13
- return e && e.replace(/\\/g, "/").replace(ee, (e) => e.toUpperCase());
14
- }
15
- var te = /^[/\\]{2}/, ne = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, re = /^[A-Za-z]:$/, ie = /.(\.[^./]+|\.)$/, x = function(e) {
16
- if (e.length === 0) return ".";
17
- e = b(e);
18
- let t = e.match(te), n = w(e), r = e[e.length - 1] === "/";
19
- return e = oe(e, !n), e.length === 0 ? n ? "/" : r ? "./" : "." : (r && (e += "/"), re.test(e) && (e += "/"), t ? n ? `//${e}` : `//./${e}` : n && !w(e) ? `/${e}` : e);
20
- }, S = function(...e) {
21
- let t = "";
22
- for (let n of e) if (n) {
23
- if (t.length > 0) {
24
- let e = t[t.length - 1] === "/", r = n[0] === "/";
25
- t += e && r ? n.slice(1) : e || r ? n : `/${n}`;
26
- } else t += n;
27
- }
28
- return x(t);
29
- };
30
- function ae() {
31
- return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
32
- }
33
- var C = function(...e) {
34
- e = e.map((e) => b(e));
35
- let t = "", n = !1;
36
- for (let r = e.length - 1; r >= -1 && !n; r--) {
37
- let i = r >= 0 ? e[r] : ae();
38
- i && i.length !== 0 && (t = `${i}/${t}`, n = w(i));
39
- }
40
- return t = oe(t, !n), n && !w(t) ? `/${t}` : t.length > 0 ? t : ".";
41
- };
42
- function oe(e, t) {
43
- let n = "", r = 0, i = -1, a = 0, o = null;
44
- for (let s = 0; s <= e.length; ++s) {
45
- if (s < e.length) o = e[s];
46
- else if (o === "/") break;
47
- else o = "/";
48
- if (o === "/") {
49
- if (i !== s - 1 && a !== 1) {
50
- if (a === 2) {
51
- if (n.length < 2 || r !== 2 || n[n.length - 1] !== "." || n[n.length - 2] !== ".") {
52
- if (n.length > 2) {
53
- let e = n.lastIndexOf("/");
54
- e === -1 ? (n = "", r = 0) : (n = n.slice(0, e), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
55
- continue;
56
- }
57
- if (n.length > 0) {
58
- n = "", r = 0, i = s, a = 0;
59
- continue;
60
- }
61
- }
62
- t && (n += n.length > 0 ? "/.." : "..", r = 2);
63
- } else n.length > 0 ? n += `/${e.slice(i + 1, s)}` : n = e.slice(i + 1, s), r = s - i - 1;
64
- }
65
- i = s, a = 0;
66
- } else o === "." && a !== -1 ? ++a : a = -1;
67
- }
68
- return n;
69
- }
70
- var w = function(e) {
71
- return ne.test(e);
72
- }, se = function(e) {
73
- if (e === "..") return "";
74
- let t = ie.exec(b(e));
75
- return t && t[1] || "";
76
- }, T = function(e) {
77
- let t = b(e).replace(/\/$/, "").split("/").slice(0, -1);
78
- return t.length === 1 && re.test(t[0]) && (t[0] += "/"), t.join("/") || (w(e) ? "/" : ".");
79
- }, ce = function(e, t) {
80
- let n = b(e).split("/"), r = "";
81
- for (let e = n.length - 1; e >= 0; e--) {
82
- let t = n[e];
83
- if (t) {
84
- r = t;
85
- break;
86
- }
87
- }
88
- return t && r.endsWith(t) ? r.slice(0, -t.length) : r;
89
- }, E = /* @__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("."), le = /^([A-Z][a-z\d]*)+$/, ue = /* @__PURE__ */ new Set([
90
- "string",
91
- "function",
92
- "number",
93
- "object",
94
- "Function",
95
- "Object",
96
- "boolean",
97
- "bigint",
98
- "symbol"
99
- ]), D = /* @__PURE__ */ new Map();
100
- function O(e, t = "and") {
101
- switch (e.length) {
102
- case 0: return "";
103
- case 1: return `${e[0]}`;
104
- case 2: return `${e[0]} ${t} ${e[1]}`;
105
- case 3: return `${e[0]}, ${e[1]}, ${t} ${e[2]}`;
106
- default: return `${e.slice(0, -1).join(", ")}, ${t} ${e.at(-1)}`;
107
- }
108
- }
109
- function k(e) {
110
- let t = 0, n = /%[dfijoOs]/g;
111
- for (; n.exec(e) !== null;) t++;
112
- return t;
113
- }
114
- function A(e, t, n) {
115
- return D.set(e, t), de(n, e);
116
- }
117
- var j = Symbol("kIsNodeError");
118
- function de(e, t) {
119
- let n = D.get(t), r = typeof n == "string" ? k(n) : -1;
120
- switch (r) {
121
- case 0: {
122
- class i extends e {
123
- code = t;
124
- constructor(...e) {
125
- v.ok(e.length === 0, `Code: ${t}; The provided arguments length (${e.length}) does not match the required ones (${r}).`), super(n);
126
- }
127
- get ["constructor"]() {
128
- return e;
129
- }
130
- get [j]() {
131
- return !0;
132
- }
133
- toString() {
134
- return `${this.name} [${t}]: ${this.message}`;
135
- }
136
- }
137
- return i;
138
- }
139
- case -1: {
140
- class n extends e {
141
- code = t;
142
- constructor(...e) {
143
- super(), Object.defineProperty(this, "message", {
144
- value: fe(t, e, this),
145
- enumerable: !1,
146
- writable: !0,
147
- configurable: !0
148
- });
149
- }
150
- get ["constructor"]() {
151
- return e;
152
- }
153
- get [j]() {
154
- return !0;
155
- }
156
- toString() {
157
- return `${this.name} [${t}]: ${this.message}`;
158
- }
159
- }
160
- return n;
161
- }
162
- default: {
163
- class i extends e {
164
- code = t;
165
- constructor(...e) {
166
- v.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(f, null, e));
167
- }
168
- get ["constructor"]() {
169
- return e;
170
- }
171
- get [j]() {
172
- return !0;
173
- }
174
- toString() {
175
- return `${this.name} [${t}]: ${this.message}`;
176
- }
177
- }
178
- return i;
179
- }
180
- }
181
- }
182
- function fe(e, t, n) {
183
- let r = D.get(e);
184
- if (v.ok(r !== void 0, "expected `message` to be found"), typeof r == "function") return v.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);
185
- let i = k(r);
186
- return v.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(f, null, t));
187
- }
188
- function pe(e) {
189
- if (e === null) return "null";
190
- if (e === void 0) return "undefined";
191
- let t = typeof e;
192
- switch (t) {
193
- case "bigint": return `type bigint (${e}n)`;
194
- 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})`;
195
- case "boolean": return e ? "type boolean (true)" : "type boolean (false)";
196
- case "symbol": return `type symbol (${String(e)})`;
197
- case "function": return `function ${e.name}`;
198
- case "object": return e.constructor && e.constructor.name ? `an instance of ${e.constructor.name}` : `${p(e, { depth: -1 })}`;
199
- case "string": {
200
- let t = e;
201
- return t.length > 28 && (t = `${t.slice(0, 25)}...`), t.includes("'") ? `type string (${JSON.stringify(t)})` : `type string ('${t}')`;
202
- }
203
- default: {
204
- let n = p(e, { colors: !1 });
205
- return n.length > 28 && (n = `${n.slice(0, 25)}...`), `type ${t} (${n})`;
206
- }
207
- }
208
- }
209
- A("ERR_INVALID_ARG_TYPE", (e, t, n) => {
210
- v.ok(typeof e == "string", "'name' must be a string"), Array.isArray(t) || (t = [t]);
211
- let r = "The ";
212
- if (e.endsWith(" argument")) r += `${e} `;
213
- else {
214
- let t = e.includes(".") ? "property" : "argument";
215
- r += `"${e}" ${t} `;
216
- }
217
- r += "must be ";
218
- let i = [], a = [], o = [];
219
- for (let e of t) v.ok(typeof e == "string", "All expected entries have to be of type string"), ue.has(e) ? i.push(e.toLowerCase()) : le.exec(e) === null ? (v.ok(e !== "object", "The value \"object\" should be written as \"Object\""), o.push(e)) : a.push(e);
220
- if (a.length > 0) {
221
- let e = i.indexOf("object");
222
- e !== -1 && (i.splice(e, 1), a.push("Object"));
223
- }
224
- return i.length > 0 && (r += `${i.length > 1 ? "one of type" : "of type"} ${O(i, "or")}`, (a.length > 0 || o.length > 0) && (r += " or ")), a.length > 0 && (r += `an instance of ${O(a, "or")}`, o.length > 0 && (r += " or ")), o.length > 0 && (o.length > 1 ? r += `one of ${O(o, "or")}` : (o[0]?.toLowerCase() !== o[0] && (r += "an "), r += `${o[0]}`)), r += `. Received ${pe(n)}`, r;
225
- }, TypeError);
226
- var M = A("ERR_INVALID_MODULE_SPECIFIER", (e, t, n) => `Invalid module "${e}" ${t}${n ? ` imported from ${n}` : ""}`, TypeError), N = A("ERR_INVALID_PACKAGE_CONFIG", (e, t, n) => `Invalid package config ${e}${t ? ` while importing ${t}` : ""}${n ? `. ${n}` : ""}`, Error), me = A("ERR_INVALID_PACKAGE_TARGET", (e, t, n, r = !1, i) => {
227
- let a = typeof n == "string" && !r && n.length > 0 && !n.startsWith("./");
228
- return t === "." ? (v.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 \"./\"" : ""}`;
229
- }, Error), P = A("ERR_MODULE_NOT_FOUND", function(e, t, n = !1) {
230
- return n && typeof n == "string" && (this.url = `${n}`), `Cannot find ${n ? "module" : "package"} '${e}' imported from ${t}`;
231
- }, Error), he = A("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), ge = A("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), _e = A("ERR_UNSUPPORTED_DIR_IMPORT", function(e, t, n = void 0) {
232
- return this.url = n, `Directory import '${e}' is not supported resolving ES modules imported from ${t}`;
233
- }, Error), ve = A("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError), ye = A("ERR_UNKNOWN_FILE_EXTENSION", (e, t) => `Unknown file extension "${e}" for ${t}`, TypeError);
234
- A("ERR_INVALID_ARG_VALUE", (e, t, n = "is invalid") => {
235
- let r = p(t);
236
- return r.length > 128 && (r = `${r.slice(0, 128)}...`), `The ${e.includes(".") ? "property" : "argument"} '${e}' ${n}. Received ${r}`;
237
- }, TypeError);
238
- var F = {}.hasOwnProperty, be = /* @__PURE__ */ new Map();
239
- function xe(t, { base: n, specifier: i }) {
240
- let a = be.get(t);
241
- if (a) return a;
242
- let o;
243
- try {
244
- o = r.readFileSync(e.toNamespacedPath(t), "utf8");
245
- } catch (e) {
246
- let t = e;
247
- if (t.code !== "ENOENT") throw t;
248
- }
249
- let s = {
250
- exists: !1,
251
- pjsonPath: t,
252
- main: void 0,
253
- name: void 0,
254
- type: "none",
255
- exports: void 0,
256
- imports: void 0
257
- };
258
- if (o !== void 0) {
259
- let e;
260
- try {
261
- e = JSON.parse(o);
262
- } catch (e) {
263
- let r = new N(t, (n ? `"${i}" from ` : "") + h(n || i), e.message);
264
- throw r.cause = e, r;
265
- }
266
- s.exists = !0, F.call(e, "name") && typeof e.name == "string" && (s.name = e.name), F.call(e, "main") && typeof e.main == "string" && (s.main = e.main), F.call(e, "exports") && (s.exports = e.exports), F.call(e, "imports") && (s.imports = e.imports), F.call(e, "type") && (e.type === "commonjs" || e.type === "module") && (s.type = e.type);
267
- }
268
- return be.set(t, s), s;
269
- }
270
- function I(e) {
271
- let t = new URL("package.json", e);
272
- for (; !t.pathname.endsWith("node_modules/package.json");) {
273
- let n = xe(h(t), { specifier: e });
274
- if (n.exists) return n;
275
- let r = t;
276
- if (t = new URL("../package.json", t), t.pathname === r.pathname) break;
277
- }
278
- return {
279
- pjsonPath: h(t),
280
- exists: !1,
281
- type: "none"
282
- };
283
- }
284
- var Se = {}.hasOwnProperty, Ce = {
285
- __proto__: null,
286
- ".json": "json",
287
- ".cjs": "commonjs",
288
- ".cts": "commonjs",
289
- ".js": "module",
290
- ".ts": "module",
291
- ".mts": "module",
292
- ".mjs": "module"
293
- }, we = {
294
- __proto__: null,
295
- "data:": Ee,
296
- "file:": Ae,
297
- "node:": () => "builtin"
298
- };
299
- function Te(e) {
300
- return e && /^\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?$/i.test(e) ? "module" : e === "application/json" ? "json" : null;
301
- }
302
- function Ee(e) {
303
- let { 1: t } = /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/.exec(e.pathname) || [
304
- null,
305
- null,
306
- null
307
- ];
308
- return Te(t);
309
- }
310
- var De = 46, Oe = 47;
311
- function ke(e) {
312
- let t = e.pathname;
313
- for (let e = t.length - 1; e > 0; e--) switch (t.charCodeAt(e)) {
314
- case Oe: return "";
315
- case De: return t.charCodeAt(e - 1) === Oe ? "" : t.slice(e);
316
- }
317
- return "";
318
- }
319
- function Ae(e, t, n) {
320
- let r = ke(e);
321
- if (r === ".js") {
322
- let { type: t } = I(e);
323
- return t === "none" ? "commonjs" : t;
324
- }
325
- if (r === "") {
326
- let { type: t } = I(e);
327
- return t === "module" ? "module" : t === "none" ? "commonjs" : t;
328
- }
329
- let i = Ce[r];
330
- if (i) return i;
331
- if (!n) throw new ye(r, h(e));
332
- }
333
- function je(e, t) {
334
- let n = e.protocol;
335
- return Se.call(we, n) && we[n](e, t, !0) || null;
336
- }
337
- var L = RegExp.prototype[Symbol.replace], Me = {}.hasOwnProperty, Ne = /(^|\\|\/)((\.|%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, Pe = /(^|\\|\/)((\.|%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, Fe = /^\.|%|\\/, R = /\*/g, Ie = /%2f|%5c/i, Le = /* @__PURE__ */ new Set(), Re = /[/\\]{2}/;
338
- function z(e, t, n, r, i, a, o) {
339
- if (y.noDeprecation) return;
340
- let s = h(r), c = Re.exec(o ? e : t) !== null;
341
- y.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 ${h(a)}` : ""}.`, "DeprecationWarning", "DEP0166");
342
- }
343
- function B(t, n, r, i) {
344
- if (y.noDeprecation || je(t, { parentURL: r.href }) !== "module") return;
345
- let a = h(t.href), o = h(new m(".", n)), s = h(r);
346
- i ? e.resolve(o, i) !== a && y.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") : y.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");
347
- }
348
- function V(e) {
349
- try {
350
- return c(e);
351
- } catch {}
352
- }
353
- function H(e) {
354
- let t = c(e, { throwIfNoEntry: !1 });
355
- return (t ? t.isFile() : void 0) ?? !1;
356
- }
357
- function ze(e, t, n) {
358
- let r;
359
- if (t.main !== void 0) {
360
- if (r = new m(t.main, e), H(r)) return r;
361
- let i = [
362
- `./${t.main}.js`,
363
- `./${t.main}.json`,
364
- `./${t.main}.node`,
365
- `./${t.main}/index.js`,
366
- `./${t.main}/index.json`,
367
- `./${t.main}/index.node`
368
- ], a = -1;
369
- for (; ++a < i.length && (r = new m(i[a], e), !H(r));) r = void 0;
370
- if (r) return B(r, e, n, t.main), r;
371
- }
372
- let i = [
373
- "./index.js",
374
- "./index.json",
375
- "./index.node"
376
- ], a = -1;
377
- for (; ++a < i.length && (r = new m(i[a], e), !H(r));) r = void 0;
378
- if (r) return B(r, e, n, t.main), r;
379
- throw new P(h(new m(".", e)), h(n));
380
- }
381
- function Be(t, n, r) {
382
- if (Ie.exec(t.pathname) !== null) throw new M(t.pathname, String.raw`must not include encoded "/" or "\" characters`, h(n));
383
- let i;
384
- try {
385
- i = h(t);
386
- } catch (e) {
387
- throw Object.defineProperty(e, "input", { value: String(t) }), Object.defineProperty(e, "module", { value: String(n) }), e;
388
- }
389
- let a = V(i.endsWith("/") ? i.slice(-1) : i);
390
- if (a && a.isDirectory()) {
391
- let e = new _e(i, h(n));
392
- throw e.url = String(t), e;
393
- }
394
- if (!a || !a.isFile()) {
395
- let e = new P(i || t.pathname, n && h(n), !0);
396
- throw e.url = String(t), e;
397
- }
398
- if (!r) {
399
- let n = s(i), { search: r, hash: a } = t;
400
- t = g(n + (i.endsWith(e.sep) ? "/" : "")), t.search = r, t.hash = a;
401
- }
402
- return t;
403
- }
404
- function Ve(e, t, n) {
405
- return new he(e, t && h(new m(".", t)), h(n));
406
- }
407
- function U(e, t, n) {
408
- return new ge(h(new m(".", t)), e, n && h(n));
409
- }
410
- function He(e, t, n, r, i) {
411
- throw new M(e, `request is not a valid match in pattern "${t}" for the "${r ? "imports" : "exports"}" resolution of ${h(n)}`, i && h(i));
412
- }
413
- function W(e, t, n, r, i) {
414
- return t = typeof t == "object" && t ? JSON.stringify(t, null, "") : `${t}`, new me(h(new m(".", n)), e, t, r, i && h(i));
415
- }
416
- function Ue(e, t, n, r, i, a, o, s, c) {
417
- if (t !== "" && !a && e.at(-1) !== "/") throw W(n, e, r, o, i);
418
- if (!e.startsWith("./")) {
419
- if (o && !e.startsWith("../") && !e.startsWith("/")) {
420
- let n = !1;
421
- try {
422
- new m(e), n = !0;
423
- } catch {}
424
- if (!n) return Ze(a ? L.call(R, e, () => t) : e + t, r, c);
425
- }
426
- throw W(n, e, r, o, i);
427
- }
428
- if (Ne.exec(e.slice(2)) !== null) {
429
- if (Pe.exec(e.slice(2)) === null) {
430
- if (!s) {
431
- let s = a ? n.replace("*", () => t) : n + t;
432
- z(a ? L.call(R, e, () => t) : e, s, n, r, o, i, !0);
433
- }
434
- } else throw W(n, e, r, o, i);
435
- }
436
- let l = new m(e, r), u = l.pathname, d = new m(".", r).pathname;
437
- if (!u.startsWith(d)) throw W(n, e, r, o, i);
438
- if (t === "") return l;
439
- if (Ne.exec(t) !== null) {
440
- let c = a ? n.replace("*", () => t) : n + t;
441
- Pe.exec(t) === null ? s || z(a ? L.call(R, e, () => t) : e, c, n, r, o, i, !1) : He(c, n, r, o, i);
442
- }
443
- return a ? new m(L.call(R, l.href, () => t)) : new m(t, l);
444
- }
445
- function We(e) {
446
- let t = Number(e);
447
- return `${t}` === e && t >= 0 && t < 4294967295;
448
- }
449
- function G(e, t, n, r, i, a, o, s, c) {
450
- if (typeof t == "string") return Ue(t, n, r, e, i, a, o, s, c);
451
- if (Array.isArray(t)) {
452
- let l = t;
453
- if (l.length === 0) return null;
454
- let u, d = -1;
455
- for (; ++d < l.length;) {
456
- let t = l[d], f;
457
- try {
458
- f = G(e, t, n, r, i, a, o, s, c);
459
- } catch (e) {
460
- let t = e;
461
- if (u = t, t.code === "ERR_INVALID_PACKAGE_TARGET") continue;
462
- throw e;
463
- }
464
- if (f !== void 0) {
465
- if (f === null) {
466
- u = null;
467
- continue;
468
- }
469
- return f;
470
- }
471
- }
472
- if (u == null) return u;
473
- throw u;
474
- }
475
- if (typeof t == "object" && t) {
476
- let l = Object.getOwnPropertyNames(t), u = -1;
477
- for (; ++u < l.length;) {
478
- let t = l[u];
479
- if (We(t)) throw new N(h(e), h(i), "\"exports\" cannot contain numeric property keys.");
480
- }
481
- for (u = -1; ++u < l.length;) {
482
- let d = l[u];
483
- if (d === "default" || c && c.has(d)) {
484
- let l = t[d], u = G(e, l, n, r, i, a, o, s, c);
485
- if (u === void 0) continue;
486
- return u;
487
- }
488
- }
489
- return;
490
- }
491
- if (t === null) return null;
492
- throw W(r, t, e, o, i);
493
- }
494
- function Ge(e, t, n) {
495
- if (typeof e == "string" || Array.isArray(e)) return !0;
496
- if (typeof e != "object" || !e) return !1;
497
- let r = Object.getOwnPropertyNames(e), i = !1, a = 0, o = -1;
498
- for (; ++o < r.length;) {
499
- let e = r[o], s = e === "" || e[0] !== ".";
500
- if (a++ === 0) i = s;
501
- else if (i !== s) throw new N(h(t), h(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.");
502
- }
503
- return i;
504
- }
505
- function Ke(e, t, n) {
506
- if (y.noDeprecation) return;
507
- let r = h(t);
508
- Le.has(r + "|" + e) || (Le.add(r + "|" + e), y.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n ? ` imported from ${h(n)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155"));
509
- }
510
- function qe(e, t, n, r, i) {
511
- let a = n.exports;
512
- if (Ge(a, e, r) && (a = { ".": a }), Me.call(a, t) && !t.includes("*") && !t.endsWith("/")) {
513
- let n = a[t], o = G(e, n, "", t, r, !1, !1, !1, i);
514
- if (o == null) throw U(t, e, r);
515
- return o;
516
- }
517
- let o = "", s = "", c = Object.getOwnPropertyNames(a), l = -1;
518
- for (; ++l < c.length;) {
519
- let n = c[l], i = n.indexOf("*");
520
- if (i !== -1 && t.startsWith(n.slice(0, i))) {
521
- t.endsWith("/") && Ke(t, e, r);
522
- let a = n.slice(i + 1);
523
- t.length >= n.length && t.endsWith(a) && Je(o, n) === 1 && n.lastIndexOf("*") === i && (o = n, s = t.slice(i, t.length - a.length));
524
- }
525
- }
526
- if (o) {
527
- let n = a[o], c = G(e, n, s, o, r, !0, !1, t.endsWith("/"), i);
528
- if (c == null) throw U(t, e, r);
529
- return c;
530
- }
531
- throw U(t, e, r);
532
- }
533
- function Je(e, t) {
534
- let n = e.indexOf("*"), r = t.indexOf("*"), i = n === -1 ? e.length : n + 1, a = r === -1 ? t.length : r + 1;
535
- return i > a ? -1 : a > i || n === -1 ? 1 : r === -1 || e.length > t.length ? -1 : +(t.length > e.length);
536
- }
537
- function Ye(e, t, n) {
538
- if (e === "#" || e.endsWith("/")) throw new M(e, "is not a valid internal imports specifier name", h(t));
539
- let r, i = I(t);
540
- if (i.exists) {
541
- r = g(i.pjsonPath);
542
- let a = i.imports;
543
- if (a) {
544
- if (Me.call(a, e) && !e.includes("*")) {
545
- let i = G(r, a[e], "", e, t, !1, !0, !1, n);
546
- if (i != null) return i;
547
- } else {
548
- let i = "", o = "", s = Object.getOwnPropertyNames(a), c = -1;
549
- for (; ++c < s.length;) {
550
- let t = s[c], n = t.indexOf("*");
551
- if (n !== -1 && e.startsWith(t.slice(0, n))) {
552
- let r = t.slice(n + 1);
553
- e.length >= t.length && e.endsWith(r) && Je(i, t) === 1 && t.lastIndexOf("*") === n && (i = t, o = e.slice(n, e.length - r.length));
554
- }
555
- }
556
- if (i) {
557
- let e = a[i], s = G(r, e, o, i, t, !0, !0, !1, n);
558
- if (s != null) return s;
559
- }
560
- }
561
- }
562
- }
563
- throw Ve(e, r, t);
564
- }
565
- function Xe(e, t) {
566
- let n = e.indexOf("/"), r = !0, i = !1;
567
- e[0] === "@" && (i = !0, n === -1 || e.length === 0 ? r = !1 : n = e.indexOf("/", n + 1));
568
- let a = n === -1 ? e : e.slice(0, n);
569
- if (Fe.exec(a) !== null && (r = !1), !r) throw new M(e, "is not a valid package name", h(t));
570
- return {
571
- packageName: a,
572
- packageSubpath: "." + (n === -1 ? "" : e.slice(n)),
573
- isScoped: i
574
- };
575
- }
576
- function Ze(e, t, n) {
577
- if (E.includes(e)) return new m("node:" + e);
578
- let { packageName: r, packageSubpath: i, isScoped: a } = Xe(e, t), o = I(t);
579
- if (o.exists && o.name === r && o.exports !== void 0 && o.exports !== null) return qe(g(o.pjsonPath), i, o, t, n);
580
- let s = new m("./node_modules/" + r + "/package.json", t), c = h(s), l;
581
- do {
582
- let o = V(c.slice(0, -13));
583
- if (!o || !o.isDirectory()) {
584
- l = c, s = new m((a ? "../../../../node_modules/" : "../../../node_modules/") + r + "/package.json", s), c = h(s);
585
- continue;
586
- }
587
- let u = xe(c, {
588
- base: t,
589
- specifier: e
590
- });
591
- return u.exports !== void 0 && u.exports !== null ? qe(s, i, u, t, n) : i === "." ? ze(s, u, t) : new m(i, s);
592
- } while (c.length !== l.length);
593
- throw new P(r, h(t), !1);
594
- }
595
- function Qe(e) {
596
- return !(e[0] !== "." || e.length !== 1 && e[1] !== "/" && (e[1] !== "." || e.length !== 2 && e[2] !== "/"));
597
- }
598
- function $e(e) {
599
- return e === "" ? !1 : e[0] === "/" || Qe(e);
600
- }
601
- function et(e, t, n, r) {
602
- let i = t.protocol, a = i === "data:", o;
603
- if ($e(e)) try {
604
- o = new m(e, t);
605
- } catch (n) {
606
- let r = new ve(e, t);
607
- throw r.cause = n, r;
608
- }
609
- else if (i === "file:" && e[0] === "#") o = Ye(e, t, n);
610
- else try {
611
- o = new m(e);
612
- } catch (r) {
613
- if (a && !E.includes(e)) {
614
- let n = new ve(e, t);
615
- throw n.cause = r, n;
616
- }
617
- o = Ze(e, t, n);
618
- }
619
- return v.ok(o !== void 0, "expected to be defined"), o.protocol === "file:" ? Be(o, t, r) : o;
620
- }
621
- var tt = /* #__PURE__ */ new Set(["node", "import"]), nt = "2:6:import4:node", rt = process.platform === "win32", it = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
622
- function at(e, t) {
623
- let n = gt(e);
624
- if ("external" in n) return n.external;
625
- let r = n.specifier, i = n.url, o = n.absolutePath, c, l;
626
- if (t?.cache !== !1 && (c = dt(o || r, t), l = t?.cache && typeof t?.cache == "object" ? t.cache : it), l) {
627
- let e = l.get(c);
628
- if (typeof e == "string") return e;
629
- if (e instanceof Error) {
630
- if (t?.try) return;
631
- throw e;
632
- }
633
- }
634
- if (o) try {
635
- let e = a(o);
636
- if (e.isSymbolicLink() && (o = s(o), i = g(o)), e.isFile()) return l && l.set(c, i.href), i.href;
637
- } catch (e) {
638
- if (e?.code !== "ENOENT") throw l && l.set(c, e), e;
639
- }
640
- let u = t?.conditions ? new Set(t.conditions) : tt, d = r || i.href, f = ct(t?.from), p = t?.suffixes || [""], m = t?.extensions ? ["", ...t.extensions] : [""], h;
641
- for (let e of f) {
642
- for (let t of p) {
643
- let n = pt(d, t);
644
- n === "." && (n += "/.");
645
- for (let t of m) if (h = st(n + t, e, u), h) break;
646
- if (h) break;
647
- }
648
- if (h) break;
649
- }
650
- if (!h) {
651
- let n = /* @__PURE__ */ Error(`Cannot resolve module "${e}" (from: ${f.map((e) => ut(e)).join(", ")})`);
652
- if (n.code = "ERR_MODULE_NOT_FOUND", l && l.set(c, n), t?.try) return;
653
- throw n;
654
- }
655
- return l && l.set(c, h.href), h.href;
656
- }
657
- function ot(e, t) {
658
- let n = at(e, t);
659
- if (!n || !n.startsWith("file://") && t?.try) return;
660
- let r = h(n);
661
- return rt ? mt(r) : r;
662
- }
663
- function st(e, t, n) {
664
- try {
665
- return et(e, t, n);
666
- } catch {}
667
- }
668
- function ct(e) {
669
- let t = (Array.isArray(e) ? e : [e]).flatMap((e) => lt(e));
670
- return t.length === 0 ? [g("./")] : t;
671
- }
672
- function lt(e) {
673
- if (!e) return [];
674
- if (ht(e)) return [e];
675
- if (typeof e != "string") return [];
676
- if (/^(?:node|data|http|https|file):/.test(e)) return new URL(e);
677
- try {
678
- return e.endsWith("/") || c(e).isDirectory() ? g(e + "/") : g(e);
679
- } catch {
680
- return [g(e + "/"), g(e)];
681
- }
682
- }
683
- function ut(e) {
684
- try {
685
- return h(e);
686
- } catch {
687
- return e;
688
- }
689
- }
690
- function dt(e, t) {
691
- let n;
692
- return Array.isArray(t?.from) ? n = t.from : t?.from && (n = [t.from]), K([e]) + ft(t?.conditions) + K(t?.extensions) + K(n) + K(t?.suffixes);
693
- }
694
- function ft(e) {
695
- return e ? K([...new Set(e)].sort()) : nt;
696
- }
697
- function K(e) {
698
- if (!e) return "-";
699
- let t = `${e.length}:`;
700
- for (let n of e) {
701
- let e = String(n);
702
- t += `${e.length}:${e}`;
703
- }
704
- return t;
705
- }
706
- function pt(e, t) {
707
- return !e || !t || t === "/" ? e : (e.endsWith("/") ? e : e + "/") + (t.startsWith("/") ? t.slice(1) : t);
708
- }
709
- function mt(e) {
710
- return e.replace(/\\/g, "/").replace(/^[a-z]:\//, (e) => e.toUpperCase());
711
- }
712
- function ht(e) {
713
- return e instanceof URL || e?.constructor?.name === "URL";
714
- }
715
- function gt(e) {
716
- if (typeof e == "string") {
717
- if (e.startsWith("file:")) {
718
- let t = new URL(e);
719
- return {
720
- url: t,
721
- absolutePath: h(t)
722
- };
723
- }
724
- return t(e) ? {
725
- url: g(e),
726
- absolutePath: e
727
- } : /^(?:node|data|http|https):/.test(e) ? { external: e } : E.includes(e) && !e.includes(":") ? { external: `node:${e}` } : { specifier: e };
728
- }
729
- if (ht(e)) return e.protocol === "file:" ? {
730
- url: e,
731
- absolutePath: h(e)
732
- } : { external: e.href };
733
- throw TypeError("id must be a `string` or `URL`");
734
- }
735
- //#endregion
736
- //#region ../../node_modules/.pnpm/rc9@3.1.0/node_modules/rc9/dist/_chunks/libs/flat.mjs
737
- function _t(e) {
738
- return e && e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
739
- }
740
- function vt(e) {
741
- return e;
742
- }
743
- function yt(e, t) {
744
- t ||= {};
745
- let n = t.delimiter || ".", r = t.maxDepth, i = t.transformKey || vt, a = {};
746
- function o(e, s, c) {
747
- c ||= 1, Object.keys(e).forEach(function(l) {
748
- let u = e[l], d = t.safe && Array.isArray(u), f = Object.prototype.toString.call(u), p = _t(u), m = f === "[object Object]" || f === "[object Array]", h = s ? s + n + i(l) : i(l);
749
- if (!d && !p && m && Object.keys(u).length && (!t.maxDepth || c < r)) return o(u, h, c + 1);
750
- a[h] = u;
751
- });
752
- }
753
- return o(e), a;
754
- }
755
- function bt(e, t) {
756
- t ||= {};
757
- let n = t.delimiter || ".", r = t.overwrite || !1, i = t.transformKey || vt, a = {};
758
- if (_t(e) || Object.prototype.toString.call(e) !== "[object Object]") return e;
759
- function o(e) {
760
- let n = Number(e);
761
- return isNaN(n) || e.indexOf(".") !== -1 || t.object ? e : n;
762
- }
763
- function s(e, t, r) {
764
- return Object.keys(r).reduce(function(t, i) {
765
- return t[e + n + i] = r[i], t;
766
- }, t);
767
- }
768
- function c(e) {
769
- let t = Object.prototype.toString.call(e), n = t === "[object Array]", r = t === "[object Object]";
770
- if (!e) return !0;
771
- if (n) return !e.length;
772
- if (r) return !Object.keys(e).length;
773
- }
774
- return e = Object.keys(e).reduce(function(n, r) {
775
- let i = Object.prototype.toString.call(e[r]);
776
- return i !== "[object Object]" && i !== "[object Array]" || c(e[r]) ? (n[r] = e[r], n) : s(r, n, yt(e[r], t));
777
- }, {}), Object.keys(e).forEach(function(s) {
778
- let c = s.split(n).map(i), l = o(c.shift()), u = o(c[0]), d = a;
779
- for (; u !== void 0;) {
780
- if (l === "__proto__") return;
781
- let e = Object.prototype.toString.call(d[l]), n = e === "[object Object]" || e === "[object Array]";
782
- if (!r && !n && d[l] !== void 0) return;
783
- (r && !n || !r && d[l] == null) && (d[l] = typeof u == "number" && !t.object ? [] : {}), d = d[l], c.length > 0 && (l = o(c.shift()), u = o(c[0]));
784
- }
785
- d[l] = bt(e[s], t);
786
- }), a;
787
- }
788
- //#endregion
789
- //#region ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
790
- var xt = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, St = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Ct = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
791
- function wt(e, t) {
792
- if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) {
793
- Tt(e);
794
- return;
795
- }
796
- return t;
797
- }
798
- function Tt(e) {
799
- console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);
800
- }
801
- function Et(e, t = {}) {
802
- if (typeof e != "string") return e;
803
- if (e[0] === "\"" && e[e.length - 1] === "\"" && e.indexOf("\\") === -1) return e.slice(1, -1);
804
- let n = e.trim();
805
- if (n.length <= 9) switch (n.toLowerCase()) {
806
- case "true": return !0;
807
- case "false": return !1;
808
- case "undefined": return;
809
- case "null": return null;
810
- case "nan": return NaN;
811
- case "infinity": return Infinity;
812
- case "-infinity": return -Infinity;
813
- }
814
- if (!Ct.test(e)) {
815
- if (t.strict) throw SyntaxError("[destr] Invalid JSON");
816
- return e;
817
- }
818
- try {
819
- if (xt.test(e) || St.test(e)) {
820
- if (t.strict) throw Error("[destr] Possible prototype pollution");
821
- return JSON.parse(e, wt);
822
- }
823
- return JSON.parse(e);
824
- } catch (n) {
825
- if (t.strict) throw n;
826
- return e;
827
- }
828
- }
829
- //#endregion
830
- //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
831
- function q(e) {
832
- if (typeof e != "object" || !e) return !1;
833
- let t = Object.getPrototypeOf(e);
834
- return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
835
- }
836
- function J(e, t, n = ".", r) {
837
- if (!q(t)) return J(e, {}, n, r);
838
- let i = { ...t };
839
- for (let t of Object.keys(e)) {
840
- if (t === "__proto__" || t === "constructor") continue;
841
- let a = e[t];
842
- a != null && (r && r(i, t, a, n) || (i[t] = Array.isArray(a) && Array.isArray(i[t]) ? [...a, ...i[t]] : q(a) && q(i[t]) ? J(a, i[t], (n ? `${n}.` : "") + t.toString(), r) : a));
843
- }
844
- return i;
845
- }
846
- function Dt(e) {
847
- return (...t) => t.reduce((t, n) => J(t, n, "", e), {});
848
- }
849
- var Y = Dt(), Ot = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/, kt = /\n|\r|\r\n/, At = {
850
- name: ".conf",
851
- dir: process.cwd(),
852
- flat: !1
853
- };
854
- function jt(e) {
855
- return typeof e == "string" && (e = { name: e }), {
856
- ...At,
857
- ...e
858
- };
859
- }
860
- function Mt(e, t = {}) {
861
- let n = {}, r = e.split(kt);
862
- for (let e of r) {
863
- let t = e.match(Ot);
864
- if (!t) continue;
865
- let r = t[1];
866
- if (!r || r === "__proto__" || r === "constructor") continue;
867
- let i = Et((t[2] || "").trim());
868
- if (r.endsWith("[]")) {
869
- let e = r.slice(0, Math.max(0, r.length - 2));
870
- n[e] = (n[e] || []).concat(i);
871
- continue;
872
- }
873
- n[r] = i;
874
- }
875
- return t.flat ? n : bt(n, { overwrite: !0 });
876
- }
877
- function Nt(e, t) {
878
- return i(e) ? Mt(o(e, "utf8"), t) : {};
879
- }
880
- function X(e) {
881
- return e = jt(e), Nt(n(e.dir, e.name), e);
882
- }
883
- function Pt() {
884
- return process.env.XDG_CONFIG_HOME || n(_(), ".config");
885
- }
886
- function Ft(e) {
887
- return e = jt(e), e.dir = Pt(), X(e);
888
- }
889
- //#endregion
890
- //#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_magicast@0.5.4/node_modules/c12/dist/index.mjs
891
- async function It(e) {
892
- let t = e.env ?? process.env, n = await Lt({
893
- cwd: e.cwd,
894
- fileName: e.fileName ?? ".env",
895
- env: t,
896
- interpolate: e.interpolate ?? !0,
897
- expandFileReferences: e.expandFileReferences ?? !1,
898
- parse: e.parse
899
- }), r = Wt(t);
900
- for (let e in n) e.startsWith("_") || (t[e] === void 0 || r.has(e)) && (t[e] = n[e]);
901
- return n;
902
- }
903
- async function Lt(e) {
904
- let t = Object.create(null), n = C(e.cwd || "."), r = e.fileName || ".env", i = typeof r == "string" ? [r] : r, a = Wt(e.env || {});
905
- Object.assign(t, e.env);
906
- for (let r of i) {
907
- let i = C(n, r);
908
- if (!c(i, { throwIfNoEntry: !1 })?.isFile()) continue;
909
- let o = await Rt(i, e.parse);
910
- for (let e in o) e in t && !a.has(e) || (t[e] = o[e], a.add(e));
911
- }
912
- if (e.expandFileReferences) {
913
- for (let e in t) if (e.endsWith("_FILE")) {
914
- let n = e.slice(0, -5);
915
- if (t[n] === void 0) {
916
- let r = t[e];
917
- r && c(r, { throwIfNoEntry: !1 })?.isFile() && (t[n] = o(r, "utf8").trim(), a.add(n));
918
- }
919
- }
920
- }
921
- return e.interpolate && zt(t), t;
922
- }
923
- var Z = d.parseEnv;
924
- async function Rt(e, t) {
925
- let n = o(e, "utf8");
926
- if (t) return t(n);
927
- if (!Z) try {
928
- let e = await import("./__vite-optional-peer-dep_dotenv_c12-CxKvRg9-.js");
929
- Z = (t) => e.parse(t);
930
- } catch {
931
- throw Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime, install `dotenv` as a dependency or provide a custom `parse` option.");
932
- }
933
- return Z(n);
934
- }
935
- function zt(e, t = {}, n = (e) => e) {
936
- function r(n) {
937
- return t[n] === void 0 ? e[n] : t[n];
938
- }
939
- function i(e, t = []) {
940
- if (typeof e != "string") return e;
941
- let a = "", o = 0;
942
- for (; o < e.length;) {
943
- let n = e[o];
944
- if (n === "\\" && e[o + 1] === "$") {
945
- a += "$", o += 2;
946
- continue;
947
- }
948
- let s = n === "$" ? Ht(e, o) : void 0;
949
- if (!s) {
950
- a += n, o++;
951
- continue;
952
- }
953
- if (t.includes(s.key)) {
954
- if (s.defaultValue !== void 0) {
955
- a += i(s.defaultValue, t), o = s.end;
956
- continue;
957
- }
958
- return console.warn(`Please avoid recursive environment variables ( loop: ${t.join(" > ")} > ${s.key} )`), "";
959
- }
960
- let c = i(r(s.key), [...t, s.key]);
961
- s.defaultValue !== void 0 && (c === void 0 || s.operator === ":-" && c === "") && (c = i(s.defaultValue, t)), a += c === void 0 ? e.slice(o, s.end) : c, o = s.end;
962
- }
963
- return n(a);
964
- }
965
- for (let t in e) e[t] = i(r(t));
966
- }
967
- var Bt = /\w+/y, Vt = /[\w:]+/y;
968
- function Ht(e, t) {
969
- let n = t + 1, r = e[n] === "{";
970
- r && n++;
971
- let i = r ? Vt : Bt;
972
- i.lastIndex = n;
973
- let a = i.exec(e);
974
- if (!a) return;
975
- let o = a[0];
976
- if (n = i.lastIndex, !r) return {
977
- key: o,
978
- end: n
979
- };
980
- if (e[n] === "}") return {
981
- key: o,
982
- end: n + 1
983
- };
984
- if (e[n] === "-") {
985
- let t = "-";
986
- o.endsWith(":") && (o = o.slice(0, -1), t = ":-");
987
- let r = o ? Ut(e, n + 1) : void 0;
988
- return r ? {
989
- key: o,
990
- operator: t,
991
- defaultValue: r.value,
992
- end: r.end
993
- } : void 0;
994
- }
995
- return {
996
- key: o,
997
- end: n
998
- };
999
- }
1000
- function Ut(e, t) {
1001
- let n = "", r = 1;
1002
- for (let i = t; i < e.length; i++) {
1003
- let t = e[i];
1004
- if (t === "\\" && i + 1 < e.length) {
1005
- let r = e[i + 1];
1006
- n += r === "{" || r === "}" ? r : t + r, i++;
1007
- continue;
1008
- }
1009
- if (t === "$" && e[i + 1] === "{") {
1010
- r++, n += "${", i++;
1011
- continue;
1012
- }
1013
- if (t === "{" && r++, t === "}" && (r--, r === 0)) return {
1014
- value: n,
1015
- end: i + 1
1016
- };
1017
- n += t;
1018
- }
1019
- }
1020
- function Wt(e) {
1021
- let t = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();
1022
- return t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e);
1023
- }
1024
- var Q = (e) => e?.replace(/\\/g, "/"), Gt = 0, Kt = {
1025
- ".json": () => JSON.parse,
1026
- ".yaml": () => import("./yaml-N2dF3WHm.js").then((e) => e.parseYAML),
1027
- ".yml": () => import("./yaml-N2dF3WHm.js").then((e) => e.parseYAML),
1028
- ".jsonc": () => import("./jsonc-BDHXk_1o.js").then((e) => e.n).then((e) => (t) => e.parseJSONC(t, { allowTrailingComma: !0 })),
1029
- ".json5": () => import("./json5-feUuPtTt.js").then((e) => e.parseJSON5),
1030
- ".toml": () => import("./toml-BERh2MAo.js").then((e) => e.parseTOML)
1031
- }, qt = Object.freeze([
1032
- ".js",
1033
- ".ts",
1034
- ".mjs",
1035
- ".cjs",
1036
- ".mts",
1037
- ".cts",
1038
- ".json",
1039
- ".jsonc",
1040
- ".json5",
1041
- ".yaml",
1042
- ".yml",
1043
- ".toml"
1044
- ]);
1045
- async function Jt(e) {
1046
- e.cwd = C(process.cwd(), e.cwd || "."), e.name = e.name || "config", e.envName = e.envName ?? process.env.NODE_ENV, e.configFile = e.configFile ?? (e.name === "config" ? "config" : `${e.name}.config`), e.rcFile = e.rcFile ?? `.${e.name}rc`, e.extend !== !1 && (e.extend = {
1047
- extendKey: "extends",
1048
- ...e.extend
1049
- });
1050
- let t = e.merger || Y, n = {
1051
- config: {},
1052
- cwd: e.cwd,
1053
- configFile: C(e.cwd, e.configFile),
1054
- layers: [],
1055
- _configFile: void 0
1056
- }, r = {
1057
- overrides: e.overrides,
1058
- main: void 0,
1059
- rc: void 0,
1060
- packageJson: void 0,
1061
- defaultConfig: e.defaultConfig
1062
- };
1063
- e.dotenv && await It({
1064
- cwd: e.cwd,
1065
- ...e.dotenv === !0 ? {} : e.dotenv
1066
- });
1067
- let i = await Qt(".", e);
1068
- if (i.configFile && (r.main = i.config, n.configFile = i.configFile, n._configFile = i._configFile), i.meta && (n.meta = i.meta), e.rcFile) {
1069
- let n = [];
1070
- if (n.push(X({
1071
- name: e.rcFile,
1072
- dir: e.cwd
1073
- })), e.globalRc) {
1074
- let { findWorkspaceDir: t } = await import("./dist-AuwuGWnE.js"), r = await t(e.cwd).catch(() => {});
1075
- r && n.push(X({
1076
- name: e.rcFile,
1077
- dir: r
1078
- })), n.push(Ft({ name: e.rcFile })), n.push(X({
1079
- name: e.rcFile,
1080
- dir: _()
1081
- }));
1082
- }
1083
- r.rc = t({}, ...n);
1084
- }
1085
- if (e.packageJson) {
1086
- let n = (Array.isArray(e.packageJson) ? e.packageJson : [typeof e.packageJson == "string" ? e.packageJson : e.name]).filter((e) => e && typeof e == "string"), { readPackageJSON: i } = await import("./dist-AuwuGWnE.js"), a = await i(e.cwd).catch(() => {});
1087
- r.packageJson = t({}, ...n.map((e) => a?.[e]));
1088
- }
1089
- let a = {};
1090
- for (let e in r) {
1091
- let t = r[e];
1092
- a[e] = await (typeof t == "function" ? t({
1093
- configs: a,
1094
- rawConfigs: r
1095
- }) : t);
1096
- }
1097
- if (Array.isArray(a.main) ? n.config = a.main : (n.config = t(a.overrides, a.main, a.rc, a.packageJson, a.defaultConfig), e.extend && (await Yt(n.config, e), n.layers = n.config._layers, delete n.config._layers, n.config = t(n.config, ...n.layers.map((e) => e.config)))), n.layers = [...[
1098
- a.overrides && {
1099
- config: a.overrides,
1100
- configFile: void 0,
1101
- cwd: void 0
1102
- },
1103
- {
1104
- config: a.main,
1105
- configFile: e.configFile,
1106
- cwd: e.cwd
1107
- },
1108
- a.rc && {
1109
- config: a.rc,
1110
- configFile: e.rcFile
1111
- },
1112
- a.packageJson && {
1113
- config: a.packageJson,
1114
- configFile: "package.json"
1115
- }
1116
- ].filter((e) => e && e.config), ...n.layers], e.defaults && (n.config = t(n.config, e.defaults)), e.omit$Keys) for (let e in n.config) e.startsWith("$") && delete n.config[e];
1117
- if (e.configFileRequired && !n._configFile) throw Error(`Required config (${n.configFile}) cannot be resolved.`);
1118
- return e.schema != null && (n.config = await $t(n.config, e.schema)), n;
1119
- }
1120
- async function Yt(e, t) {
1121
- if (e._layers = e._layers || [], !t.extend) return;
1122
- let n = t.extend.extendKey;
1123
- typeof n == "string" && (n = [n]);
1124
- let r = [];
1125
- for (let t of n) r.push(...(Array.isArray(e[t]) ? e[t] : [e[t]]).filter(Boolean)), delete e[t];
1126
- for (let n of r) {
1127
- let r = n, i = {};
1128
- if (n.source && (i = n.options || {}, n = n.source), Array.isArray(n) && (i = n[1] || {}, n = n[0]), typeof n != "string") {
1129
- console.warn(`Cannot extend config from \`${JSON.stringify(r)}\` in ${t.cwd}`);
1130
- continue;
1131
- }
1132
- let a = await Qt(n, t, i);
1133
- if (!a.config) {
1134
- console.warn(`Cannot extend config from \`${n}\` in ${t.cwd}`);
1135
- continue;
1136
- }
1137
- await Yt(a.config, {
1138
- ...t,
1139
- cwd: a.cwd
1140
- }), e._layers.push(a), a.config._layers && (e._layers.push(...a.config._layers), delete a.config._layers);
1141
- }
1142
- }
1143
- var Xt = [
1144
- "gh:",
1145
- "github:",
1146
- "gitlab:",
1147
- "bitbucket:",
1148
- "https://",
1149
- "http://"
1150
- ], Zt = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
1151
- async function Qt(e, t, n = {}) {
1152
- if (t.resolve) {
1153
- let n = await t.resolve(e, t);
1154
- if (n) return n;
1155
- }
1156
- let r = t.merger || Y, a = Object.keys(n.giget?.providers || {}).map((e) => `${e}:`), o = a.length > 0 ? [.../* @__PURE__ */ new Set([...a, ...Xt])] : Xt;
1157
- if (t.giget !== !1 && o.some((t) => e.startsWith(t))) {
1158
- let { downloadTemplate: r } = await import("./__vite-optional-peer-dep_giget_c12-BYcrHYBM.js").catch((t) => {
1159
- throw Error(`Extending config from \`${e}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: t });
1160
- }), { digest: a } = await import("./ohash-Cc4pJh84.js").then((e) => e.dist_exports), o = e.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + a(e).slice(0, 10).replace(/[-_]/g, ""), s, c = C(t.cwd, "node_modules"), l = T(t.cwd);
1161
- s = ce(l) === ".c12" ? S(l, o) : i(c) ? S(c, ".c12", o) : process.env.XDG_CACHE_HOME ? C(process.env.XDG_CACHE_HOME, "c12", o) : C(_(), ".cache/c12", o);
1162
- let d = n.install ? Y(n.install === !0 ? {} : n.install, { ignoreWorkspace: !0 }) : !1;
1163
- i(s) && !d && await u(s, { recursive: !0 }), e = (await r(e, {
1164
- dir: s,
1165
- install: d,
1166
- force: !!d,
1167
- auth: n.auth,
1168
- ...t.giget,
1169
- ...n.giget
1170
- })).dir;
1171
- }
1172
- Zt.test(e) && (e = $(e, t) || e);
1173
- let s = se(e), c = en(C(t.cwd, e)) ?? (!s || s === ce(e)), d = C(t.cwd, c ? e : T(e));
1174
- c && (e = t.configFile);
1175
- let f = {
1176
- config: void 0,
1177
- configFile: void 0,
1178
- cwd: d,
1179
- source: e,
1180
- sourceOptions: n
1181
- };
1182
- if (f.configFile = $(C(d, e), t) || $(C(d, ".config", e.replace(/\.config$/, "")), t) || $(C(d, ".config", e), t) || e, !i(f.configFile)) return f;
1183
- f._configFile = f.configFile;
1184
- let p = se(f.configFile) || "";
1185
- if (p in Kt) f.config = (await Kt[p]())(await l(f.configFile, "utf8"));
1186
- else {
1187
- let e = t.resolveModule || ((e) => e.default || e);
1188
- if (t.import) f.config = e(await t.import(f.configFile));
1189
- else {
1190
- let n = g(f.configFile);
1191
- n.search = `_${++Gt}`, f.config = await import(n.href).then(e, async (n) => {
1192
- let { createJiti: r } = await import("./__vite-optional-peer-dep_jiti_c12-DZVJNj6v.js").catch(() => {
1193
- throw Error(`Failed to load config file \`${f.configFile}\`: ${n?.message}. Hint install \`jiti\` for compatibility.`, { cause: n });
1194
- }), i = r(S(t.cwd || ".", t.configFile || "/"), {
1195
- interopDefault: !0,
1196
- moduleCache: !1,
1197
- extensions: [...qt],
1198
- ...t.jitiOptions
1199
- });
1200
- return t.import = (e) => i.import(e), e(await t.import(f.configFile));
1201
- });
1202
- }
1203
- }
1204
- typeof f.config == "function" && (f.config = await f.config(t.context)), f.config && typeof f.config == "object" && !Array.isArray(f.config) && !Object.isExtensible(f.config) && (f.config = { ...f.config });
1205
- let m = (Array.isArray(t.envName) ? t.envName : [t.envName]).filter(Boolean).reverse().flatMap((e) => [f.config.$env?.[e], f.config["$" + e]]).filter((e) => e && Object.keys(e).length > 0);
1206
- return m.length > 0 && (f.config = (t.envMerger || r)({}, ...m, f.config)), f.meta = Y(f.sourceOptions.meta, f.config.$meta), delete f.config.$meta, f.sourceOptions.overrides && (f.config = r(f.sourceOptions.overrides, f.config)), f.configFile = Q(f.configFile), f.source = Q(f.source), f;
1207
- }
1208
- async function $t(e, t) {
1209
- if (typeof t?.["~standard"]?.validate != "function") throw TypeError("Invalid `schema` option: expected a Standard Schema (https://standardschema.dev).");
1210
- let n = await t["~standard"].validate(e);
1211
- if (n.issues) {
1212
- let e = n.issues.map((e) => {
1213
- let t = e.path?.map((e) => String(typeof e == "object" ? e.key : e)).join(".");
1214
- return ` - ${t ? `${t}: ` : ""}${e.message}`;
1215
- });
1216
- throw Error(`Config validation failed (${t["~standard"].vendor}):\n${e.join("\n")}`, { cause: n.issues });
1217
- }
1218
- return n.value;
1219
- }
1220
- function $(e, t) {
1221
- let n = ot(e, {
1222
- try: !0,
1223
- from: g(S(t.cwd || ".", t.configFile || "/")),
1224
- suffixes: ["", "/index"],
1225
- extensions: qt,
1226
- cache: !1
1227
- });
1228
- return n ? x(n) : void 0;
1229
- }
1230
- function en(e) {
1231
- try {
1232
- return c(e).isDirectory();
1233
- } catch {
1234
- return null;
1235
- }
1236
- }
1237
- function tn() {
1238
- return (e) => e;
1239
- }
1240
- //#endregion
1241
- //#region src/config/defaults.mts
1242
- var nn = {
1243
- outDir: "dist",
1244
- version: "0.0.0"
1245
- };
1246
- function rn(e) {
1247
- let t = e.indexOf("/");
1248
- return e.startsWith("@") && t !== -1 ? e.slice(t + 1) : e;
1249
- }
1250
- var an = "app";
1251
- function on(e) {
1252
- let t = e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1253
- return t === "" ? an : t;
1254
- }
1255
- function sn(e) {
1256
- return e ? rn(e) : void 0;
1257
- }
1258
- function cn(e) {
1259
- return `org.inca.${on(e)}`;
1260
- }
1261
- //#endregion
1262
- export { tn as a, T as c, x as d, C as f, on as i, w as l, cn as n, Jt as o, sn as r, ot as s, nn as t, S as u };