agentschat-mcp 0.36.16 → 0.36.18

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.
@@ -315,6 +315,126 @@ function validateIdentityProfile(profile, file, allowDevToken = false) {
315
315
  }
316
316
  }
317
317
 
318
+ // node_modules/smol-toml/dist/date.js
319
+ /*!
320
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
321
+ * SPDX-License-Identifier: BSD-3-Clause
322
+ *
323
+ * Redistribution and use in source and binary forms, with or without
324
+ * modification, are permitted provided that the following conditions are met:
325
+ *
326
+ * 1. Redistributions of source code must retain the above copyright notice, this
327
+ * list of conditions and the following disclaimer.
328
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
329
+ * this list of conditions and the following disclaimer in the
330
+ * documentation and/or other materials provided with the distribution.
331
+ * 3. Neither the name of the copyright holder nor the names of its contributors
332
+ * may be used to endorse or promote products derived from this software without
333
+ * specific prior written permission.
334
+ *
335
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
336
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
337
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
338
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
339
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
340
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
341
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
342
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
343
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
344
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
345
+ */
346
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
347
+
348
+ class TomlDate extends Date {
349
+ #hasDate = false;
350
+ #hasTime = false;
351
+ #offset = null;
352
+ constructor(date) {
353
+ let hasDate = true;
354
+ let hasTime = true;
355
+ let offset = "Z";
356
+ if (typeof date === "string") {
357
+ let match = date.match(DATE_TIME_RE);
358
+ if (match) {
359
+ if (!match[1]) {
360
+ hasDate = false;
361
+ date = `0000-01-01T${date}`;
362
+ }
363
+ hasTime = !!match[2];
364
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
365
+ if (match[2] && +match[2] > 23) {
366
+ date = "";
367
+ } else {
368
+ offset = match[3] || null;
369
+ date = date.toUpperCase();
370
+ if (!offset && hasTime)
371
+ date += "Z";
372
+ }
373
+ } else {
374
+ date = "";
375
+ }
376
+ }
377
+ super(date);
378
+ if (!isNaN(this.getTime())) {
379
+ this.#hasDate = hasDate;
380
+ this.#hasTime = hasTime;
381
+ this.#offset = offset;
382
+ }
383
+ }
384
+ isDateTime() {
385
+ return this.#hasDate && this.#hasTime;
386
+ }
387
+ isLocal() {
388
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
389
+ }
390
+ isDate() {
391
+ return this.#hasDate && !this.#hasTime;
392
+ }
393
+ isTime() {
394
+ return this.#hasTime && !this.#hasDate;
395
+ }
396
+ isValid() {
397
+ return this.#hasDate || this.#hasTime;
398
+ }
399
+ toISOString() {
400
+ let iso = super.toISOString();
401
+ if (this.isDate())
402
+ return iso.slice(0, 10);
403
+ if (this.isTime())
404
+ return iso.slice(11, 23);
405
+ if (this.#offset === null)
406
+ return iso.slice(0, -1);
407
+ if (this.#offset === "Z")
408
+ return iso;
409
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
410
+ offset = this.#offset[0] === "-" ? offset : -offset;
411
+ let offsetDate = new Date(this.getTime() - offset * 60000);
412
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
413
+ }
414
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
415
+ let date = new TomlDate(jsDate);
416
+ date.#offset = offset;
417
+ return date;
418
+ }
419
+ static wrapAsLocalDateTime(jsDate) {
420
+ let date = new TomlDate(jsDate);
421
+ date.#offset = null;
422
+ return date;
423
+ }
424
+ static wrapAsLocalDate(jsDate) {
425
+ let date = new TomlDate(jsDate);
426
+ date.#hasTime = false;
427
+ date.#offset = null;
428
+ return date;
429
+ }
430
+ static wrapAsLocalTime(jsDate) {
431
+ let date = new TomlDate(jsDate);
432
+ date.#hasDate = false;
433
+ date.#offset = null;
434
+ return date;
435
+ }
436
+ }
437
+
318
438
  // node_modules/smol-toml/dist/error.js
319
439
  /*!
320
440
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -344,11 +464,11 @@ function validateIdentityProfile(profile, file, allowDevToken = false) {
344
464
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
345
465
  */
346
466
  function getLineColFromPtr(string, ptr) {
347
- let lines = string.slice(0, ptr).split(/\r?\n/);
467
+ let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
348
468
  return [lines.length, lines.pop().length + 1];
349
469
  }
350
470
  function makeCodeBlock(string, line, column) {
351
- let lines = string.split(/\r?\n/);
471
+ let lines = string.split(/\r\n|\n|\r/g);
352
472
  let codeblock = "";
353
473
  let numberLen = (Math.log10(line + 1) | 0) + 1;
354
474
  for (let i = line - 1;i <= line + 1; i++) {
@@ -383,9 +503,89 @@ ${codeblock}`, options);
383
503
  this.column = column;
384
504
  this.codeblock = codeblock;
385
505
  }
386
- static x(message, ctx, ptr) {
387
- throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
506
+ }
507
+
508
+ // node_modules/smol-toml/dist/util.js
509
+ /*!
510
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
511
+ * SPDX-License-Identifier: BSD-3-Clause
512
+ *
513
+ * Redistribution and use in source and binary forms, with or without
514
+ * modification, are permitted provided that the following conditions are met:
515
+ *
516
+ * 1. Redistributions of source code must retain the above copyright notice, this
517
+ * list of conditions and the following disclaimer.
518
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
519
+ * this list of conditions and the following disclaimer in the
520
+ * documentation and/or other materials provided with the distribution.
521
+ * 3. Neither the name of the copyright holder nor the names of its contributors
522
+ * may be used to endorse or promote products derived from this software without
523
+ * specific prior written permission.
524
+ *
525
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
526
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
527
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
528
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
529
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
530
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
531
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
532
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
533
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
534
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
535
+ */
536
+ function indexOfNewline(str, start = 0) {
537
+ let idx = str.indexOf(`
538
+ `, start);
539
+ if (str.charCodeAt(idx - 1) === 13)
540
+ idx--;
541
+ return idx;
542
+ }
543
+ function skipComment(ctx) {
544
+ for (;ctx.p < ctx.s.length; ctx.p++) {
545
+ let c = ctx.s.charCodeAt(ctx.p);
546
+ if (c === 10)
547
+ break;
548
+ if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
549
+ ctx.p++;
550
+ break;
551
+ }
552
+ if (c < 32 && c !== 9 || c === 127) {
553
+ throw new TomlError("control characters are not allowed in comments", {
554
+ toml: ctx.s,
555
+ ptr: ctx.p
556
+ });
557
+ }
558
+ }
559
+ }
560
+ function skipVoid(ctx, banNewLines, banComments) {
561
+ let c;
562
+ while (true) {
563
+ while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
564
+ ctx.p++;
565
+ if (banComments || c !== 35)
566
+ break;
567
+ skipComment(ctx);
568
+ }
569
+ }
570
+ function skipUntil(ctx, sep2, end) {
571
+ let ptr = ctx.p;
572
+ if (!end) {
573
+ ptr = indexOfNewline(ctx.s, ptr);
574
+ ctx.p = ptr < 0 ? ctx.s.length : ptr;
575
+ return;
576
+ }
577
+ for (;ctx.p < ctx.s.length; ctx.p++) {
578
+ let c = ctx.s.charCodeAt(ctx.p);
579
+ if (c === 35) {
580
+ skipComment(ctx);
581
+ } else if (c === end || c === sep2) {
582
+ return;
583
+ }
388
584
  }
585
+ throw new TomlError("cannot find end of structure", {
586
+ toml: ctx.s,
587
+ ptr
588
+ });
389
589
  }
390
590
 
391
591
  // node_modules/smol-toml/dist/primitive.js
@@ -416,8 +616,11 @@ ${codeblock}`, options);
416
616
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
417
617
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
418
618
  */
619
+ var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
620
+ var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
621
+ var LEADING_ZERO = /^[+-]?0[0-9_]/;
419
622
  function parseString(ctx) {
420
- let startPtr = ctx.p;
623
+ let start = ctx.p;
421
624
  let c = ctx.s.charCodeAt(ctx.p++);
422
625
  let first = c;
423
626
  let isLiteral = c === 39;
@@ -436,7 +639,10 @@ function parseString(ctx) {
436
639
  if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
437
640
  state = state && 3;
438
641
  } else if (c < 32 && c !== 9 || c === 127) {
439
- TomlError.x("control characters are not allowed in strings", ctx);
642
+ throw new TomlError("control characters are not allowed in strings", {
643
+ toml: ctx.s,
644
+ ptr: ctx.p
645
+ });
440
646
  } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
441
647
  if (isMultiline) {
442
648
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
@@ -444,10 +650,8 @@ function parseString(ctx) {
444
650
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
445
651
  ctx.p++;
446
652
  }
447
- if (!state) {
448
- let s = ctx.s.slice(sliceStart, ctx.p);
449
- parsed = parsed ? parsed + s : s;
450
- }
653
+ if (!state)
654
+ parsed += ctx.s.slice(sliceStart, ctx.p);
451
655
  ctx.p += isMultiline ? 3 : 1;
452
656
  return parsed;
453
657
  } else if (!state) {
@@ -457,23 +661,22 @@ function parseString(ctx) {
457
661
  }
458
662
  } else if (state === 1) {
459
663
  if (c === 120 || c === 117 || c === 85) {
460
- let errPtr = ctx.p++ - 1;
461
664
  let value = 0;
462
665
  let len = c === 120 ? 2 : c === 117 ? 4 : 8;
463
666
  for (let j = 0;j < len; j++, ctx.p++) {
464
- let hex = ctx.s.charCodeAt(ctx.p);
667
+ let hex = ctx.s.charCodeAt(ctx.p + 1);
465
668
  let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
466
669
  if (digit < 0)
467
- TomlError.x("invalid non-hex character in unicode escape", ctx);
670
+ throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
468
671
  value = value << 4 | digit;
469
672
  }
470
673
  if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
471
- TomlError.x("invalid unicode escape", ctx, errPtr);
674
+ throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
472
675
  }
473
676
  parsed += String.fromCodePoint(value);
474
- sliceStart = ctx.p--;
677
+ sliceStart = ctx.p + 1;
475
678
  state = 0;
476
- } else if (isMultiline && (c === 32 || c === 9)) {
679
+ } else if (c === 32 || c === 9) {
477
680
  state = 2;
478
681
  } else {
479
682
  if (c === 98)
@@ -494,161 +697,70 @@ function parseString(ctx) {
494
697
  else if (c === 92)
495
698
  parsed += "\\";
496
699
  else
497
- TomlError.x("unrecognised escape sequence", ctx);
700
+ throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
498
701
  sliceStart = ctx.p + 1;
499
702
  state = 0;
500
703
  }
501
704
  } else if (c !== 32 && c !== 9) {
502
- if (state === 2)
503
- TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
705
+ if (state === 2) {
706
+ throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
707
+ toml: ctx.s,
708
+ ptr: sliceStart
709
+ });
710
+ }
504
711
  state = !isLiteral && c === 92 ? 1 : 0;
505
712
  sliceStart = ctx.p;
506
713
  }
507
714
  }
