@styleframe/cli 1.0.2 → 1.0.4

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,517 @@
1
+ import { N } from "./build-DMySNOvV.js";
2
+ /*!
3
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice, this
10
+ * list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * 3. Neither the name of the copyright holder nor the names of its contributors
15
+ * may be used to endorse or promote products derived from this software without
16
+ * specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ */
29
+ function v(e, n) {
30
+ let t = e.slice(0, n).split(/\r\n|\n|\r/g);
31
+ return [t.length, t.pop().length + 1];
32
+ }
33
+ function C(e, n, t) {
34
+ let l = e.split(/\r\n|\n|\r/g), r = "", i = (Math.log10(n + 1) | 0) + 1;
35
+ for (let o = n - 1; o <= n + 1; o++) {
36
+ let f = l[o - 1];
37
+ f && (r += o.toString().padEnd(i, " "), r += ": ", r += f, r += `
38
+ `, o === n && (r += " ".repeat(i + t + 2), r += `^
39
+ `));
40
+ }
41
+ return r;
42
+ }
43
+ class c extends Error {
44
+ line;
45
+ column;
46
+ codeblock;
47
+ constructor(n, t) {
48
+ const [l, r] = v(t.toml, t.ptr), i = C(t.toml, l, r);
49
+ super(`Invalid TOML document: ${n}
50
+
51
+ ${i}`, t), this.line = l, this.column = r, this.codeblock = i;
52
+ }
53
+ }
54
+ /*!
55
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
56
+ * SPDX-License-Identifier: BSD-3-Clause
57
+ *
58
+ * Redistribution and use in source and binary forms, with or without
59
+ * modification, are permitted provided that the following conditions are met:
60
+ *
61
+ * 1. Redistributions of source code must retain the above copyright notice, this
62
+ * list of conditions and the following disclaimer.
63
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
64
+ * this list of conditions and the following disclaimer in the
65
+ * documentation and/or other materials provided with the distribution.
66
+ * 3. Neither the name of the copyright holder nor the names of its contributors
67
+ * may be used to endorse or promote products derived from this software without
68
+ * specific prior written permission.
69
+ *
70
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
71
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
72
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
73
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
74
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
75
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
76
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
77
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
78
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
79
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80
+ */
81
+ function g(e, n = 0, t = e.length) {
82
+ let l = e.indexOf(`
83
+ `, n);
84
+ return e[l - 1] === "\r" && l--, l <= t ? l : -1;
85
+ }
86
+ function y(e, n) {
87
+ for (let t = n; t < e.length; t++) {
88
+ let l = e[t];
89
+ if (l === `
90
+ `) return t;
91
+ if (l === "\r" && e[t + 1] === `
92
+ `) return t + 1;
93
+ if (l < " " && l !== " " || l === "") throw new c("control characters are not allowed in comments", { toml: e, ptr: n });
94
+ }
95
+ return e.length;
96
+ }
97
+ function s(e, n, t, l) {
98
+ let r;
99
+ for (; (r = e[n]) === " " || r === " " || !t && (r === `
100
+ ` || r === "\r" && e[n + 1] === `
101
+ `); ) n++;
102
+ return l || r !== "#" ? n : s(e, y(e, n), t);
103
+ }
104
+ function A(e, n, t, l, r = false) {
105
+ if (!l) return n = g(e, n), n < 0 ? e.length : n;
106
+ for (let i = n; i < e.length; i++) {
107
+ let o = e[i];
108
+ if (o === "#") i = g(e, i);
109
+ else {
110
+ if (o === t) return i + 1;
111
+ if (o === l) return i;
112
+ if (r && (o === `
113
+ ` || o === "\r" && e[i + 1] === `
114
+ `)) return i;
115
+ }
116
+ }
117
+ throw new c("cannot find end of structure", { toml: e, ptr: n });
118
+ }
119
+ function S(e, n) {
120
+ let t = e[n], l = t === e[n + 1] && e[n + 1] === e[n + 2] ? e.slice(n, n + 3) : t;
121
+ n += l.length - 1;
122
+ do
123
+ n = e.indexOf(l, ++n);
124
+ while (n > -1 && t !== "'" && e[n - 1] === "\\" && e[n - 2] !== "\\");
125
+ return n > -1 && (n += l.length, l.length > 1 && (e[n] === t && n++, e[n] === t && n++)), n;
126
+ }
127
+ /*!
128
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
129
+ * SPDX-License-Identifier: BSD-3-Clause
130
+ *
131
+ * Redistribution and use in source and binary forms, with or without
132
+ * modification, are permitted provided that the following conditions are met:
133
+ *
134
+ * 1. Redistributions of source code must retain the above copyright notice, this
135
+ * list of conditions and the following disclaimer.
136
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
137
+ * this list of conditions and the following disclaimer in the
138
+ * documentation and/or other materials provided with the distribution.
139
+ * 3. Neither the name of the copyright holder nor the names of its contributors
140
+ * may be used to endorse or promote products derived from this software without
141
+ * specific prior written permission.
142
+ *
143
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
144
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
145
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
146
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
147
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
148
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
149
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
150
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
151
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
152
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
153
+ */
154
+ let R = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
155
+ class w extends Date {
156
+ #n = false;
157
+ #t = false;
158
+ #e = null;
159
+ constructor(n) {
160
+ let t = true, l = true, r = "Z";
161
+ if (typeof n == "string") {
162
+ let i = n.match(R);
163
+ i ? (i[1] || (t = false, n = `0000-01-01T${n}`), l = !!i[2], i[2] && +i[2] > 23 ? n = "" : (r = i[3] || null, n = n.toUpperCase(), !r && l && (n += "Z"))) : n = "";
164
+ }
165
+ super(n), isNaN(this.getTime()) || (this.#n = t, this.#t = l, this.#e = r);
166
+ }
167
+ isDateTime() {
168
+ return this.#n && this.#t;
169
+ }
170
+ isLocal() {
171
+ return !this.#n || !this.#t || !this.#e;
172
+ }
173
+ isDate() {
174
+ return this.#n && !this.#t;
175
+ }
176
+ isTime() {
177
+ return this.#t && !this.#n;
178
+ }
179
+ isValid() {
180
+ return this.#n || this.#t;
181
+ }
182
+ toISOString() {
183
+ let n = super.toISOString();
184
+ if (this.isDate()) return n.slice(0, 10);
185
+ if (this.isTime()) return n.slice(11, 23);
186
+ if (this.#e === null) return n.slice(0, -1);
187
+ if (this.#e === "Z") return n;
188
+ let t = +this.#e.slice(1, 3) * 60 + +this.#e.slice(4, 6);
189
+ return t = this.#e[0] === "-" ? t : -t, new Date(this.getTime() - t * 6e4).toISOString().slice(0, -1) + this.#e;
190
+ }
191
+ static wrapAsOffsetDateTime(n, t = "Z") {
192
+ let l = new w(n);
193
+ return l.#e = t, l;
194
+ }
195
+ static wrapAsLocalDateTime(n) {
196
+ let t = new w(n);
197
+ return t.#e = null, t;
198
+ }
199
+ static wrapAsLocalDate(n) {
200
+ let t = new w(n);
201
+ return t.#t = false, t.#e = null, t;
202
+ }
203
+ static wrapAsLocalTime(n) {
204
+ let t = new w(n);
205
+ return t.#n = false, t.#e = null, t;
206
+ }
207
+ }
208
+ /*!
209
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
210
+ * SPDX-License-Identifier: BSD-3-Clause
211
+ *
212
+ * Redistribution and use in source and binary forms, with or without
213
+ * modification, are permitted provided that the following conditions are met:
214
+ *
215
+ * 1. Redistributions of source code must retain the above copyright notice, this
216
+ * list of conditions and the following disclaimer.
217
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
218
+ * this list of conditions and the following disclaimer in the
219
+ * documentation and/or other materials provided with the distribution.
220
+ * 3. Neither the name of the copyright holder nor the names of its contributors
221
+ * may be used to endorse or promote products derived from this software without
222
+ * specific prior written permission.
223
+ *
224
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
225
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
226
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
227
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
228
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
229
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
230
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
231
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
232
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
233
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
234
+ */
235
+ let M = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, Z = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, j = /^[+-]?0[0-9_]/, z = /^[0-9a-f]{4,8}$/i, I = { b: "\b", t: " ", n: `
236
+ `, f: "\f", r: "\r", '"': '"', "\\": "\\" };
237
+ function $(e, n = 0, t = e.length) {
238
+ let l = e[n] === "'", r = e[n++] === e[n] && e[n] === e[n + 1];
239
+ r && (t -= 2, e[n += 2] === "\r" && n++, e[n] === `
240
+ ` && n++);
241
+ let i = 0, o, f = "", a = n;
242
+ for (; n < t - 1; ) {
243
+ let u = e[n++];
244
+ if (u === `
245
+ ` || u === "\r" && e[n] === `
246
+ `) {
247
+ if (!r) throw new c("newlines are not allowed in strings", { toml: e, ptr: n - 1 });
248
+ } else if (u < " " && u !== " " || u === "") throw new c("control characters are not allowed in strings", { toml: e, ptr: n - 1 });
249
+ if (o) {
250
+ if (o = false, u === "u" || u === "U") {
251
+ let d = e.slice(n, n += u === "u" ? 4 : 8);
252
+ if (!z.test(d)) throw new c("invalid unicode escape", { toml: e, ptr: i });
253
+ try {
254
+ f += String.fromCodePoint(parseInt(d, 16));
255
+ } catch {
256
+ throw new c("invalid unicode escape", { toml: e, ptr: i });
257
+ }
258
+ } else if (r && (u === `
259
+ ` || u === " " || u === " " || u === "\r")) {
260
+ if (n = s(e, n - 1, true), e[n] !== `
261
+ ` && e[n] !== "\r") throw new c("invalid escape: only line-ending whitespace may be escaped", { toml: e, ptr: i });
262
+ n = s(e, n);
263
+ } else if (u in I) f += I[u];
264
+ else throw new c("unrecognized escape sequence", { toml: e, ptr: i });
265
+ a = n;
266
+ } else !l && u === "\\" && (i = n - 1, o = true, f += e.slice(a, i));
267
+ }
268
+ return f + e.slice(a, t - 1);
269
+ }
270
+ function F(e, n, t) {
271
+ if (e === "true") return true;
272
+ if (e === "false") return false;
273
+ if (e === "-inf") return -1 / 0;
274
+ if (e === "inf" || e === "+inf") return 1 / 0;
275
+ if (e === "nan" || e === "+nan" || e === "-nan") return NaN;
276
+ if (e === "-0") return 0;
277
+ let l;
278
+ if ((l = M.test(e)) || Z.test(e)) {
279
+ if (j.test(e)) throw new c("leading zeroes are not allowed", { toml: n, ptr: t });
280
+ let i = +e.replace(/_/g, "");
281
+ if (isNaN(i)) throw new c("invalid number", { toml: n, ptr: t });
282
+ if (l && !Number.isSafeInteger(i)) throw new c("integer value cannot be represented losslessly", { toml: n, ptr: t });
283
+ return i;
284
+ }
285
+ let r = new w(e);
286
+ if (!r.isValid()) throw new c("invalid value", { toml: n, ptr: t });
287
+ return r;
288
+ }
289
+ /*!
290
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
291
+ * SPDX-License-Identifier: BSD-3-Clause
292
+ *
293
+ * Redistribution and use in source and binary forms, with or without
294
+ * modification, are permitted provided that the following conditions are met:
295
+ *
296
+ * 1. Redistributions of source code must retain the above copyright notice, this
297
+ * list of conditions and the following disclaimer.
298
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
299
+ * this list of conditions and the following disclaimer in the
300
+ * documentation and/or other materials provided with the distribution.
301
+ * 3. Neither the name of the copyright holder nor the names of its contributors
302
+ * may be used to endorse or promote products derived from this software without
303
+ * specific prior written permission.
304
+ *
305
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
306
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
307
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
308
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
309
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
310
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
311
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
312
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
313
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
314
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
315
+ */
316
+ function V(e, n, t, l) {
317
+ let r = e.slice(n, t), i = r.indexOf("#");
318
+ i > -1 && (y(e, i), r = r.slice(0, i));
319
+ let o = r.trimEnd();
320
+ if (!l) {
321
+ let f = r.indexOf(`
322
+ `, o.length);
323
+ if (f > -1) throw new c("newlines are not allowed in inline tables", { toml: e, ptr: n + f });
324
+ }
325
+ return [o, i];
326
+ }
327
+ function b(e, n, t, l) {
328
+ if (l === 0) throw new c("document contains excessively nested structures. aborting.", { toml: e, ptr: n });
329
+ let r = e[n];
330
+ if (r === "[" || r === "{") {
331
+ let [f, a] = r === "[" ? U(e, n, l) : K(e, n, l), u = A(e, a, ",", t);
332
+ if (t === "}") {
333
+ let d = g(e, a, u);
334
+ if (d > -1) throw new c("newlines are not allowed in inline tables", { toml: e, ptr: d });
335
+ }
336
+ return [f, u];
337
+ }
338
+ let i;
339
+ if (r === '"' || r === "'") {
340
+ i = S(e, n);
341
+ let f = $(e, n, i);
342
+ if (t) {
343
+ if (i = s(e, i, t !== "]"), e[i] && e[i] !== "," && e[i] !== t && e[i] !== `
344
+ ` && e[i] !== "\r") throw new c("unexpected character encountered", { toml: e, ptr: i });
345
+ i += +(e[i] === ",");
346
+ }
347
+ return [f, i];
348
+ }
349
+ i = A(e, n, ",", t);
350
+ let o = V(e, n, i - +(e[i - 1] === ","), t === "]");
351
+ if (!o[0]) throw new c("incomplete key-value declaration: no value specified", { toml: e, ptr: n });
352
+ return t && o[1] > -1 && (i = s(e, n + o[1]), i += +(e[i] === ",")), [F(o[0], e, n), i];
353
+ }
354
+ /*!
355
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
356
+ * SPDX-License-Identifier: BSD-3-Clause
357
+ *
358
+ * Redistribution and use in source and binary forms, with or without
359
+ * modification, are permitted provided that the following conditions are met:
360
+ *
361
+ * 1. Redistributions of source code must retain the above copyright notice, this
362
+ * list of conditions and the following disclaimer.
363
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
364
+ * this list of conditions and the following disclaimer in the
365
+ * documentation and/or other materials provided with the distribution.
366
+ * 3. Neither the name of the copyright holder nor the names of its contributors
367
+ * may be used to endorse or promote products derived from this software without
368
+ * specific prior written permission.
369
+ *
370
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
371
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
372
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
373
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
374
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
375
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
376
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
377
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
378
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
379
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
380
+ */
381
+ let G = /^[a-zA-Z0-9-_]+[ \t]*$/;
382
+ function x(e, n, t = "=") {
383
+ let l = n - 1, r = [], i = e.indexOf(t, n);
384
+ if (i < 0) throw new c("incomplete key-value: cannot find end of key", { toml: e, ptr: n });
385
+ do {
386
+ let o = e[n = ++l];
387
+ if (o !== " " && o !== " ") if (o === '"' || o === "'") {
388
+ if (o === e[n + 1] && o === e[n + 2]) throw new c("multiline strings are not allowed in keys", { toml: e, ptr: n });
389
+ let f = S(e, n);
390
+ if (f < 0) throw new c("unfinished string encountered", { toml: e, ptr: n });
391
+ l = e.indexOf(".", f);
392
+ let a = e.slice(f, l < 0 || l > i ? i : l), u = g(a);
393
+ if (u > -1) throw new c("newlines are not allowed in keys", { toml: e, ptr: n + l + u });
394
+ if (a.trimStart()) throw new c("found extra tokens after the string part", { toml: e, ptr: f });
395
+ if (i < f && (i = e.indexOf(t, f), i < 0)) throw new c("incomplete key-value: cannot find end of key", { toml: e, ptr: n });
396
+ r.push($(e, n, f));
397
+ } else {
398
+ l = e.indexOf(".", n);
399
+ let f = e.slice(n, l < 0 || l > i ? i : l);
400
+ if (!G.test(f)) throw new c("only letter, numbers, dashes and underscores are allowed in keys", { toml: e, ptr: n });
401
+ r.push(f.trimEnd());
402
+ }
403
+ } while (l + 1 && l < i);
404
+ return [r, s(e, i + 1, true, true)];
405
+ }
406
+ function K(e, n, t) {
407
+ let l = {}, r = /* @__PURE__ */ new Set(), i, o = 0;
408
+ for (n++; (i = e[n++]) !== "}" && i; ) {
409
+ if (i === `
410
+ `) throw new c("newlines are not allowed in inline tables", { toml: e, ptr: n - 1 });
411
+ if (i === "#") throw new c("inline tables cannot contain comments", { toml: e, ptr: n - 1 });
412
+ if (i === ",") throw new c("expected key-value, found comma", { toml: e, ptr: n - 1 });
413
+ if (i !== " " && i !== " ") {
414
+ let f, a = l, u = false, [d, N2] = x(e, n - 1);
415
+ for (let m = 0; m < d.length; m++) {
416
+ if (m && (a = u ? a[f] : a[f] = {}), f = d[m], (u = Object.hasOwn(a, f)) && (typeof a[f] != "object" || r.has(a[f]))) throw new c("trying to redefine an already defined value", { toml: e, ptr: n });
417
+ !u && f === "__proto__" && Object.defineProperty(a, f, { enumerable: true, configurable: true, writable: true });
418
+ }
419
+ if (u) throw new c("trying to redefine an already defined value", { toml: e, ptr: n });
420
+ let [_, k] = b(e, N2, "}", t - 1);
421
+ r.add(_), a[f] = _, n = k, o = e[n - 1] === "," ? n - 1 : 0;
422
+ }
423
+ }
424
+ if (o) throw new c("trailing commas are not allowed in inline tables", { toml: e, ptr: o });
425
+ if (!i) throw new c("unfinished table encountered", { toml: e, ptr: n });
426
+ return [l, n];
427
+ }
428
+ function U(e, n, t) {
429
+ let l = [], r;
430
+ for (n++; (r = e[n++]) !== "]" && r; ) {
431
+ if (r === ",") throw new c("expected value, found comma", { toml: e, ptr: n - 1 });
432
+ if (r === "#") n = y(e, n);
433
+ else if (r !== " " && r !== " " && r !== `
434
+ ` && r !== "\r") {
435
+ let i = b(e, n - 1, "]", t - 1);
436
+ l.push(i[0]), n = i[1];
437
+ }
438
+ }
439
+ if (!r) throw new c("unfinished array encountered", { toml: e, ptr: n });
440
+ return [l, n];
441
+ }
442
+ /*!
443
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
444
+ * SPDX-License-Identifier: BSD-3-Clause
445
+ *
446
+ * Redistribution and use in source and binary forms, with or without
447
+ * modification, are permitted provided that the following conditions are met:
448
+ *
449
+ * 1. Redistributions of source code must retain the above copyright notice, this
450
+ * list of conditions and the following disclaimer.
451
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
452
+ * this list of conditions and the following disclaimer in the
453
+ * documentation and/or other materials provided with the distribution.
454
+ * 3. Neither the name of the copyright holder nor the names of its contributors
455
+ * may be used to endorse or promote products derived from this software without
456
+ * specific prior written permission.
457
+ *
458
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
459
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
460
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
461
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
462
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
463
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
464
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
465
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
466
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
467
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
468
+ */
469
+ function p(e, n, t, l) {
470
+ let r = n, i = t, o, f = false, a;
471
+ for (let u = 0; u < e.length; u++) {
472
+ if (u) {
473
+ if (r = f ? r[o] : r[o] = {}, i = (a = i[o]).c, l === 0 && (a.t === 1 || a.t === 2)) return null;
474
+ if (a.t === 2) {
475
+ let d = r.length - 1;
476
+ r = r[d], i = i[d].c;
477
+ }
478
+ }
479
+ if (o = e[u], (f = Object.hasOwn(r, o)) && i[o]?.t === 0 && i[o]?.d) return null;
480
+ f || (o === "__proto__" && (Object.defineProperty(r, o, { enumerable: true, configurable: true, writable: true }), Object.defineProperty(i, o, { enumerable: true, configurable: true, writable: true })), i[o] = { t: u < e.length - 1 && l === 2 ? 3 : l, d: false, i: 0, c: {} });
481
+ }
482
+ if (a = i[o], a.t !== l && !(l === 1 && a.t === 3) || (l === 2 && (a.d || (a.d = true, r[o] = []), r[o].push(r = {}), a.c[a.i++] = a = { t: 1, d: false, i: 0, c: {} }), a.d)) return null;
483
+ if (a.d = true, l === 1) r = f ? r[o] : r[o] = {};
484
+ else if (l === 0 && f) return null;
485
+ return [o, r, a.c];
486
+ }
487
+ function X(e, n) {
488
+ let t = 1e3, l = {}, r = {}, i = l, o = r;
489
+ for (let f = s(e, 0); f < e.length; ) {
490
+ if (e[f] === "[") {
491
+ let a = e[++f] === "[", u = x(e, f += +a, "]");
492
+ if (a) {
493
+ if (e[u[1] - 1] !== "]") throw new c("expected end of table declaration", { toml: e, ptr: u[1] - 1 });
494
+ u[1]++;
495
+ }
496
+ let d = p(u[0], l, r, a ? 2 : 1);
497
+ if (!d) throw new c("trying to redefine an already defined table or value", { toml: e, ptr: f });
498
+ o = d[2], i = d[1], f = u[1];
499
+ } else {
500
+ let a = x(e, f), u = p(a[0], i, o, 0);
501
+ if (!u) throw new c("trying to redefine an already defined table or value", { toml: e, ptr: f });
502
+ let d = b(e, a[1], void 0, t);
503
+ u[1][u[0]] = d[0], f = d[1];
504
+ }
505
+ if (f = s(e, f, true), e[f] && e[f] !== `
506
+ ` && e[f] !== "\r") throw new c("each key-value declaration must be followed by an end-of-line", { toml: e, ptr: f });
507
+ f = s(e, f);
508
+ }
509
+ return l;
510
+ }
511
+ function Q(e) {
512
+ const n = X(e);
513
+ return N(e, n, { preserveIndentation: false }), n;
514
+ }
515
+ export {
516
+ Q as parseTOML
517
+ };