508
- TomlError.x("unfinished string", ctx, startPtr);
509
- }
510
-
511
- // node_modules/smol-toml/dist/date.js
512
- /*!
513
- * Copyright (c) Squirrel Chat et al., All rights reserved.
514
- * SPDX-License-Identifier: BSD-3-Clause
515
- *
516
- * Redistribution and use in source and binary forms, with or without
517
- * modification, are permitted provided that the following conditions are met:
518
- *
519
- * 1. Redistributions of source code must retain the above copyright notice, this
520
- * list of conditions and the following disclaimer.
521
- * 2. Redistributions in binary form must reproduce the above copyright notice,
522
- * this list of conditions and the following disclaimer in the
523
- * documentation and/or other materials provided with the distribution.
524
- * 3. Neither the name of the copyright holder nor the names of its contributors
525
- * may be used to endorse or promote products derived from this software without
526
- * specific prior written permission.
527
- *
528
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
529
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
530
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
531
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
532
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
533
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
534
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
535
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
536
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
537
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
538
- */
539
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
540
-
541
- class TomlDate extends Date {
542
- #hasDate = false;
543
- #hasTime = false;
544
- #offset = null;
545
- constructor(date, fasttype, unsafeDelim) {
546
- let hasDate = true;
547
- let hasTime = true;
548
- let offset = "Z";
549
- let c;
550
- if (typeof date === "string") {
551
- if (fasttype)
552
- prep: {
553
- if (fasttype < 3) {
554
- if (+date.slice(11, 13) > 23) {
555
- date = "";
556
- break prep;
557
- }
558
- if (fasttype === 2) {
559
- offset = null;
560
- date += "Z";
561
- } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
562
- offset = date.slice(date.length - 6);
563
- }
564
- if (unsafeDelim)
565
- date = date.slice(0, 10) + "T" + date.slice(11);
566
- } else if (fasttype === 4) {
567
- date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
568
- }
569
- hasDate = fasttype !== 4;
570
- hasTime = fasttype !== 3;
571
- }
572
- else {
573
- let match = date.match(DATE_TIME_RE);
574
- if (match) {
575
- if (!match[1]) {
576
- hasDate = false;
577
- date = `0000-01-01T${date}`;
578
- }
579
- hasTime = !!match[2];
580
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
581
- if (match[2] && +match[2] > 23) {
582
- date = "";
583
- } else {
584
- offset = match[3] || null;
585
- if (!offset && hasTime)
586
- date += "Z";
587
- }
588
- } else {
589
- date = "";
590
- }
715
+ throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
716
+ }
717
+ function sliceAndTrimEndOf(ctx, start, end) {
718
+ let value = ctx.s.slice(start, end);
719
+ let commentIdx = value.indexOf("#");
720
+ if (commentIdx > 0) {
721
+ skipComment({ s: value, p: commentIdx, d: 0 });
722
+ value = value.slice(0, commentIdx);
723
+ }
724
+ return value.trimEnd();
725
+ }
726
+ function parseValue(ctx, integersAsBigInt, end) {
727
+ let ptr = ctx.p;
728
+ let err = { toml: ctx.s, ptr };
729
+ skipUntil(ctx, 44, end);
730
+ let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
731
+ if (!value)
732
+ throw new TomlError("incomplete declaration: value expected", err);
733
+ if (value === "-inf")
734
+ return -Infinity;
735
+ if (value === "inf" || value === "+inf")
736
+ return Infinity;
737
+ if (value === "nan" || value === "+nan" || value === "-nan")
738
+ return NaN;
739
+ if (value === "-0")
740
+ return integersAsBigInt ? 0n : 0;
741
+ let isInt = INT_REGEX.test(value);
742
+ if (isInt || FLOAT_REGEX.test(value)) {
743
+ if (LEADING_ZERO.test(value)) {
744
+ throw new TomlError("leading zeroes are not allowed", err);
745
+ }
746
+ value = value.replace(/_/g, "");
747
+ let numeric = +value;
748
+ if (isNaN(numeric)) {
749
+ throw new TomlError("invalid number", err);
750
+ }
751
+ if (isInt) {
752
+ if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
753
+ throw new TomlError("integer value cannot be represented losslessly", err);
591
754
  }
755
+ if (isInt || integersAsBigInt === true)
756
+ numeric = BigInt(value);
592
757
  }
593
- super(date);
594
- if (!isNaN(this.getTime())) {
595
- this.#hasDate = hasDate;
596
- this.#hasTime = hasTime;
597
- this.#offset = offset;
598
- }
599
- }
600
- isDateTime() {
601
- return this.#hasDate && this.#hasTime;
602
- }
603
- isLocal() {
604
- return !this.#hasDate || !this.#hasTime || !this.#offset;
605
- }
606
- isDate() {
607
- return this.#hasDate && !this.#hasTime;
608
- }
609
- isTime() {
610
- return this.#hasTime && !this.#hasDate;
611
- }
612
- isValid() {
613
- return this.#hasDate || this.#hasTime;
614
- }
615
- toISOString() {
616
- let iso = super.toISOString();
617
- if (this.isDate())
618
- return iso.slice(0, 10);
619
- if (this.isTime())
620
- return iso.slice(11, 23);
621
- if (this.#offset === null)
622
- return iso.slice(0, -1);
623
- if (this.#offset === "Z" || this.#offset === "z")
624
- return iso;
625
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
626
- offset = this.#offset[0] === "-" ? offset : -offset;
627
- let offsetDate = new Date(this.getTime() - offset * 60000);
628
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
629
- }
630
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
631
- let date = new TomlDate(jsDate);
632
- date.#offset = offset;
633
- return date;
634
- }
635
- static wrapAsLocalDateTime(jsDate) {
636
- let date = new TomlDate(jsDate);
637
- date.#offset = null;
638
- return date;
639
- }
640
- static wrapAsLocalDate(jsDate) {
641
- let date = new TomlDate(jsDate);
642
- date.#hasTime = false;
643
- date.#offset = null;
644
- return date;
645
- }
646
- static wrapAsLocalTime(jsDate) {
647
- let date = new TomlDate(jsDate);
648
- date.#hasDate = false;
649
- date.#offset = null;
650
- return date;
758
+ return numeric;
651
759
  }
760
+ const date = new TomlDate(value);
761
+ if (!date.isValid())
762
+ throw new TomlError("invalid value", err);
763
+ return date;
652
764
  }
653
765
 
654
766
  // node_modules/smol-toml/dist/extract.js
@@ -679,18 +791,17 @@ class TomlDate extends Date {
679
791
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
680
792
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
681
793
  */
682
- function isDigit(char, base = 10) {
683
- return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
684
- }
685
- function isEndOfValue(char, delim) {
686
- return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
687
- }
688
- function extractValue(ctx, end) {
689
- let errPtr = ctx.p;
690
- let c = ctx.s.charCodeAt(ctx.p);
794
+ function extractValue(ctx, end, integersAsBigInt) {
795
+ let ptr = ctx.p;
796
+ let c = ctx.s.charCodeAt(ptr);
691
797
  if (c === 91 || c === 123) {
692
- ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
693
- let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
798
+ if (!ctx.d--) {
799
+ throw new TomlError("document contains excessively nested structures. aborting.", {
800
+ toml: ctx.s,
801
+ ptr
802
+ });
803
+ }
804
+ let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
694
805
  ctx.d++;
695
806
  return value;
696
807
  }
@@ -699,243 +810,17 @@ function extractValue(ctx, end) {
699
810
  }
700
811
  if (c === 116) {
701
812
  if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
702
- TomlError.x("invalid value", ctx, errPtr);
703
- return ctx.p++, true;
813
+ throw new TomlError("invalid value", { toml: ctx.s, ptr });
814
+ ctx.p++;
815
+ return true;
704
816
  }
705
817
  if (c === 102) {
706
818
  if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
707
- TomlError.x("invalid value", ctx, errPtr);
708
- return ctx.p++, false;
709
- }
710
- if (c === 43 || c === 45) {
711
- return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
712
- }
713
- if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
714
- return parseDate(ctx, c, end);
715
- }
716
- if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
717
- return parseTime(ctx, c, end);
718
- }
719
- return parseNumber(ctx, ctx.p, c, 0, end);
720
- }
721
- function parseNumber(ctx, startPtr, startChr, sign, endChr) {
722
- let c = startChr;
723
- let state = 0;
724
- let hasUnderscores = false;
725
- if (c === 105) {
726
- if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
727
- TomlError.x("invalid value", ctx, startPtr);
728
- return ctx.p++, (sign || 1) / 0;
729
- }
730
- if (c === 110) {
731
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
732
- TomlError.x("invalid value", ctx, startPtr);
733
- return ctx.p++, NaN;
734
- }
735
- if (c === 48) {
736
- if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
737
- return ctx.bi === true ? 0n : 0;
738
- if (!sign) {
739
- if (c === 120)
740
- return parseIntegerBaseN(ctx, startPtr, 16, endChr);
741
- else if (c === 98)
742
- return parseIntegerBaseN(ctx, startPtr, 2, endChr);
743
- else if (c === 111)
744
- return parseIntegerBaseN(ctx, startPtr, 8, endChr);
745
- }
746
- if (c === 46)
747
- state = 2;
748
- else if (c === 101 || c === 69)
749
- state = 4;
750
- else
751
- TomlError.x("illegal leading zero", ctx, startPtr);
752
- } else if (!isDigit(c))
753
- TomlError.x("invalid value", ctx, startPtr);
754
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
755
- if (!state)
756
- state = 1;
757
- if (c === 95) {
758
- if (!(state & 1))
759
- TomlError.x("illegal underscore", ctx);
760
- state += 11;
761
- hasUnderscores = true;
762
- } else if (state === 1 && c === 46)
763
- state = 2;
764
- else if ((state === 1 || state === 3) && (c === 101 || c === 69))
765
- state = 4;
766
- else if (state === 4 && (c === 43 || c === 45)) {
767
- state = 6;
768
- } else if (!isDigit(c))
769
- TomlError.x(`illegal character in numeric literal`, ctx);
770
- else if (state > 9)
771
- state -= 11;
772
- else if (!(state & 1))
773
- state++;
774
- }
775
- if (!state) {
776
- let val = (startChr - 48) * (sign || 1);
777
- return ctx.bi === true ? BigInt(val) : val;
778
- }
779
- if (!(state & 1))
780
- TomlError.x("unfinished numeric value", ctx, startPtr);
781
- let str = ctx.s.slice(startPtr, ctx.p);
782
- if (hasUnderscores)
783
- str = str.replaceAll("_", "");
784
- return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
785
- }
786
- function parseIntegerBaseN(ctx, startPtr, base, endChr) {
787
- let c, underscore = 1;
788
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
789
- if (c === 95) {
790
- if (underscore & 1)
791
- TomlError.x("illegal underscore", ctx);
792
- underscore = 3;
793
- } else if (!isDigit(c, base))
794
- TomlError.x(`illegal character in numeric literal`, ctx);
795
- else if (underscore & 1)
796
- underscore--;
797
- }
798
- if (underscore & 1)
799
- TomlError.x("unfinished numeric value", ctx);
800
- let str = ctx.s.slice(startPtr + 2, ctx.p);
801
- if (underscore)
802
- str = str.replaceAll("_", "");
803
- return parseInteger(ctx, str, base, startPtr);
804
- }
805
- function parseInteger(ctx, str, base, startPtr) {
806
- if (ctx.bi !== true)
807
- int: {
808
- let val = parseInt(str, base);
809
- if (!Number.isSafeInteger(val)) {
810
- if (ctx.bi)
811
- break int;
812
- TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
813
- }
814
- return val;
815
- }
816
- return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
817
- }
818
- function parseDate(ctx, c, endChr) {
819
- let startPtr = ctx.p++, unsafeSeparator;
820
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
821
- return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
822
- }
823
- ctx.p += 5;
824
- if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
825
- TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
826
- if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
827
- let t2 = ctx.s.slice(startPtr, ctx.p);
828
- return readDate(ctx, t2, 3, false, startPtr);
829
- }
830
- if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
831
- TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
832
- if (ctx.s.charCodeAt(ctx.p += 3) === 58)
833
- ctx.p += 3;
834
- if (ctx.s.charCodeAt(ctx.p) === 46)
835
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
836
- ;
837
- if (c = ctx.s.charCodeAt(ctx.p)) {
838
- if (c === 90 || c === 122) {
839
- let t2 = ctx.s.slice(startPtr, ++ctx.p);
840
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
841
- }
842
- if (c === 43 || c === 45) {
843
- let t2 = ctx.s.slice(startPtr, ctx.p += 6);
844
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
845
- }
846
- }
847
- let t = ctx.s.slice(startPtr, ctx.p);
848
- return readDate(ctx, t, 2, unsafeSeparator, startPtr);
849
- }
850
- function parseTime(ctx, c, endChr) {
851
- let start = ctx.p;
852
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
853
- return parseNumber(ctx, --ctx.p, c, 0, endChr);
854
- }
855
- if (ctx.s.charCodeAt(ctx.p += 4) === 58)
856
- ctx.p += 3;
857
- if (ctx.s.charCodeAt(ctx.p) === 46)
858
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
859
- ;
860
- let t = ctx.s.slice(start, ctx.p);
861
- return readDate(ctx, t, 4, false, start);
862
- }
863
- function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
864
- if (ctx.ld) {
865
- let date = new TomlDate(str, type, unsafeDelim);
866
- if (!date.isValid())
867
- TomlError.x("invalid date", ctx, errPtr);
868
- return date;
869
- }
870
- try {
871
- if (temporalSuffix)
872
- str += temporalSuffix;
873
- switch (type) {
874
- case 1:
875
- return Temporal.ZonedDateTime.from(str);
876
- case 2:
877
- return Temporal.PlainDateTime.from(str);
878
- case 3:
879
- return Temporal.PlainDate.from(str);
880
- case 4:
881
- return Temporal.PlainTime.from(str);
882
- }
883
- } catch (e) {
884
- TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
885
- }
886
- }
887
-
888
- // node_modules/smol-toml/dist/util.js
889
- /*!
890
- * Copyright (c) Squirrel Chat et al., All rights reserved.
891
- * SPDX-License-Identifier: BSD-3-Clause
892
- *
893
- * Redistribution and use in source and binary forms, with or without
894
- * modification, are permitted provided that the following conditions are met:
895
- *
896
- * 1. Redistributions of source code must retain the above copyright notice, this
897
- * list of conditions and the following disclaimer.
898
- * 2. Redistributions in binary form must reproduce the above copyright notice,
899
- * this list of conditions and the following disclaimer in the
900
- * documentation and/or other materials provided with the distribution.
901
- * 3. Neither the name of the copyright holder nor the names of its contributors
902
- * may be used to endorse or promote products derived from this software without
903
- * specific prior written permission.
904
- *
905
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
906
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
907
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
908
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
909
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
910
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
911
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
912
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
913
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
914
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
915
- */
916
- function skipComment(ctx) {
917
- for (;ctx.p < ctx.s.length; ctx.p++) {
918
- let c = ctx.s.charCodeAt(ctx.p);
919
- if (c === 10)
920
- break;
921
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
922
- ctx.p++;
923
- break;
924
- }
925
- if (c < 32 && c !== 9 || c === 127) {
926
- TomlError.x("control characters are not allowed in comments", ctx);
927
- }
928
- }
929
- }
930
- function skipVoid(ctx, banNewLines, banComments) {
931
- let c;
932
- while (ctx.p < ctx.s.length) {
933
- while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
934
- ctx.p++;
935
- if (banComments || c !== 35)
936
- break;
937
- skipComment(ctx);
819
+ throw new TomlError("invalid value", { toml: ctx.s, ptr });
820
+ ctx.p++;
821
+ return false;
938
822
  }
823
+ return parseValue(ctx, integersAsBigInt, end);
939
824
  }
940
825
 
941
826
  // node_modules/smol-toml/dist/struct.js
@@ -966,50 +851,76 @@ function skipVoid(ctx, banNewLines, banComments) {
966
851
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
967
852
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
968
853
  */
969
- function parseKey(ctx, end = 61) {
970
- let startPtr;
971
- let state = 0;
854
+ var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
855
+ function parseKey(ctx, end = "=") {
856
+ let start = ctx.p;
857
+ let dot = start - 1;
972
858
  let parsed = [];
973
- let sliceStart;
974
- let c = ctx.s.charCodeAt(startPtr = ctx.p);
859
+ let endPtr = ctx.s.indexOf(end, start);
860
+ if (endPtr < 0) {
861
+ throw new TomlError("incomplete key-value: cannot find end of key", {
862
+ toml: ctx.s,
863
+ ptr: start
864
+ });
865
+ }
975
866
  do {
976
- if (c === end) {
977
- if (!state)
978
- TomlError.x("unexpected end of key", ctx);
979
- if (state === 1)
980
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
981
- return ctx.p++, parsed;
982
- } else if (c === 46) {
983
- if (!state)
984
- TomlError.x("illegal empty bare key", ctx);
985
- if (state === 1)
986
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
987
- state = 0;
988
- } else if (!state && (c === 34 || c === 39)) {
989
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
990
- TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
991
- parsed.push(parseString(ctx));
992
- state = 2;
993
- ctx.p--;
994
- } else if (c === 32 || c === 9) {
995
- if (state === 1) {
996
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
997
- state = 2;
867
+ let c = ctx.s.charCodeAt(ctx.p = ++dot);
868
+ if (c !== 32 && c !== 9) {
869
+ if (c === 34 || c === 39) {
870
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
871
+ throw new TomlError("multiline strings are not allowed in keys", {
872
+ toml: ctx.s,
873
+ ptr: ctx.p
874
+ });
875
+ }
876
+ let part = parseString(ctx);
877
+ dot = ctx.s.indexOf(".", ctx.p);
878
+ let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
879
+ let newLine = indexOfNewline(strEnd);
880
+ if (newLine > -1) {
881
+ throw new TomlError("newlines are not allowed in keys", {
882
+ toml: ctx.s,
883
+ ptr: newLine
884
+ });
885
+ }
886
+ if (strEnd.trimStart()) {
887
+ throw new TomlError("found extra tokens after the string part", {
888
+ toml: ctx.s,
889
+ ptr: ctx.p
890
+ });
891
+ }
892
+ if (endPtr < ctx.p) {
893
+ endPtr = ctx.s.indexOf(end, ctx.p);
894
+ if (endPtr < 0) {
895
+ throw new TomlError("incomplete key-value: cannot find end of key", {
896
+ toml: ctx.s,
897
+ ptr: start
898
+ });
899
+ }
900
+ }
901
+ parsed.push(part);
902
+ } else {
903
+ dot = ctx.s.indexOf(".", ctx.p);
904
+ let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
905
+ if (!KEY_PART_RE.test(part)) {
906
+ throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
907
+ toml: ctx.s,
908
+ ptr: ctx.p
909
+ });
910
+ }
911
+ parsed.push(part.trimEnd());
998
912
  }
999
- } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
1000
- TomlError.x("illegal character in key", ctx);
1001
- } else if (!state) {
1002
- state = 1;
1003
- sliceStart = ctx.p;
1004
913
  }
1005
- } while (c = ctx.s.charCodeAt(++ctx.p));
1006
- TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
914
+ } while (dot + 1 && dot < endPtr);
915
+ ctx.p = endPtr + 1;
916
+ skipVoid(ctx, true, true);
917
+ return parsed;
1007
918
  }
1008
- function parseInlineTable(ctx) {
1009
- let startPtr = ctx.p++;
1010
- let res = Object.create(null);
919
+ function parseInlineTable(ctx, integersAsBigInt) {
920
+ let res = {};
1011
921
  let seen = new Set;
1012
922
  let c;
923
+ ctx.p++;
1013
924
  while (ctx.p < ctx.s.length) {
1014
925
  skipVoid(ctx);
1015
926
  if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
@@ -1019,59 +930,66 @@ function parseInlineTable(ctx) {
1019
930
  let k;
1020
931
  let t = res;
1021
932
  let hasOwn = false;
1022
- let errPtr = ctx.p;
933
+ let p = ctx.p;
1023
934
  let key = parseKey(ctx);
1024
935
  for (let i = 0;i < key.length; i++) {
1025
936
  if (i)
1026
- t = hasOwn ? t[k] : t[k] = Object.create(null);
937
+ t = hasOwn ? t[k] : t[k] = {};
1027
938
  k = key[i];
1028
939
  if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
1029
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
1030
- }
1031
- let unsafe = k === "__proto__";
1032
- if (ctx.uk && (unsafe || k === "constructor")) {
1033
- t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
1034
- break;
940
+ throw new TomlError("trying to redefine an already defined value", {
941
+ toml: ctx.s,
942
+ ptr: p
943
+ });
1035
944
  }
1036
- if (!hasOwn && unsafe) {
945
+ if (!hasOwn && k === "__proto__") {
1037
946
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
1038
947
  }
1039
948
  }
1040
949
  if (hasOwn) {
1041
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
950
+ throw new TomlError("trying to redefine an already defined value", {
951
+ toml: ctx.s,
952
+ ptr: ctx.p
953
+ });
1042
954
  }
1043
- skipVoid(ctx, true, true);
1044
- let value = extractValue(ctx, 125);
1045
- if (t && typeof (t[k] = value) === "object")
1046
- seen.add(value);
955
+ let value = extractValue(ctx, 125, integersAsBigInt);
956
+ seen.add(t[k] = value);
1047
957
  skipVoid(ctx);
1048
958
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
1049
959
  return res;
1050
960
  }
1051
- if (c !== 44)
1052
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
961
+ if (c !== 44) {
962
+ throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
963
+ }
1053
964
  }
1054
- TomlError.x("unfinished table", ctx, startPtr);
965
+ throw new TomlError("unfinished table encountered", {
966
+ toml: ctx.s,
967
+ ptr: ctx.p
968
+ });
1055
969
  }
1056
- function parseArray(ctx) {
1057
- let startPtr = ctx.p++;
970
+ function parseArray(ctx, integersAsBigInt) {
1058
971
  let res = [];
1059
972
  let c;
973
+ ctx.p++;
1060
974
  while (ctx.p < ctx.s.length) {
1061
975
  skipVoid(ctx);
1062
976
  if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
1063
977
  ctx.p++;
1064
978
  return res;
1065
979
  }
1066
- res.push(extractValue(ctx, 93));
980
+ res.push(extractValue(ctx, 93, integersAsBigInt));
1067
981
  skipVoid(ctx);
1068
982
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
1069
983
  return res;
1070
984
  }
1071
- if (c !== 44)
1072
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
985
+ if (c !== 44) {
986
+ throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
987
+ }
1073
988
  }
1074
- TomlError.x("unfinished array", ctx, startPtr);
989
+ throw new TomlError("unfinished array encountered", {
990
+ toml: ctx.s,
991
+ ptr: ctx.p
992
+ });
1075
993
  }
1076
994
 
1077
995
  // node_modules/smol-toml/dist/parse.js
@@ -1102,7 +1020,7 @@ function parseArray(ctx) {
1102
1020
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1103
1021
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1104
1022
  */
1105
- function peekTable(ctx, key, table, meta, type) {
1023
+ function peekTable(key, table, meta, type) {
1106
1024
  let t = table;
1107
1025
  let m = meta;
1108
1026
  let k;
@@ -1110,7 +1028,7 @@ function peekTable(ctx, key, table, meta, type) {
1110
1028
  let state;
1111
1029
  for (let i = 0;i < key.length; i++) {
1112
1030
  if (i) {
1113
- t = hasOwn ? t[k] : t[k] = Object.create(null);
1031
+ t = hasOwn ? t[k] : t[k] = {};
1114
1032
  m = (state = m[k]).c;
1115
1033
  if (type === 0 && (state.t === 1 || state.t === 2)) {
1116
1034
  return null;
@@ -1126,10 +1044,7 @@ function peekTable(ctx, key, table, meta, type) {
1126
1044
  return null;
1127
1045
  }
1128
1046
  if (!hasOwn) {
1129
- let unsafe = k === "__proto__";
1130
- if (ctx.uk && (unsafe || k === "constructor"))
1131
- return false;
1132
- if (unsafe) {
1047
+ if (k === "__proto__") {
1133
1048
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
1134
1049
  Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
1135
1050
  }
@@ -1137,7 +1052,7 @@ function peekTable(ctx, key, table, meta, type) {
1137
1052
  t: i < key.length - 1 && type === 2 ? 3 : type,
1138
1053
  d: false,
1139
1054
  i: 0,
1140
- c: Object.create(null)
1055
+ c: {}
1141
1056
  };
1142
1057
  }
1143
1058
  }
@@ -1150,76 +1065,69 @@ function peekTable(ctx, key, table, meta, type) {
1150
1065
  state.d = true;
1151
1066
  t[k] = [];
1152
1067
  }
1153
- t[k].push(t = Object.create(null));
1154
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: Object.create(null) };
1068
+ t[k].push(t = {});
1069
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
1155
1070
  }
1156
1071
  if (state.d) {
1157
1072
  return null;
1158
1073
  }
1159
1074
  state.d = true;
1160
1075
  if (type === 1) {
1161
- t = hasOwn ? t[k] : t[k] = Object.create(null);
1076
+ t = hasOwn ? t[k] : t[k] = {};
1162
1077
  } else if (type === 0 && hasOwn) {
1163
1078
  return null;
1164
1079
  }
1165
1080
  return [k, t, state.c];
1166
1081
  }
1167
- function validateTablePeek(ctx, peek, ptr) {
1168
- if (peek === null || ctx.uk === 2)
1169
- TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
1170
- }
1171
- function parse(toml, options = {}) {
1172
- let ctx = {
1173
- s: toml,
1174
- p: 0,
1175
- d: options.maxDepth ?? 1000,
1176
- bi: options.integersAsBigInt ?? false,
1177
- ld: options.useLegacyDate ?? true,
1178
- uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
1179
- };
1180
- let res = Object.create(null);
1181
- let meta = Object.create(null);
1082
+ function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
1083
+ let ctx = { s: toml, p: 0, d: maxDepth };
1084
+ let res = {};
1085
+ let meta = {};
1182
1086
  let tmp;
1183
- let skipping = false;
1184
1087
  let tbl = res;
1185
1088
  let m = meta;
1186
- if (toml.charCodeAt(0) === 65279)
1187
- ctx.p++;
1188
1089
  skipVoid(ctx);
1189
1090
  while (ctx.p < toml.length) {
1190
1091
  if (toml.charCodeAt(ctx.p) === 91) {
1191
1092
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
1192
1093
  tmp = ctx.p += +isTableArray;
1193
- skipping = false;
1194
- let k = parseKey(ctx, 93);
1094
+ let k = parseKey(ctx, "]");
1195
1095
  if (isTableArray) {
1196
- if (toml.charCodeAt(ctx.p) !== 93) {
1197
- TomlError.x("expected end of table array declaration", ctx);
1096
+ if (toml.charCodeAt(ctx.p - 1) !== 93) {
1097
+ throw new TomlError("expected end of table declaration", {
1098
+ toml,
1099
+ ptr: ctx.p - 1
1100
+ });
1198
1101
  }
1199
1102
  ctx.p++;
1200
1103
  }
1201
- let p = peekTable(ctx, k, res, meta, isTableArray ? 2 : 1);
1104
+ let p = peekTable(k, res, meta, isTableArray ? 2 : 1);
1202
1105
  if (!p) {
1203
- validateTablePeek(ctx, p, tmp);
1204
- skipping = true;
1205
- } else {
1206
- m = p[2];
1207
- tbl = p[1];
1106
+ throw new TomlError("trying to redefine an already defined table or value", {
1107
+ toml,
1108
+ ptr: tmp
1109
+ });
1208
1110
  }
1111
+ m = p[2];
1112
+ tbl = p[1];
1209
1113
  } else {
1210
1114
  tmp = ctx.p;
1211
1115
  let k = parseKey(ctx);
1212
- let p = peekTable(ctx, k, tbl, m, 0);
1213
- if (!p && !skipping)
1214
- validateTablePeek(ctx, p, tmp);
1215
- skipVoid(ctx, true, true);
1216
- let v = extractValue(ctx, undefined);
1217
- if (p && !skipping)
1218
- p[1][p[0]] = v;
1116
+ let p = peekTable(k, tbl, m, 0);
1117
+ if (!p) {
1118
+ throw new TomlError("trying to redefine an already defined table or value", {
1119
+ toml,
1120
+ ptr: tmp
1121
+ });
1122
+ }
1123
+ p[1][p[0]] = extractValue(ctx, undefined, integersAsBigInt);
1219
1124
  }
1220
1125
  skipVoid(ctx, true);
1221
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
1222
- TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
1126
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
1127
+ throw new TomlError("each key-value declaration must be followed by an end-of-line", {
1128
+ toml,
1129
+ ptr: ctx.p
1130
+ });
1223
1131
  }
1224
1132
  skipVoid(ctx);
1225
1133
  }
@@ -1254,7 +1162,6 @@ function parse(toml, options = {}) {
1254
1162
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1255
1163
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1256
1164
  */
1257
- var HAS_WELLFORMED = !!"".isWellFormed;
1258
1165
 
1259
1166
  // node_modules/smol-toml/dist/index.js
1260
1167
  /*!