@cloudflare/vitest-plugin 1.2.5 → 1.2.7

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.
@@ -528,7 +528,7 @@ __export(core_exports2, {
528
528
  isValidJWT: () => isValidJWT,
529
529
  locales: () => locales_exports,
530
530
  meta: () => meta,
531
- parse: () => parse$7,
531
+ parse: () => parse$6,
532
532
  parseAsync: () => parseAsync,
533
533
  prettifyError: () => prettifyError,
534
534
  process: () => process$2,
@@ -1363,7 +1363,7 @@ var _parse = /* @__PURE__ */ __name$3((_Err) => (schema, value, _ctx, _params) =
1363
1363
  }
1364
1364
  return result.value;
1365
1365
  }, "_parse");
1366
- var parse$7 = /* @__PURE__ */ _parse($ZodRealError);
1366
+ var parse$6 = /* @__PURE__ */ _parse($ZodRealError);
1367
1367
  var _parseAsync = /* @__PURE__ */ __name$3((_Err) => async (schema, value, _ctx, params) => {
1368
1368
  const ctx = _ctx ? {
1369
1369
  ..._ctx,
@@ -3916,9 +3916,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
3916
3916
  inst.implement = (func) => {
3917
3917
  if (typeof func !== "function") throw new Error("implement() must be called with a function");
3918
3918
  return function(...args) {
3919
- const parsedArgs = inst._def.input ? parse$7(inst._def.input, args) : args;
3919
+ const parsedArgs = inst._def.input ? parse$6(inst._def.input, args) : args;
3920
3920
  const result = Reflect.apply(func, this, parsedArgs);
3921
- if (inst._def.output) return parse$7(inst._def.output, result);
3921
+ if (inst._def.output) return parse$6(inst._def.output, result);
3922
3922
  return result;
3923
3923
  };
3924
3924
  };
@@ -13846,16 +13846,17 @@ function createFatalError$1(message, isJson, options) {
13846
13846
  __name$3(createFatalError$1, "createFatalError");
13847
13847
 
13848
13848
  //#endregion
13849
- //#region ../workers-utils/dist/chunk-IKXB77SR.mjs
13849
+ //#region ../workers-utils/dist/chunk-FLRJ77A6.mjs
13850
13850
  function hasKnownExportType(entry) {
13851
13851
  const type = entry?.type;
13852
- return type === "durable-object" || type === "worker";
13852
+ return type === "durable-object" || type === "worker" || type === "workflow";
13853
13853
  }
13854
13854
  __name$3(hasKnownExportType, "hasKnownExportType");
13855
13855
  function partitionExports(exports$1) {
13856
13856
  const partitioned = {
13857
13857
  "durable-object": {},
13858
- worker: {}
13858
+ worker: {},
13859
+ workflow: {}
13859
13860
  };
13860
13861
  if (exports$1 === void 0) return partitioned;
13861
13862
  for (const [name, entry] of Object.entries(exports$1)) {
@@ -13865,6 +13866,11 @@ function partitionExports(exports$1) {
13865
13866
  return partitioned;
13866
13867
  }
13867
13868
  __name$3(partitionExports, "partitionExports");
13869
+ function isLiveDurableObjectExport(exportConfig) {
13870
+ const state = exportConfig.state ?? "created";
13871
+ return state === "created" || state === "expecting-transfer";
13872
+ }
13873
+ __name$3(isLiveDurableObjectExport, "isLiveDurableObjectExport");
13868
13874
  function getDurableObjectExports(exports$1) {
13869
13875
  return partitionExports(exports$1)["durable-object"];
13870
13876
  }
@@ -13939,7 +13945,7 @@ function getDurableObjectClassNameToUseSQLiteMap(migrations, exports$1) {
13939
13945
  const durableObjectExports = getDurableObjectExports(exports$1 ?? {});
13940
13946
  for (const [className, entry] of Object.entries(durableObjectExports)) {
13941
13947
  if (entry.type !== "durable-object") continue;
13942
- if (entry.state === void 0 || entry.state === "created" || entry.state === "expecting-transfer") durableObjectClassNameToUseSQLiteMap.set(className, entry.storage === "sqlite");
13948
+ if (isLiveDurableObjectExport(entry)) durableObjectClassNameToUseSQLiteMap.set(className, entry.storage === "sqlite");
13943
13949
  }
13944
13950
  return durableObjectClassNameToUseSQLiteMap;
13945
13951
  }
@@ -14512,7 +14518,7 @@ var ParseOptions;
14512
14518
  (function(ParseOptions2) {
14513
14519
  ParseOptions2.DEFAULT = { allowTrailingComma: false };
14514
14520
  })(ParseOptions || (ParseOptions = {}));
14515
- function parse$6(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14521
+ function parse$5(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14516
14522
  let currentProperty = null;
14517
14523
  let currentParent = [];
14518
14524
  const previousParents = [];
@@ -14556,7 +14562,7 @@ function parse$6(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14556
14562
  }, options);
14557
14563
  return currentParent[0];
14558
14564
  }
14559
- __name$3(parse$6, "parse");
14565
+ __name$3(parse$5, "parse");
14560
14566
  function parseTree(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14561
14567
  let currentParent = {
14562
14568
  type: "array",
@@ -14733,15 +14739,15 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14733
14739
  }
14734
14740
  }
14735
14741
  __name$3(scanNext, "scanNext");
14736
- function handleError(error$2, skipUntilAfter = [], skipUntil2 = []) {
14742
+ function handleError(error$2, skipUntilAfter = [], skipUntil = []) {
14737
14743
  onError$2(error$2);
14738
- if (skipUntilAfter.length + skipUntil2.length > 0) {
14744
+ if (skipUntilAfter.length + skipUntil.length > 0) {
14739
14745
  let token = _scanner.getToken();
14740
14746
  while (token !== 17) {
14741
14747
  if (skipUntilAfter.indexOf(token) !== -1) {
14742
14748
  scanNext();
14743
14749
  break;
14744
- } else if (skipUntil2.indexOf(token) !== -1) break;
14750
+ } else if (skipUntil.indexOf(token) !== -1) break;
14745
14751
  token = scanNext();
14746
14752
  }
14747
14753
  }
@@ -14793,7 +14799,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14793
14799
  if (_scanner.getToken() === 6) {
14794
14800
  onSeparator(":");
14795
14801
  scanNext();
14796
- if (!parseValue2()) handleError(4, [], [2, 5]);
14802
+ if (!parseValue()) handleError(4, [], [2, 5]);
14797
14803
  } else handleError(5, [], [2, 5]);
14798
14804
  _jsonPath.pop();
14799
14805
  return true;
@@ -14835,7 +14841,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14835
14841
  _jsonPath.push(0);
14836
14842
  isFirstElement = false;
14837
14843
  } else _jsonPath[_jsonPath.length - 1]++;
14838
- if (!parseValue2()) handleError(4, [], [4, 5]);
14844
+ if (!parseValue()) handleError(4, [], [4, 5]);
14839
14845
  needsComma = true;
14840
14846
  }
14841
14847
  onArrayEnd();
@@ -14845,7 +14851,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14845
14851
  return true;
14846
14852
  }
14847
14853
  __name$3(parseArray2, "parseArray");
14848
- function parseValue2() {
14854
+ function parseValue() {
14849
14855
  switch (_scanner.getToken()) {
14850
14856
  case 3: return parseArray2();
14851
14857
  case 1: return parseObject();
@@ -14853,14 +14859,14 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14853
14859
  default: return parseLiteral();
14854
14860
  }
14855
14861
  }
14856
- __name$3(parseValue2, "parseValue");
14862
+ __name$3(parseValue, "parseValue");
14857
14863
  scanNext();
14858
14864
  if (_scanner.getToken() === 17) {
14859
14865
  if (options.allowEmptyContent) return true;
14860
14866
  handleError(4, [], []);
14861
14867
  return false;
14862
14868
  }
14863
- if (!parseValue2()) {
14869
+ if (!parseValue()) {
14864
14870
  handleError(4, [], []);
14865
14871
  return false;
14866
14872
  }
@@ -15084,7 +15090,7 @@ var SyntaxKind;
15084
15090
  SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
15085
15091
  SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
15086
15092
  })(SyntaxKind || (SyntaxKind = {}));
15087
- var parse2 = parse$6;
15093
+ var parse2 = parse$5;
15088
15094
  var ParseErrorCode;
15089
15095
  (function(ParseErrorCode2) {
15090
15096
  ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
@@ -15150,97 +15156,13 @@ function applyEdits(text, edits) {
15150
15156
  return text;
15151
15157
  }
15152
15158
  __name$3(applyEdits, "applyEdits");
15153
- var DATE_TIME_RE$1 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
15154
- var TomlDate$1 = class _TomlDate extends Date {
15155
- static {
15156
- __name$3(this, "TomlDate");
15157
- }
15158
- #hasDate = false;
15159
- #hasTime = false;
15160
- #offset = null;
15161
- constructor(date$1) {
15162
- let hasDate = true;
15163
- let hasTime = true;
15164
- let offset = "Z";
15165
- if (typeof date$1 === "string") {
15166
- let match = date$1.match(DATE_TIME_RE$1);
15167
- if (match) {
15168
- if (!match[1]) {
15169
- hasDate = false;
15170
- date$1 = `0000-01-01T${date$1}`;
15171
- }
15172
- hasTime = !!match[2];
15173
- hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
15174
- if (match[2] && +match[2] > 23) date$1 = "";
15175
- else {
15176
- offset = match[3] || null;
15177
- date$1 = date$1.toUpperCase();
15178
- if (!offset && hasTime) date$1 += "Z";
15179
- }
15180
- } else date$1 = "";
15181
- }
15182
- super(date$1);
15183
- if (!isNaN(this.getTime())) {
15184
- this.#hasDate = hasDate;
15185
- this.#hasTime = hasTime;
15186
- this.#offset = offset;
15187
- }
15188
- }
15189
- isDateTime() {
15190
- return this.#hasDate && this.#hasTime;
15191
- }
15192
- isLocal() {
15193
- return !this.#hasDate || !this.#hasTime || !this.#offset;
15194
- }
15195
- isDate() {
15196
- return this.#hasDate && !this.#hasTime;
15197
- }
15198
- isTime() {
15199
- return this.#hasTime && !this.#hasDate;
15200
- }
15201
- isValid() {
15202
- return this.#hasDate || this.#hasTime;
15203
- }
15204
- toISOString() {
15205
- let iso = super.toISOString();
15206
- if (this.isDate()) return iso.slice(0, 10);
15207
- if (this.isTime()) return iso.slice(11, 23);
15208
- if (this.#offset === null) return iso.slice(0, -1);
15209
- if (this.#offset === "Z") return iso;
15210
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15211
- offset = this.#offset[0] === "-" ? offset : -offset;
15212
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15213
- }
15214
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15215
- let date$1 = new _TomlDate(jsDate);
15216
- date$1.#offset = offset;
15217
- return date$1;
15218
- }
15219
- static wrapAsLocalDateTime(jsDate) {
15220
- let date$1 = new _TomlDate(jsDate);
15221
- date$1.#offset = null;
15222
- return date$1;
15223
- }
15224
- static wrapAsLocalDate(jsDate) {
15225
- let date$1 = new _TomlDate(jsDate);
15226
- date$1.#hasTime = false;
15227
- date$1.#offset = null;
15228
- return date$1;
15229
- }
15230
- static wrapAsLocalTime(jsDate) {
15231
- let date$1 = new _TomlDate(jsDate);
15232
- date$1.#hasDate = false;
15233
- date$1.#offset = null;
15234
- return date$1;
15235
- }
15236
- };
15237
- function getLineColFromPtr$1(string$1, ptr) {
15238
- let lines = string$1.slice(0, ptr).split(/\r\n|\n|\r/g);
15159
+ function getLineColFromPtr(string$1, ptr) {
15160
+ let lines = string$1.slice(0, ptr).split(/\r?\n/);
15239
15161
  return [lines.length, lines.pop().length + 1];
15240
15162
  }
15241
- __name$3(getLineColFromPtr$1, "getLineColFromPtr");
15242
- function makeCodeBlock$1(string$1, line, column) {
15243
- let lines = string$1.split(/\r\n|\n|\r/g);
15163
+ __name$3(getLineColFromPtr, "getLineColFromPtr");
15164
+ function makeCodeBlock(string$1, line, column) {
15165
+ let lines = string$1.split(/\r?\n/);
15244
15166
  let codeblock = "";
15245
15167
  let numberLen = (Math.log10(line + 1) | 0) + 1;
15246
15168
  for (let i = line - 1; i <= line + 1; i++) {
@@ -15257,8 +15179,8 @@ function makeCodeBlock$1(string$1, line, column) {
15257
15179
  }
15258
15180
  return codeblock;
15259
15181
  }
15260
- __name$3(makeCodeBlock$1, "makeCodeBlock");
15261
- var TomlError$1 = class extends Error {
15182
+ __name$3(makeCodeBlock, "makeCodeBlock");
15183
+ var TomlError = class _TomlError extends Error {
15262
15184
  static {
15263
15185
  __name$3(this, "TomlError");
15264
15186
  }
@@ -15266,8 +15188,8 @@ var TomlError$1 = class extends Error {
15266
15188
  column;
15267
15189
  codeblock;
15268
15190
  constructor(message, options) {
15269
- const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
15270
- const codeblock = makeCodeBlock$1(options.toml, line, column);
15191
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
15192
+ const codeblock = makeCodeBlock(options.toml, line, column);
15271
15193
  super(`Invalid TOML document: ${message}
15272
15194
 
15273
15195
  ${codeblock}`, options);
@@ -15275,60 +15197,16 @@ ${codeblock}`, options);
15275
15197
  this.column = column;
15276
15198
  this.codeblock = codeblock;
15277
15199
  }
15278
- };
15279
- function indexOfNewline$1(str, start = 0) {
15280
- let idx = str.indexOf("\n", start);
15281
- if (str.charCodeAt(idx - 1) === 13) idx--;
15282
- return idx;
15283
- }
15284
- __name$3(indexOfNewline$1, "indexOfNewline");
15285
- function skipComment$1(ctx) {
15286
- for (; ctx.p < ctx.s.length; ctx.p++) {
15287
- let c$1 = ctx.s.charCodeAt(ctx.p);
15288
- if (c$1 === 10) break;
15289
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15290
- ctx.p++;
15291
- break;
15292
- }
15293
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in comments", {
15200
+ /** @internal */
15201
+ static x(message, ctx, ptr) {
15202
+ throw new _TomlError(message, {
15294
15203
  toml: ctx.s,
15295
- ptr: ctx.p
15204
+ ptr: ptr ?? ctx.p
15296
15205
  });
15297
15206
  }
15298
- }
15299
- __name$3(skipComment$1, "skipComment");
15300
- function skipVoid$1(ctx, banNewLines, banComments) {
15301
- let c$1;
15302
- while (1) {
15303
- while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
15304
- if (banComments || c$1 !== 35) break;
15305
- skipComment$1(ctx);
15306
- }
15307
- }
15308
- __name$3(skipVoid$1, "skipVoid");
15309
- function skipUntil$1(ctx, sep, end) {
15310
- let ptr = ctx.p;
15311
- if (!end) {
15312
- ptr = indexOfNewline$1(ctx.s, ptr);
15313
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
15314
- return;
15315
- }
15316
- for (; ctx.p < ctx.s.length; ctx.p++) {
15317
- let c$1 = ctx.s.charCodeAt(ctx.p);
15318
- if (c$1 === 35) skipComment$1(ctx);
15319
- else if (c$1 === end || c$1 === sep) return;
15320
- }
15321
- throw new TomlError$1("cannot find end of structure", {
15322
- toml: ctx.s,
15323
- ptr
15324
- });
15325
- }
15326
- __name$3(skipUntil$1, "skipUntil");
15327
- var INT_REGEX$1 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
15328
- var FLOAT_REGEX$1 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
15329
- var LEADING_ZERO$1 = /^[+-]?0[0-9_]/;
15330
- function parseString$1(ctx) {
15331
- let start = ctx.p;
15207
+ };
15208
+ function parseString(ctx) {
15209
+ let startPtr = ctx.p;
15332
15210
  let c$1 = ctx.s.charCodeAt(ctx.p++);
15333
15211
  let first = c$1;
15334
15212
  let isLiteral = c$1 === 39;
@@ -15343,16 +15221,16 @@ function parseString$1(ctx) {
15343
15221
  for (; ctx.p < ctx.s.length; ctx.p++) {
15344
15222
  c$1 = ctx.s.charCodeAt(ctx.p);
15345
15223
  if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
15346
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in strings", {
15347
- toml: ctx.s,
15348
- ptr: ctx.p
15349
- });
15224
+ else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in strings", ctx);
15350
15225
  else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
15351
15226
  if (isMultiline) {
15352
15227
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15353
15228
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15354
15229
  }
15355
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
15230
+ if (!state) {
15231
+ let s = ctx.s.slice(sliceStart, ctx.p);
15232
+ parsed = parsed ? parsed + s : s;
15233
+ }
15356
15234
  ctx.p += isMultiline ? 3 : 1;
15357
15235
  return parsed;
15358
15236
  } else if (!state) {
@@ -15361,25 +15239,20 @@ function parseString$1(ctx) {
15361
15239
  state = 1;
15362
15240
  }
15363
15241
  } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
15242
+ let errPtr = ctx.p++ - 1;
15364
15243
  let value = 0;
15365
15244
  let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
15366
15245
  for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
15367
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
15246
+ let hex$1 = ctx.s.charCodeAt(ctx.p);
15368
15247
  let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
15369
- if (digit < 0) throw new TomlError$1("invalid non-hex character in unicode escape", {
15370
- toml: ctx.s,
15371
- ptr: ctx.p + 1
15372
- });
15248
+ if (digit < 0) TomlError.x("invalid non-hex character in unicode escape", ctx);
15373
15249
  value = value << 4 | digit;
15374
15250
  }
15375
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError$1("invalid unicode escape", {
15376
- toml: ctx.s,
15377
- ptr: ctx.p
15378
- });
15251
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) TomlError.x("invalid unicode escape", ctx, errPtr);
15379
15252
  parsed += String.fromCodePoint(value);
15380
- sliceStart = ctx.p + 1;
15253
+ sliceStart = ctx.p--;
15381
15254
  state = 0;
15382
- } else if (c$1 === 32 || c$1 === 9) state = 2;
15255
+ } else if (isMultiline && (c$1 === 32 || c$1 === 9)) state = 2;
15383
15256
  else {
15384
15257
  if (c$1 === 98) parsed += "\b";
15385
15258
  else if (c$1 === 116) parsed += " ";
@@ -15389,162 +15262,326 @@ function parseString$1(ctx) {
15389
15262
  else if (c$1 === 101) parsed += "\x1B";
15390
15263
  else if (c$1 === 34) parsed += "\"";
15391
15264
  else if (c$1 === 92) parsed += "\\";
15392
- else throw new TomlError$1("unrecognized escape sequence", {
15393
- toml: ctx.s,
15394
- ptr: ctx.p
15395
- });
15265
+ else TomlError.x("unrecognised escape sequence", ctx);
15396
15266
  sliceStart = ctx.p + 1;
15397
15267
  state = 0;
15398
15268
  }
15399
15269
  else if (c$1 !== 32 && c$1 !== 9) {
15400
- if (state === 2) throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
15401
- toml: ctx.s,
15402
- ptr: sliceStart
15403
- });
15270
+ if (state === 2) TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
15404
15271
  state = !isLiteral && c$1 === 92 ? 1 : 0;
15405
15272
  sliceStart = ctx.p;
15406
15273
  }
15407
15274
  }
15408
- throw new TomlError$1("unfinished string", {
15409
- toml: ctx.s,
15410
- ptr: start
15411
- });
15412
- }
15413
- __name$3(parseString$1, "parseString");
15414
- function sliceAndTrimEndOf$1(ctx, start, end) {
15415
- let value = ctx.s.slice(start, end);
15416
- let commentIdx = value.indexOf("#");
15417
- if (commentIdx > 0) {
15418
- skipComment$1({
15419
- s: value,
15420
- p: commentIdx
15421
- });
15422
- value = value.slice(0, commentIdx);
15423
- }
15424
- return value.trimEnd();
15425
- }
15426
- __name$3(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
15427
- function parseValue$1(ctx, integersAsBigInt, end) {
15428
- let ptr = ctx.p;
15429
- let err = {
15430
- toml: ctx.s,
15431
- ptr
15432
- };
15433
- skipUntil$1(ctx, 44, end);
15434
- let value = sliceAndTrimEndOf$1(ctx, ptr, ctx.p);
15435
- if (!value) throw new TomlError$1("incomplete declaration: value expected", err);
15436
- if (value === "-inf") return -Infinity;
15437
- if (value === "inf" || value === "+inf") return Infinity;
15438
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
15439
- if (value === "-0") return integersAsBigInt ? 0n : 0;
15440
- let isInt = INT_REGEX$1.test(value);
15441
- if (isInt || FLOAT_REGEX$1.test(value)) {
15442
- if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", err);
15443
- value = value.replace(/_/g, "");
15444
- let numeric$1 = +value;
15445
- if (isNaN(numeric$1)) throw new TomlError$1("invalid number", err);
15446
- if (isInt) {
15447
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", err);
15448
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
15275
+ TomlError.x("unfinished string", ctx, startPtr);
15276
+ }
15277
+ __name$3(parseString, "parseString");
15278
+ 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;
15279
+ var TomlDate = class _TomlDate extends Date {
15280
+ static {
15281
+ __name$3(this, "TomlDate");
15282
+ }
15283
+ #hasDate = false;
15284
+ #hasTime = false;
15285
+ #offset = null;
15286
+ constructor(date$1, fasttype, unsafeDelim) {
15287
+ let hasDate = true;
15288
+ let hasTime = true;
15289
+ let offset = "Z";
15290
+ let c$1;
15291
+ if (typeof date$1 === "string") if (fasttype) prep: {
15292
+ if (fasttype < 3) {
15293
+ if (+date$1.slice(11, 13) > 23) {
15294
+ date$1 = "";
15295
+ break prep;
15296
+ }
15297
+ if (fasttype === 2) {
15298
+ offset = null;
15299
+ date$1 += "Z";
15300
+ } else if ((c$1 = date$1.charCodeAt(date$1.length - 1)) !== 90 && c$1 !== 122) offset = date$1.slice(date$1.length - 6);
15301
+ if (unsafeDelim) date$1 = date$1.slice(0, 10) + "T" + date$1.slice(11);
15302
+ } else if (fasttype === 4) date$1 = +date$1.slice(0, 2) > 23 ? "" : `0000-01-01T${date$1}Z`;
15303
+ hasDate = fasttype !== 4;
15304
+ hasTime = fasttype !== 3;
15305
+ }
15306
+ else {
15307
+ let match = date$1.match(DATE_TIME_RE);
15308
+ if (match) {
15309
+ if (!match[1]) {
15310
+ hasDate = false;
15311
+ date$1 = `0000-01-01T${date$1}`;
15312
+ }
15313
+ hasTime = !!match[2];
15314
+ hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
15315
+ if (match[2] && +match[2] > 23) date$1 = "";
15316
+ else {
15317
+ offset = match[3] || null;
15318
+ if (!offset && hasTime) date$1 += "Z";
15319
+ }
15320
+ } else date$1 = "";
15321
+ }
15322
+ super(date$1);
15323
+ if (!isNaN(this.getTime())) {
15324
+ this.#hasDate = hasDate;
15325
+ this.#hasTime = hasTime;
15326
+ this.#offset = offset;
15449
15327
  }
15450
- return numeric$1;
15451
15328
  }
15452
- const date$1 = new TomlDate$1(value);
15453
- if (!date$1.isValid()) throw new TomlError$1("invalid value", err);
15454
- return date$1;
15329
+ isDateTime() {
15330
+ return this.#hasDate && this.#hasTime;
15331
+ }
15332
+ isLocal() {
15333
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
15334
+ }
15335
+ isDate() {
15336
+ return this.#hasDate && !this.#hasTime;
15337
+ }
15338
+ isTime() {
15339
+ return this.#hasTime && !this.#hasDate;
15340
+ }
15341
+ isValid() {
15342
+ return this.#hasDate || this.#hasTime;
15343
+ }
15344
+ toISOString() {
15345
+ let iso = super.toISOString();
15346
+ if (this.isDate()) return iso.slice(0, 10);
15347
+ if (this.isTime()) return iso.slice(11, 23);
15348
+ if (this.#offset === null) return iso.slice(0, -1);
15349
+ if (this.#offset === "Z" || this.#offset === "z") return iso;
15350
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15351
+ offset = this.#offset[0] === "-" ? offset : -offset;
15352
+ return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15353
+ }
15354
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15355
+ let date$1 = new _TomlDate(jsDate);
15356
+ date$1.#offset = offset;
15357
+ return date$1;
15358
+ }
15359
+ static wrapAsLocalDateTime(jsDate) {
15360
+ let date$1 = new _TomlDate(jsDate);
15361
+ date$1.#offset = null;
15362
+ return date$1;
15363
+ }
15364
+ static wrapAsLocalDate(jsDate) {
15365
+ let date$1 = new _TomlDate(jsDate);
15366
+ date$1.#hasTime = false;
15367
+ date$1.#offset = null;
15368
+ return date$1;
15369
+ }
15370
+ static wrapAsLocalTime(jsDate) {
15371
+ let date$1 = new _TomlDate(jsDate);
15372
+ date$1.#hasDate = false;
15373
+ date$1.#offset = null;
15374
+ return date$1;
15375
+ }
15376
+ };
15377
+ function isDigit2(char, base = 10) {
15378
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
15455
15379
  }
15456
- __name$3(parseValue$1, "parseValue");
15457
- function extractValue$1(ctx, end, integersAsBigInt) {
15458
- let ptr = ctx.p;
15459
- let c$1 = ctx.s.charCodeAt(ptr);
15380
+ __name$3(isDigit2, "isDigit");
15381
+ function isEndOfValue(char, delim) {
15382
+ return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
15383
+ }
15384
+ __name$3(isEndOfValue, "isEndOfValue");
15385
+ function extractValue(ctx, end) {
15386
+ let errPtr = ctx.p;
15387
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15460
15388
  if (c$1 === 91 || c$1 === 123) {
15461
- if (!ctx.d--) throw new TomlError$1("document contains excessively nested structures. aborting.", {
15462
- toml: ctx.s,
15463
- ptr
15464
- });
15465
- let value = c$1 === 91 ? parseArray$1(ctx, integersAsBigInt) : parseInlineTable$1(ctx, integersAsBigInt);
15389
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
15390
+ let value = c$1 === 91 ? parseArray(ctx) : parseInlineTable(ctx);
15466
15391
  ctx.d++;
15467
15392
  return value;
15468
15393
  }
15469
- if (c$1 === 34 || c$1 === 39) return parseString$1(ctx);
15394
+ if (c$1 === 34 || c$1 === 39) return parseString(ctx);
15470
15395
  if (c$1 === 116) {
15471
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError$1("invalid value", {
15472
- toml: ctx.s,
15473
- ptr
15474
- });
15475
- ctx.p++;
15476
- return true;
15396
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) TomlError.x("invalid value", ctx, errPtr);
15397
+ return ctx.p++, true;
15477
15398
  }
15478
15399
  if (c$1 === 102) {
15479
- 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) throw new TomlError$1("invalid value", {
15480
- toml: ctx.s,
15481
- ptr
15482
- });
15483
- ctx.p++;
15484
- return false;
15400
+ 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) TomlError.x("invalid value", ctx, errPtr);
15401
+ return ctx.p++, false;
15485
15402
  }
15486
- return parseValue$1(ctx, integersAsBigInt, end);
15403
+ if (c$1 === 43 || c$1 === 45) return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c$1, end);
15404
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) return parseDate$1(ctx, c$1, end);
15405
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) return parseTime(ctx, c$1, end);
15406
+ return parseNumber(ctx, ctx.p, c$1, 0, end);
15487
15407
  }
15488
- __name$3(extractValue$1, "extractValue");
15489
- var KEY_PART_RE$1 = /^[a-zA-Z0-9-_]+[ \t]*$/;
15490
- function parseKey$1(ctx, end = "=") {
15408
+ __name$3(extractValue, "extractValue");
15409
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
15410
+ let c$1 = startChr;
15411
+ let state = 0;
15412
+ let hasUnderscores = false;
15413
+ if (c$1 === 105) {
15414
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102) TomlError.x("invalid value", ctx, startPtr);
15415
+ return ctx.p++, (sign || 1) / 0;
15416
+ }
15417
+ if (c$1 === 110) {
15418
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110) TomlError.x("invalid value", ctx, startPtr);
15419
+ return ctx.p++, NaN;
15420
+ }
15421
+ if (c$1 === 48) {
15422
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c$1 = ctx.s.charCodeAt(ctx.p), endChr)) return ctx.bi === true ? 0n : 0;
15423
+ if (!sign) {
15424
+ if (c$1 === 120) return parseIntegerBaseN(ctx, startPtr, 16, endChr);
15425
+ else if (c$1 === 98) return parseIntegerBaseN(ctx, startPtr, 2, endChr);
15426
+ else if (c$1 === 111) return parseIntegerBaseN(ctx, startPtr, 8, endChr);
15427
+ }
15428
+ if (c$1 === 46) state = 2;
15429
+ else if (c$1 === 101 || c$1 === 69) state = 4;
15430
+ else TomlError.x("illegal leading zero", ctx, startPtr);
15431
+ } else if (!isDigit2(c$1)) TomlError.x("invalid value", ctx, startPtr);
15432
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) {
15433
+ if (!state) state = 1;
15434
+ if (c$1 === 95) {
15435
+ if (!(state & 1)) TomlError.x("illegal underscore", ctx);
15436
+ state += 11;
15437
+ hasUnderscores = true;
15438
+ } else if (state === 1 && c$1 === 46) state = 2;
15439
+ else if ((state === 1 || state === 3) && (c$1 === 101 || c$1 === 69)) state = 4;
15440
+ else if (state === 4 && (c$1 === 43 || c$1 === 45));
15441
+ else if (!isDigit2(c$1)) TomlError.x(`illegal character in numeric literal`, ctx);
15442
+ else if (state > 9) state -= 11;
15443
+ else if (!(state & 1)) state++;
15444
+ }
15445
+ if (!state) {
15446
+ let val = (startChr - 48) * (sign || 1);
15447
+ return ctx.bi === true ? BigInt(val) : val;
15448
+ }
15449
+ if (!(state & 1)) TomlError.x("unfinished numeric value", ctx, startPtr);
15450
+ let str = ctx.s.slice(startPtr, ctx.p);
15451
+ if (hasUnderscores) str = str.replaceAll("_", "");
15452
+ return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
15453
+ }
15454
+ __name$3(parseNumber, "parseNumber");
15455
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
15456
+ let c$1, underscore = 1;
15457
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) if (c$1 === 95) {
15458
+ if (underscore & 1) TomlError.x("illegal underscore", ctx);
15459
+ underscore = 3;
15460
+ } else if (!isDigit2(c$1, base)) TomlError.x(`illegal character in numeric literal`, ctx);
15461
+ else if (underscore & 1) underscore--;
15462
+ if (underscore & 1) TomlError.x("unfinished numeric value", ctx);
15463
+ let str = ctx.s.slice(startPtr + 2, ctx.p);
15464
+ if (underscore) str = str.replaceAll("_", "");
15465
+ return parseInteger(ctx, str, base, startPtr);
15466
+ }
15467
+ __name$3(parseIntegerBaseN, "parseIntegerBaseN");
15468
+ function parseInteger(ctx, str, base, startPtr) {
15469
+ if (ctx.bi !== true) int: {
15470
+ let val = parseInt(str, base);
15471
+ if (!Number.isSafeInteger(val)) {
15472
+ if (ctx.bi) break int;
15473
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
15474
+ }
15475
+ return val;
15476
+ }
15477
+ return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
15478
+ }
15479
+ __name$3(parseInteger, "parseInteger");
15480
+ function parseDate$1(ctx, c$1, endChr) {
15481
+ let startPtr = ctx.p++, unsafeSeparator;
15482
+ if (!isDigit2(c$1) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++))) return parseNumber(ctx, ctx.p = startPtr, c$1, 0, endChr);
15483
+ ctx.p += 5;
15484
+ if (!isDigit2(ctx.s.charCodeAt(ctx.p++))) TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
15485
+ if (ctx.p >= ctx.s.length || ((c$1 = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit2(ctx.s.charCodeAt(ctx.p + 1)))) && c$1 !== 84 && c$1 !== 116) return readDate(ctx, ctx.s.slice(startPtr, ctx.p), 3, false, startPtr);
15486
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58) TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
15487
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58) ctx.p += 3;
15488
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15489
+ if (c$1 = ctx.s.charCodeAt(ctx.p)) {
15490
+ if (c$1 === 90 || c$1 === 122) return readDate(ctx, ctx.s.slice(startPtr, ++ctx.p), 1, unsafeSeparator, startPtr, "[+00:00]");
15491
+ if (c$1 === 43 || c$1 === 45) return readDate(ctx, ctx.s.slice(startPtr, ctx.p += 6), 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
15492
+ }
15493
+ return readDate(ctx, ctx.s.slice(startPtr, ctx.p), 2, unsafeSeparator, startPtr);
15494
+ }
15495
+ __name$3(parseDate$1, "parseDate");
15496
+ function parseTime(ctx, c$1, endChr) {
15491
15497
  let start = ctx.p;
15492
- let dot = start - 1;
15498
+ if (!isDigit2(c$1) || !isDigit2(ctx.s.charCodeAt(++ctx.p))) return parseNumber(ctx, --ctx.p, c$1, 0, endChr);
15499
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58) ctx.p += 3;
15500
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15501
+ return readDate(ctx, ctx.s.slice(start, ctx.p), 4, false, start);
15502
+ }
15503
+ __name$3(parseTime, "parseTime");
15504
+ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
15505
+ if (ctx.ld) {
15506
+ let date$1 = new TomlDate(str, type, unsafeDelim);
15507
+ if (!date$1.isValid()) TomlError.x("invalid date", ctx, errPtr);
15508
+ return date$1;
15509
+ }
15510
+ try {
15511
+ if (temporalSuffix) str += temporalSuffix;
15512
+ switch (type) {
15513
+ case 1: return Temporal.ZonedDateTime.from(str);
15514
+ case 2: return Temporal.PlainDateTime.from(str);
15515
+ case 3: return Temporal.PlainDate.from(str);
15516
+ case 4: return Temporal.PlainTime.from(str);
15517
+ }
15518
+ } catch (e) {
15519
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
15520
+ }
15521
+ }
15522
+ __name$3(readDate, "readDate");
15523
+ function skipComment(ctx) {
15524
+ for (; ctx.p < ctx.s.length; ctx.p++) {
15525
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15526
+ if (c$1 === 10) break;
15527
+ if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15528
+ ctx.p++;
15529
+ break;
15530
+ }
15531
+ if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in comments", ctx);
15532
+ }
15533
+ }
15534
+ __name$3(skipComment, "skipComment");
15535
+ function skipVoid(ctx, banNewLines, banComments) {
15536
+ let c$1;
15537
+ while (ctx.p < ctx.s.length) {
15538
+ while (ctx.p < ctx.s.length && ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))) ctx.p++;
15539
+ if (banComments || c$1 !== 35) break;
15540
+ skipComment(ctx);
15541
+ }
15542
+ }
15543
+ __name$3(skipVoid, "skipVoid");
15544
+ function parseKey(ctx, end = 61) {
15545
+ let startPtr;
15546
+ let state = 0;
15493
15547
  let parsed = [];
15494
- let endPtr = ctx.s.indexOf(end, start);
15495
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15496
- toml: ctx.s,
15497
- ptr: start
15498
- });
15499
- do {
15500
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
15501
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
15502
- if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError$1("multiline strings are not allowed in keys", {
15503
- toml: ctx.s,
15504
- ptr: ctx.p
15505
- });
15506
- let part = parseString$1(ctx);
15507
- dot = ctx.s.indexOf(".", ctx.p);
15508
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15509
- let newLine = indexOfNewline$1(strEnd);
15510
- if (newLine > -1) throw new TomlError$1("newlines are not allowed in keys", {
15511
- toml: ctx.s,
15512
- ptr: newLine
15513
- });
15514
- if (strEnd.trimStart()) throw new TomlError$1("found extra tokens after the string part", {
15515
- toml: ctx.s,
15516
- ptr: ctx.p
15517
- });
15518
- if (endPtr < ctx.p) {
15519
- endPtr = ctx.s.indexOf(end, ctx.p);
15520
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15521
- toml: ctx.s,
15522
- ptr: start
15523
- });
15524
- }
15525
- parsed.push(part);
15526
- } else {
15527
- dot = ctx.s.indexOf(".", ctx.p);
15528
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15529
- if (!KEY_PART_RE$1.test(part)) throw new TomlError$1("only letter, numbers, dashes and underscores are allowed in keys", {
15530
- toml: ctx.s,
15531
- ptr: ctx.p
15532
- });
15533
- parsed.push(part.trimEnd());
15548
+ let sliceStart;
15549
+ let c$1 = ctx.s.charCodeAt(startPtr = ctx.p);
15550
+ do
15551
+ if (c$1 === end) {
15552
+ if (!state) TomlError.x("unexpected end of key", ctx);
15553
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15554
+ return ctx.p++, parsed;
15555
+ } else if (c$1 === 46) {
15556
+ if (!state) TomlError.x("illegal empty bare key", ctx);
15557
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15558
+ state = 0;
15559
+ } else if (!state && (c$1 === 34 || c$1 === 39)) {
15560
+ if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
15561
+ parsed.push(parseString(ctx));
15562
+ state = 2;
15563
+ ctx.p--;
15564
+ } else if (c$1 === 32 || c$1 === 9) {
15565
+ if (state === 1) {
15566
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
15567
+ state = 2;
15568
+ }
15569
+ } else if (state === 2 || c$1 < 48 && c$1 !== 45 || c$1 > 57 && c$1 < 65 || c$1 > 90 && c$1 < 97 && c$1 !== 95 || c$1 > 122) TomlError.x("illegal character in key", ctx);
15570
+ else if (!state) {
15571
+ state = 1;
15572
+ sliceStart = ctx.p;
15534
15573
  }
15535
- } while (dot + 1 && dot < endPtr);
15536
- ctx.p = endPtr + 1;
15537
- skipVoid$1(ctx, true, true);
15538
- return parsed;
15574
+ while (c$1 = ctx.s.charCodeAt(++ctx.p));
15575
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
15539
15576
  }
15540
- __name$3(parseKey$1, "parseKey");
15541
- function parseInlineTable$1(ctx, integersAsBigInt) {
15542
- let res = {};
15577
+ __name$3(parseKey, "parseKey");
15578
+ function parseInlineTable(ctx) {
15579
+ let startPtr = ctx.p++;
15580
+ let res = /* @__PURE__ */ Object.create(null);
15543
15581
  let seen = /* @__PURE__ */ new Set();
15544
15582
  let c$1;
15545
- ctx.p++;
15546
15583
  while (ctx.p < ctx.s.length) {
15547
- skipVoid$1(ctx);
15584
+ skipVoid(ctx);
15548
15585
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
15549
15586
  ctx.p++;
15550
15587
  return res;
@@ -15552,65 +15589,53 @@ function parseInlineTable$1(ctx, integersAsBigInt) {
15552
15589
  let k;
15553
15590
  let t$4 = res;
15554
15591
  let hasOwn = false;
15555
- let p$1 = ctx.p;
15556
- let key = parseKey$1(ctx);
15592
+ let errPtr = ctx.p;
15593
+ let key = parseKey(ctx);
15557
15594
  for (let i = 0; i < key.length; i++) {
15558
- if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15595
+ if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15559
15596
  k = key[i];
15560
- if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) throw new TomlError$1("trying to redefine an already defined value", {
15561
- toml: ctx.s,
15562
- ptr: p$1
15563
- });
15564
- if (!hasOwn && k === "__proto__") Object.defineProperty(t$4, k, {
15597
+ if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15598
+ let unsafe = k === "__proto__";
15599
+ if (ctx.uk && (unsafe || k === "constructor")) {
15600
+ t$4 = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
15601
+ break;
15602
+ }
15603
+ if (!hasOwn && unsafe) Object.defineProperty(t$4, k, {
15565
15604
  enumerable: true,
15566
15605
  configurable: true,
15567
15606
  writable: true
15568
15607
  });
15569
15608
  }
15570
- if (hasOwn) throw new TomlError$1("trying to redefine an already defined value", {
15571
- toml: ctx.s,
15572
- ptr: ctx.p
15573
- });
15574
- let value = extractValue$1(ctx, 125, integersAsBigInt);
15575
- seen.add(t$4[k] = value);
15576
- skipVoid$1(ctx);
15609
+ if (hasOwn) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15610
+ skipVoid(ctx, true, true);
15611
+ let value = extractValue(ctx, 125);
15612
+ if (t$4 && typeof (t$4[k] = value) === "object") seen.add(value);
15613
+ skipVoid(ctx);
15577
15614
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
15578
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15579
- toml: ctx.s,
15580
- ptr: ctx.p - 1
15581
- });
15615
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15582
15616
  }
15583
- throw new TomlError$1("unfinished table encountered", {
15584
- toml: ctx.s,
15585
- ptr: ctx.p
15586
- });
15617
+ TomlError.x("unfinished table", ctx, startPtr);
15587
15618
  }
15588
- __name$3(parseInlineTable$1, "parseInlineTable");
15589
- function parseArray$1(ctx, integersAsBigInt) {
15619
+ __name$3(parseInlineTable, "parseInlineTable");
15620
+ function parseArray(ctx) {
15621
+ let startPtr = ctx.p++;
15590
15622
  let res = [];
15591
15623
  let c$1;
15592
- ctx.p++;
15593
15624
  while (ctx.p < ctx.s.length) {
15594
- skipVoid$1(ctx);
15625
+ skipVoid(ctx);
15595
15626
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
15596
15627
  ctx.p++;
15597
15628
  return res;
15598
15629
  }
15599
- res.push(extractValue$1(ctx, 93, integersAsBigInt));
15600
- skipVoid$1(ctx);
15630
+ res.push(extractValue(ctx, 93));
15631
+ skipVoid(ctx);
15601
15632
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
15602
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15603
- toml: ctx.s,
15604
- ptr: ctx.p - 1
15605
- });
15633
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15606
15634
  }
15607
- throw new TomlError$1("unfinished array encountered", {
15608
- toml: ctx.s,
15609
- ptr: ctx.p
15610
- });
15635
+ TomlError.x("unfinished array", ctx, startPtr);
15611
15636
  }
15612
- __name$3(parseArray$1, "parseArray");
15613
- function peekTable$1(key, table, meta$1, type) {
15637
+ __name$3(parseArray, "parseArray");
15638
+ function peekTable(ctx, key, table, meta$1, type) {
15614
15639
  let t$4 = table;
15615
15640
  let m = meta$1;
15616
15641
  let k;
@@ -15618,7 +15643,7 @@ function peekTable$1(key, table, meta$1, type) {
15618
15643
  let state;
15619
15644
  for (let i = 0; i < key.length; i++) {
15620
15645
  if (i) {
15621
- t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15646
+ t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15622
15647
  m = (state = m[k]).c;
15623
15648
  if (type === 0 && (state.t === 1 || state.t === 2)) return null;
15624
15649
  if (state.t === 2) {
@@ -15630,7 +15655,9 @@ function peekTable$1(key, table, meta$1, type) {
15630
15655
  k = key[i];
15631
15656
  if ((hasOwn = Object.hasOwn(t$4, k)) && m[k]?.t === 0 && m[k]?.d) return null;
15632
15657
  if (!hasOwn) {
15633
- if (k === "__proto__") {
15658
+ let unsafe = k === "__proto__";
15659
+ if (ctx.uk && (unsafe || k === "constructor")) return false;
15660
+ if (unsafe) {
15634
15661
  Object.defineProperty(t$4, k, {
15635
15662
  enumerable: true,
15636
15663
  configurable: true,
@@ -15646,7 +15673,7 @@ function peekTable$1(key, table, meta$1, type) {
15646
15673
  t: i < key.length - 1 && type === 2 ? 3 : type,
15647
15674
  d: false,
15648
15675
  i: 0,
15649
- c: {}
15676
+ c: /* @__PURE__ */ Object.create(null)
15650
15677
  };
15651
15678
  }
15652
15679
  }
@@ -15657,17 +15684,17 @@ function peekTable$1(key, table, meta$1, type) {
15657
15684
  state.d = true;
15658
15685
  t$4[k] = [];
15659
15686
  }
15660
- t$4[k].push(t$4 = {});
15687
+ t$4[k].push(t$4 = /* @__PURE__ */ Object.create(null));
15661
15688
  state.c[state.i++] = state = {
15662
15689
  t: 1,
15663
15690
  d: false,
15664
15691
  i: 0,
15665
- c: {}
15692
+ c: /* @__PURE__ */ Object.create(null)
15666
15693
  };
15667
15694
  }
15668
15695
  if (state.d) return null;
15669
15696
  state.d = true;
15670
- if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15697
+ if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15671
15698
  else if (type === 0 && hasOwn) return null;
15672
15699
  return [
15673
15700
  k,
@@ -15675,64 +15702,76 @@ function peekTable$1(key, table, meta$1, type) {
15675
15702
  state.c
15676
15703
  ];
15677
15704
  }
15678
- __name$3(peekTable$1, "peekTable");
15679
- function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
15705
+ __name$3(peekTable, "peekTable");
15706
+ function validateTablePeek(ctx, peek, ptr) {
15707
+ if (peek === null || ctx.uk === 2) TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
15708
+ }
15709
+ __name$3(validateTablePeek, "validateTablePeek");
15710
+ function parse3(toml, options = {}) {
15680
15711
  let ctx = {
15681
15712
  s: toml,
15682
15713
  p: 0,
15683
- d: maxDepth
15714
+ d: options.maxDepth ?? 1e3,
15715
+ bi: options.integersAsBigInt ?? false,
15716
+ ld: options.useLegacyDate ?? true,
15717
+ uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
15684
15718
  };
15685
- let res = {};
15686
- let meta$1 = {};
15719
+ let res = /* @__PURE__ */ Object.create(null);
15720
+ let meta$1 = /* @__PURE__ */ Object.create(null);
15687
15721
  let tmp;
15722
+ let skipping = false;
15688
15723
  let tbl = res;
15689
15724
  let m = meta$1;
15690
- skipVoid$1(ctx);
15725
+ if (toml.charCodeAt(0) === 65279) ctx.p++;
15726
+ skipVoid(ctx);
15691
15727
  while (ctx.p < toml.length) {
15692
15728
  if (toml.charCodeAt(ctx.p) === 91) {
15693
15729
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
15694
15730
  tmp = ctx.p += +isTableArray;
15695
- let k = parseKey$1(ctx, "]");
15731
+ skipping = false;
15732
+ let k = parseKey(ctx, 93);
15696
15733
  if (isTableArray) {
15697
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError$1("expected end of table declaration", {
15698
- toml,
15699
- ptr: ctx.p - 1
15700
- });
15734
+ if (toml.charCodeAt(ctx.p) !== 93) TomlError.x("expected end of table array declaration", ctx);
15701
15735
  ctx.p++;
15702
15736
  }
15703
- let p$1 = peekTable$1(k, res, meta$1, isTableArray ? 2 : 1);
15704
- if (!p$1) throw new TomlError$1("trying to redefine an already defined table or value", {
15705
- toml,
15706
- ptr: tmp
15707
- });
15708
- m = p$1[2];
15709
- tbl = p$1[1];
15737
+ let p$1 = peekTable(ctx, k, res, meta$1, isTableArray ? 2 : 1);
15738
+ if (!p$1) {
15739
+ validateTablePeek(ctx, p$1, tmp);
15740
+ skipping = true;
15741
+ } else {
15742
+ m = p$1[2];
15743
+ tbl = p$1[1];
15744
+ }
15710
15745
  } else {
15711
15746
  tmp = ctx.p;
15712
- let p$1 = peekTable$1(parseKey$1(ctx), tbl, m, 0);
15713
- if (!p$1) throw new TomlError$1("trying to redefine an already defined table or value", {
15714
- toml,
15715
- ptr: tmp
15716
- });
15717
- p$1[1][p$1[0]] = extractValue$1(ctx, void 0, integersAsBigInt);
15747
+ let p$1 = peekTable(ctx, parseKey(ctx), tbl, m, 0);
15748
+ if (!p$1 && !skipping) validateTablePeek(ctx, p$1, tmp);
15749
+ skipVoid(ctx, true, true);
15750
+ let v = extractValue(ctx, void 0);
15751
+ if (p$1 && !skipping) p$1[1][p$1[0]] = v;
15718
15752
  }
15719
- skipVoid$1(ctx, true);
15720
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError$1("each key-value declaration must be followed by an end-of-line", {
15721
- toml,
15722
- ptr: ctx.p
15723
- });
15724
- skipVoid$1(ctx);
15753
+ skipVoid(ctx, true);
15754
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
15755
+ skipVoid(ctx);
15725
15756
  }
15726
15757
  return res;
15727
15758
  }
15728
15759
  __name$3(parse3, "parse");
15729
15760
  var BARE_KEY$1 = /^[a-z0-9-_]+$/i;
15761
+ var HAS_WELLFORMED$1 = !!"".isWellFormed;
15730
15762
  function extendedTypeOf$1(obj) {
15731
15763
  let type = typeof obj;
15732
15764
  if (type === "object") {
15733
15765
  if (Array.isArray(obj)) return "array";
15734
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
15735
- if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
15766
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
15767
+ if (globalThis.Temporal) {
15768
+ if (obj.until) {
15769
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
15770
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
15771
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
15772
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
15773
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
15774
+ }
15736
15775
  }
15737
15776
  return type;
15738
15777
  }
@@ -15742,18 +15781,21 @@ function isArrayOfTables$1(obj) {
15742
15781
  return obj.length != 0;
15743
15782
  }
15744
15783
  __name$3(isArrayOfTables$1, "isArrayOfTables");
15784
+ function formatWellFormedStringUnchecked$1(s) {
15785
+ return JSON.stringify(s).replaceAll("", "\\u007f");
15786
+ }
15787
+ __name$3(formatWellFormedStringUnchecked$1, "formatWellFormedStringUnchecked");
15745
15788
  function formatString$1(s) {
15746
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
15789
+ return formatWellFormedStringUnchecked$1(HAS_WELLFORMED$1 ? s.toWellFormed() : s);
15747
15790
  }
15748
15791
  __name$3(formatString$1, "formatString");
15749
- function stringifyTemporal$1(temporal) {
15750
- return temporal.toString({
15751
- calendarName: "never",
15752
- timeZoneName: "never"
15753
- });
15792
+ function formatKey$1(s) {
15793
+ if (BARE_KEY$1.test(s)) return s;
15794
+ if (HAS_WELLFORMED$1 && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
15795
+ return formatWellFormedStringUnchecked$1(s);
15754
15796
  }
15755
- __name$3(stringifyTemporal$1, "stringifyTemporal");
15756
- function stringifyValue$1(val, type, depth, numberAsFloat) {
15797
+ __name$3(formatKey$1, "formatKey");
15798
+ function stringifyValue$1(val, type, depth, numberAsFloat, strictTemporal) {
15757
15799
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15758
15800
  switch (type) {
15759
15801
  case "number":
@@ -15762,54 +15804,64 @@ function stringifyValue$1(val, type, depth, numberAsFloat) {
15762
15804
  if (val === -Infinity) return "-inf";
15763
15805
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
15764
15806
  case "bigint":
15765
- case "boolean": return val.toString();
15807
+ case "boolean":
15808
+ case "temporal": return val.toString();
15766
15809
  case "string": return formatString$1(val);
15767
15810
  case "date":
15768
15811
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
15769
15812
  return val.toISOString();
15770
- case "object": return stringifyInlineTable$1(val, depth, numberAsFloat);
15771
- case "array": return stringifyArray$1(val, depth, numberAsFloat);
15772
- case "temporal": return stringifyTemporal$1(val);
15813
+ case "object": return stringifyInlineTable$1(val, depth, numberAsFloat, strictTemporal);
15814
+ case "array": return stringifyArray$1(val, depth, numberAsFloat, strictTemporal);
15815
+ case "temporal/tz+uc": if (strictTemporal) {
15816
+ let tz = val.timeZoneId;
15817
+ let tzc = tz.charCodeAt(0);
15818
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
15819
+ }
15820
+ case "temporal/uc":
15821
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
15822
+ return val.toString({
15823
+ calendarName: "never",
15824
+ timeZoneName: "never"
15825
+ });
15826
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
15773
15827
  }
15774
15828
  }
15775
15829
  __name$3(stringifyValue$1, "stringifyValue");
15776
- function stringifyInlineTable$1(obj, depth, numberAsFloat) {
15830
+ function stringifyInlineTable$1(obj, depth, numberAsFloat, strictTemporal) {
15777
15831
  let keys = Object.keys(obj);
15778
15832
  if (keys.length === 0) return "{}";
15779
15833
  let res = "{ ";
15780
15834
  for (let i = 0; i < keys.length; i++) {
15781
15835
  let k = keys[i];
15782
15836
  if (i) res += ", ";
15783
- res += BARE_KEY$1.test(k) ? k : formatString$1(k);
15784
- res += " = ";
15785
- res += stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth - 1, numberAsFloat);
15837
+ res += formatKey$1(k) + " = " + stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth - 1, numberAsFloat, strictTemporal);
15786
15838
  }
15787
15839
  return res + " }";
15788
15840
  }
15789
15841
  __name$3(stringifyInlineTable$1, "stringifyInlineTable");
15790
- function stringifyArray$1(array$1, depth, numberAsFloat) {
15842
+ function stringifyArray$1(array$1, depth, numberAsFloat, strictTemporal) {
15791
15843
  if (array$1.length === 0) return "[]";
15792
15844
  let res = "[ ";
15793
15845
  for (let i = 0; i < array$1.length; i++) {
15794
15846
  if (i) res += ", ";
15795
15847
  if (array$1[i] === null || array$1[i] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
15796
- res += stringifyValue$1(array$1[i], extendedTypeOf$1(array$1[i]), depth - 1, numberAsFloat);
15848
+ res += stringifyValue$1(array$1[i], extendedTypeOf$1(array$1[i]), depth - 1, numberAsFloat, strictTemporal);
15797
15849
  }
15798
15850
  return res + " ]";
15799
15851
  }
15800
15852
  __name$3(stringifyArray$1, "stringifyArray");
15801
- function stringifyArrayTable$1(array$1, key, depth, numberAsFloat) {
15853
+ function stringifyArrayTable$1(array$1, key, depth, numberAsFloat, strictTemporal) {
15802
15854
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15803
15855
  let res = "";
15804
15856
  for (let i = 0; i < array$1.length; i++) {
15805
15857
  res += `${res && "\n"}[[${key}]]
15806
15858
  `;
15807
- res += stringifyTable$1(0, array$1[i], key, depth, numberAsFloat);
15859
+ res += stringifyTable$1(0, array$1[i], key, depth, numberAsFloat, strictTemporal);
15808
15860
  }
15809
15861
  return res;
15810
15862
  }
15811
15863
  __name$3(stringifyArrayTable$1, "stringifyArrayTable");
15812
- function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat) {
15864
+ function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
15813
15865
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15814
15866
  let preamble = "";
15815
15867
  let tables = "";
@@ -15819,15 +15871,15 @@ function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat) {
15819
15871
  if (obj[k] !== null && obj[k] !== void 0) {
15820
15872
  let type = extendedTypeOf$1(obj[k]);
15821
15873
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
15822
- let key = BARE_KEY$1.test(k) ? k : formatString$1(k);
15823
- if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
15874
+ let key = formatKey$1(k);
15875
+ if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
15824
15876
  else if (type === "object") {
15825
15877
  let tblKey = prefix ? `${prefix}.${key}` : key;
15826
- tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
15878
+ tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
15827
15879
  } else {
15828
15880
  preamble += key;
15829
15881
  preamble += " = ";
15830
- preamble += stringifyValue$1(obj[k], type, depth, numberAsFloat);
15882
+ preamble += stringifyValue$1(obj[k], type, depth, numberAsFloat, strictTemporal);
15831
15883
  preamble += "\n";
15832
15884
  }
15833
15885
  }
@@ -15838,19 +15890,13 @@ ${preamble}` : `[${tableKey}]`;
15838
15890
  ${tables}` : preamble || tables;
15839
15891
  }
15840
15892
  __name$3(stringifyTable$1, "stringifyTable");
15841
- function stringify$5(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
15893
+ function stringify$2(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
15842
15894
  if (extendedTypeOf$1(obj) !== "object") throw new TypeError("stringify can only be called with an object");
15843
- let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat);
15895
+ let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
15844
15896
  if (str[str.length - 1] !== "\n") return str + "\n";
15845
15897
  return str;
15846
15898
  }
15847
- __name$3(stringify$5, "stringify");
15848
- var dist_default$3 = {
15849
- parse: parse3,
15850
- stringify: stringify$5,
15851
- TomlDate: TomlDate$1,
15852
- TomlError: TomlError$1
15853
- };
15899
+ __name$3(stringify$2, "stringify");
15854
15900
  var ParseError = class extends UserError$1 {
15855
15901
  static {
15856
15902
  __name$3(this, "ParseError");
@@ -15917,9 +15963,9 @@ var APIError = class extends ParseError {
15917
15963
  };
15918
15964
  function parseTOML(tomlContent, filePath) {
15919
15965
  try {
15920
- return dist_default$3.parse(tomlContent);
15966
+ return parse3(tomlContent);
15921
15967
  } catch (err) {
15922
- if (!(err instanceof TomlError$1)) throw err;
15968
+ if (!(err instanceof TomlError)) throw err;
15923
15969
  const location = {
15924
15970
  lineText: tomlContent.split("\n")[err.line - 1],
15925
15971
  line: err.line,
@@ -16299,14 +16345,14 @@ function configFileName(configPath) {
16299
16345
  }
16300
16346
  __name$3(configFileName, "configFileName");
16301
16347
  function formatConfigSnippet(snippet, configPath, formatted = true) {
16302
- if (configFormat(configPath) === "toml") return dist_default$3.stringify(snippet);
16348
+ if (configFormat(configPath) === "toml") return stringify$2(snippet);
16303
16349
  else return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
16304
16350
  }
16305
16351
  __name$3(formatConfigSnippet, "formatConfigSnippet");
16306
16352
 
16307
16353
  //#endregion
16308
- //#region ../workers-utils/dist/chunk-4PNP2TCS.mjs
16309
- var DEFAULT_COMPAT_DATE = "2026-09-21";
16354
+ //#region ../workers-utils/dist/chunk-DKSA7K25.mjs
16355
+ var DEFAULT_COMPAT_DATE = "2026-09-23";
16310
16356
  function assertNever(_value) {}
16311
16357
  __name$3(assertNever, "assertNever");
16312
16358
  function mapWorkerMetadataBindings(bindings) {
@@ -18394,7 +18440,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
18394
18440
  const { IncomingMessage } = __require$1("node:http");
18395
18441
  const stream$1 = __require$1("node:stream");
18396
18442
  const net$5 = __require$1("node:net");
18397
- const { stringify: stringify$4 } = __require$1("node:querystring");
18443
+ const { stringify: stringify$5 } = __require$1("node:querystring");
18398
18444
  const { EventEmitter: EE$3 } = __require$1("node:events");
18399
18445
  const timers$1 = require_timers();
18400
18446
  const { InvalidArgumentError: InvalidArgumentError$37, ConnectTimeoutError } = require_errors();
@@ -18469,7 +18515,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
18469
18515
  */
18470
18516
  function serializePathWithQuery$4(url$2, queryParams) {
18471
18517
  if (pathHasQueryOrFragment$1(url$2)) throw new Error("Query params cannot be passed when url already contains \"?\" or \"#\".");
18472
- const stringified = stringify$4(queryParams);
18518
+ const stringified = stringify$5(queryParams);
18473
18519
  if (stringified) url$2 += "?" + stringified;
18474
18520
  return url$2;
18475
18521
  }
@@ -21295,7 +21341,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
21295
21341
  * @param {{ position: number }} position
21296
21342
  * @param {boolean} [extractValue=false]
21297
21343
  */
21298
- function collectAnHTTPQuotedString$1(input, position, extractValue$2 = false) {
21344
+ function collectAnHTTPQuotedString$1(input, position, extractValue$1 = false) {
21299
21345
  const positionStart = position.position;
21300
21346
  let value = "";
21301
21347
  assert$30(input[position.position] === "\"");
@@ -21317,7 +21363,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
21317
21363
  break;
21318
21364
  }
21319
21365
  }
21320
- if (extractValue$2) return value;
21366
+ if (extractValue$1) return value;
21321
21367
  return input.slice(positionStart, position.position);
21322
21368
  }
21323
21369
  /**
@@ -36545,7 +36591,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
36545
36591
  * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
36546
36592
  * @param {import('./index').Cookie} cookie
36547
36593
  */
36548
- function stringify$3(cookie) {
36594
+ function stringify$4(cookie) {
36549
36595
  if (cookie.name.length === 0) return null;
36550
36596
  validateCookieName(cookie.name);
36551
36597
  validateCookieValue(cookie.value);
@@ -36589,7 +36635,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
36589
36635
  validateCookiePath,
36590
36636
  validateCookieValue,
36591
36637
  toIMFDate,
36592
- stringify: stringify$3
36638
+ stringify: stringify$4
36593
36639
  };
36594
36640
  }) });
36595
36641
 
@@ -36700,7 +36746,7 @@ var require_parse = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/und
36700
36746
  //#region ../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js
36701
36747
  var require_cookies = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js": ((exports, module) => {
36702
36748
  const { parseSetCookie } = require_parse();
36703
- const { stringify: stringify$2 } = require_util$2();
36749
+ const { stringify: stringify$3 } = require_util$2();
36704
36750
  const { webidl: webidl$5 } = require_webidl();
36705
36751
  const { Headers: Headers$2 } = require_headers();
36706
36752
  const brandChecks = webidl$5.brandCheckMultiple([Headers$2, globalThis.Headers].filter(Boolean));
@@ -36781,7 +36827,7 @@ var require_cookies = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/u
36781
36827
  webidl$5.argumentLengthCheck(arguments, 2, "setCookie");
36782
36828
  brandChecks(headers);
36783
36829
  cookie = webidl$5.converters.Cookie(cookie);
36784
- const str = stringify$2(cookie);
36830
+ const str = stringify$3(cookie);
36785
36831
  if (str) headers.append("set-cookie", str, true);
36786
36832
  }
36787
36833
  webidl$5.converters.DeleteCookieAttributes = webidl$5.dictionaryConverter([{
@@ -40361,7 +40407,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
40361
40407
  var ini = require_ini();
40362
40408
  var path6 = __require("path");
40363
40409
  var stripJsonComments = require_strip_json_comments();
40364
- var parse$8 = exports$1.parse = function(content) {
40410
+ var parse$7 = exports$1.parse = function(content) {
40365
40411
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
40366
40412
  return ini.parse(content);
40367
40413
  };
@@ -40379,7 +40425,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
40379
40425
  };
40380
40426
  exports$1.json = function() {
40381
40427
  var content = file$2.apply(null, arguments);
40382
- return content ? parse$8(content) : null;
40428
+ return content ? parse$7(content) : null;
40383
40429
  };
40384
40430
  exports$1.env = function(prefix, env2) {
40385
40431
  env2 = env2 || process.env;
@@ -40659,11 +40705,11 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40659
40705
  var etc = "/etc";
40660
40706
  var win = process.platform === "win32";
40661
40707
  var home = win ? process.env.USERPROFILE : process.env.HOME;
40662
- module$1.exports = function(name, defaults, argv, parse$8) {
40708
+ module$1.exports = function(name, defaults, argv, parse$7) {
40663
40709
  if ("string" !== typeof name) throw new Error("rc(name): name *must* be string");
40664
40710
  if (!argv) argv = require_minimist()(process.argv.slice(2));
40665
40711
  defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
40666
- parse$8 = parse$8 || cc.parse;
40712
+ parse$7 = parse$7 || cc.parse;
40667
40713
  var env$2 = cc.env(name + "_");
40668
40714
  var configs = [defaults];
40669
40715
  var configFiles = [];
@@ -40671,7 +40717,7 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40671
40717
  if (configFiles.indexOf(file$2) >= 0) return;
40672
40718
  var fileConfig = cc.file(file$2);
40673
40719
  if (fileConfig) {
40674
- configs.push(parse$8(fileConfig));
40720
+ configs.push(parse$7(fileConfig));
40675
40721
  configFiles.push(file$2);
40676
40722
  }
40677
40723
  }
@@ -42668,6 +42714,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
42668
42714
  };
42669
42715
  warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
42670
42716
  errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
42717
+ validateWorkflowExportConflicts(diagnostics, environment.exports);
42671
42718
  const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
42672
42719
  validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
42673
42720
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
@@ -42946,14 +42993,93 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name$3((diagnostics, field,
42946
42993
  return isValid;
42947
42994
  }, "validateDurableObjectBinding");
42948
42995
  var workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
42949
- function validateWorkflowRetentionValue(diagnostics, field, key, value) {
42996
+ function validateWorkflowRetentionValue(diagnostics, field, kind, key, value) {
42950
42997
  const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
42951
42998
  const isValidString = typeof value === "string" && value.length > 0;
42952
42999
  if (isValidNumber || isValidString) return true;
42953
- diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
43000
+ diagnostics.errors.push(`"${field}" ${kind} "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
42954
43001
  return false;
42955
43002
  }
42956
43003
  __name$3(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
43004
+ function validateWorkflowSchedules(diagnostics, field, kind, value) {
43005
+ const { schedules } = value;
43006
+ if (schedules === void 0) return true;
43007
+ if (typeof schedules === "string") {
43008
+ if (schedules.length === 0) {
43009
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty string.`);
43010
+ return false;
43011
+ }
43012
+ return true;
43013
+ }
43014
+ if (Array.isArray(schedules)) {
43015
+ if (schedules.length === 0) {
43016
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty array.`);
43017
+ return false;
43018
+ }
43019
+ if (!schedules.every((s) => typeof s === "string")) {
43020
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43021
+ return false;
43022
+ }
43023
+ if (schedules.some((s) => s === "")) {
43024
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not contain empty strings.`);
43025
+ return false;
43026
+ }
43027
+ return true;
43028
+ }
43029
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43030
+ return false;
43031
+ }
43032
+ __name$3(validateWorkflowSchedules, "validateWorkflowSchedules");
43033
+ function validateWorkflowLimits(diagnostics, field, kind, value) {
43034
+ const { limits } = value;
43035
+ if (limits === void 0) return true;
43036
+ if (typeof limits !== "object" || limits === null || Array.isArray(limits)) {
43037
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
43038
+ return false;
43039
+ }
43040
+ let valid = true;
43041
+ const { steps } = limits;
43042
+ if (steps !== void 0) {
43043
+ if (typeof steps !== "number" || !Number.isInteger(steps) || steps < 1) {
43044
+ diagnostics.errors.push(`"${field}" ${kind} "limits.steps" field must be a positive integer but got ${JSON.stringify(steps)}.`);
43045
+ valid = false;
43046
+ } else if (steps > 25e3) diagnostics.warnings.push(`"${field}" has a step limit of ${steps}, which exceeds the production maximum of 25,000. This configuration may not work when deployed.`);
43047
+ }
43048
+ validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
43049
+ return valid;
43050
+ }
43051
+ __name$3(validateWorkflowLimits, "validateWorkflowLimits");
43052
+ function validateWorkflowDefaultRetention(diagnostics, field, kind, value) {
43053
+ const { default_retention: defaultRetention } = value;
43054
+ if (defaultRetention === void 0) return true;
43055
+ if (typeof defaultRetention !== "object" || defaultRetention === null || Array.isArray(defaultRetention)) {
43056
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
43057
+ return false;
43058
+ }
43059
+ let valid = true;
43060
+ const retention = defaultRetention;
43061
+ for (const key of ["success_retention", "error_retention"]) if (retention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, kind, key, retention[key])) valid = false;
43062
+ validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(retention), ["success_retention", "error_retention"]);
43063
+ return valid;
43064
+ }
43065
+ __name$3(validateWorkflowDefaultRetention, "validateWorkflowDefaultRetention");
43066
+ function validateWorkflowConcurrency(diagnostics, field, kind, value) {
43067
+ const { concurrency } = value;
43068
+ if (concurrency === void 0) return true;
43069
+ if (typeof concurrency !== "object" || concurrency === null || Array.isArray(concurrency)) {
43070
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43071
+ return false;
43072
+ }
43073
+ let valid = true;
43074
+ const { limit } = concurrency;
43075
+ if (limit !== void 0 && (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1)) {
43076
+ diagnostics.errors.push(`"${field}" ${kind} "concurrency.limit" field must be a positive integer but got ${JSON.stringify(limit)}.`);
43077
+ valid = false;
43078
+ }
43079
+ validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43080
+ return valid;
43081
+ }
43082
+ __name$3(validateWorkflowConcurrency, "validateWorkflowConcurrency");
42957
43083
  var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
42958
43084
  if (typeof value !== "object" || value === null) {
42959
43085
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -42979,58 +43105,11 @@ var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, valu
42979
43105
  diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(value)}.`);
42980
43106
  isValid = false;
42981
43107
  }
42982
- if (hasProperty(value, "schedules") && value.schedules !== void 0) if (typeof value.schedules === "string") {
42983
- if (value.schedules.length === 0) {
42984
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty string.`);
42985
- isValid = false;
42986
- }
42987
- } else if (Array.isArray(value.schedules)) {
42988
- if (value.schedules.length === 0) {
42989
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty array.`);
42990
- isValid = false;
42991
- } else if (!value.schedules.every((s) => typeof s === "string")) {
42992
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
42993
- isValid = false;
42994
- } else if (value.schedules.some((s) => s === "")) {
42995
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not contain empty strings.`);
42996
- isValid = false;
42997
- }
42998
- } else {
42999
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43000
- isValid = false;
43001
- }
43002
- if (hasProperty(value, "limits") && value.limits !== void 0) if (typeof value.limits !== "object" || value.limits === null || Array.isArray(value.limits)) {
43003
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
43004
- isValid = false;
43005
- } else {
43006
- const limits = value.limits;
43007
- if (limits.steps !== void 0) {
43008
- if (typeof limits.steps !== "number" || !Number.isInteger(limits.steps) || limits.steps < 1) {
43009
- diagnostics.errors.push(`"${field}" bindings "limits.steps" field must be a positive integer but got ${JSON.stringify(limits.steps)}.`);
43010
- isValid = false;
43011
- } else if (limits.steps > 25e3) diagnostics.warnings.push(`"${field}" has a step limit of ${limits.steps}, which exceeds the production maximum of 25,000. This configuration may not work when deployed.`);
43012
- }
43013
- validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
43014
- }
43015
- if (hasProperty(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
43016
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
43017
- isValid = false;
43018
- } else {
43019
- const defaultRetention = value.default_retention;
43020
- for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, key, defaultRetention[key])) isValid = false;
43021
- validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
43022
- }
43023
- if (hasProperty(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
43024
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43025
- isValid = false;
43026
- } else {
43027
- const concurrency = value.concurrency;
43028
- if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
43029
- diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
43030
- isValid = false;
43031
- }
43032
- validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43033
- }
43108
+ const settings = value;
43109
+ isValid = validateWorkflowSchedules(diagnostics, field, "bindings", settings) && isValid;
43110
+ isValid = validateWorkflowLimits(diagnostics, field, "bindings", settings) && isValid;
43111
+ isValid = validateWorkflowDefaultRetention(diagnostics, field, "bindings", settings) && isValid;
43112
+ isValid = validateWorkflowConcurrency(diagnostics, field, "bindings", settings) && isValid;
43034
43113
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
43035
43114
  "binding",
43036
43115
  "name",
@@ -43231,6 +43310,13 @@ function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
43231
43310
  }
43232
43311
  }
43233
43312
  __name$3(validateSshPublicKeys, "validateSshPublicKeys");
43313
+ function validateContainerSshConfig(diagnostics, field, value) {
43314
+ const sshConfig = typeof value === "object" && value !== null ? value : {};
43315
+ if (!isRequiredProperty(sshConfig, "enabled", "boolean")) diagnostics.errors.push(`${field}.enabled must be a boolean`);
43316
+ const port = "port" in sshConfig ? sshConfig.port : void 0;
43317
+ if (!isOptionalProperty(sshConfig, "port", "number") || typeof port === "number" && (!Number.isInteger(port) || port < 1 || port > 65535)) diagnostics.errors.push(`${field}.port must be a number between 1 and 65535 inclusive`);
43318
+ }
43319
+ __name$3(validateContainerSshConfig, "validateContainerSshConfig");
43234
43320
  function validatePreviewsContainers(envName, configPath) {
43235
43321
  const innerValidator = validateContainerApp(envName, void 0, configPath, { generateDefaultName: false });
43236
43322
  return (diagnostics, field, value, config$1) => {
@@ -43382,9 +43468,13 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43382
43468
  "scheduling_policy",
43383
43469
  "images",
43384
43470
  "observability",
43471
+ "ssh",
43472
+ "authorized_keys",
43385
43473
  "unsafe"
43386
43474
  ].includes(key));
43387
- if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", and restricted "unsafe" settings are supported.`);
43475
+ if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", "ssh", "authorized_keys", and restricted "unsafe" settings are supported.`);
43476
+ if ("ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43477
+ if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43388
43478
  continue;
43389
43479
  }
43390
43480
  if (!containerAppOptional.configuration?.image && !containerAppOptional.image) diagnostics.errors.push(`"containers.image" field must be defined for each container app. This should be the path to your Dockerfile or an image URI pointing to the Cloudflare registry.`);
@@ -43495,23 +43585,11 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43495
43585
  "vcpu",
43496
43586
  "memory_mib"
43497
43587
  ]);
43498
- let sshField;
43499
- let sshConfig;
43500
43588
  if ("ssh" in containerAppOptional) {
43501
- sshField = "ssh";
43502
- sshConfig = containerAppOptional.ssh;
43589
+ validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43503
43590
  containerAppOptional.wrangler_ssh = containerAppOptional.ssh;
43504
43591
  delete containerAppOptional.ssh;
43505
- } else if ("wrangler_ssh" in containerAppOptional) {
43506
- sshField = "wrangler_ssh";
43507
- sshConfig = containerAppOptional.wrangler_ssh;
43508
- }
43509
- if (sshField !== void 0) {
43510
- const sshConfigObject = typeof sshConfig === "object" && sshConfig !== null ? sshConfig : {};
43511
- if (!isRequiredProperty(sshConfigObject, "enabled", "boolean")) diagnostics.errors.push(`${field}.${sshField}.enabled must be a boolean`);
43512
- const sshPort = "port" in sshConfigObject ? sshConfigObject.port : void 0;
43513
- if (!isOptionalProperty(sshConfigObject, "port", "number") || typeof sshPort === "number" && (sshPort < 1 || sshPort > 65535)) diagnostics.errors.push(`${field}.${sshField}.port must be a number between 1 and 65535 inclusive`);
43514
- }
43592
+ } else if ("wrangler_ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.wrangler_ssh`, containerAppOptional.wrangler_ssh);
43515
43593
  if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43516
43594
  if ("trusted_user_ca_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.trusted_user_ca_keys`, containerAppOptional.trusted_user_ca_keys, false);
43517
43595
  if (validateOptionalProperty(diagnostics, field, "constraints", containerAppOptional.constraints, "object") && containerAppOptional.constraints) {
@@ -44229,16 +44307,23 @@ var validateConnectHandler = /* @__PURE__ */ __name$3((diagnostics, field, value
44229
44307
  return false;
44230
44308
  }
44231
44309
  let isValid = true;
44232
- if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), [
44310
+ const connectHandler = value;
44311
+ if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), connectHandler.protocol === "udp" ? [
44312
+ "protocol",
44313
+ "port",
44314
+ "address",
44315
+ "idle_timeout_ms",
44316
+ "max_pending_bytes"
44317
+ ] : [
44233
44318
  "protocol",
44234
44319
  "port",
44235
44320
  "address"
44236
44321
  ])) isValid = false;
44237
- if ("protocol" in value && value.protocol !== "tcp") {
44238
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value.protocol)}.`);
44322
+ if ("protocol" in value && value.protocol !== "tcp" && value.protocol !== "udp") {
44323
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value.protocol)}.`);
44239
44324
  isValid = false;
44240
44325
  } else if (!("protocol" in value)) {
44241
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value)}.`);
44326
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value)}.`);
44242
44327
  isValid = false;
44243
44328
  }
44244
44329
  if (!isRequiredProperty(value, "port", "number")) {
@@ -44252,6 +44337,14 @@ var validateConnectHandler = /* @__PURE__ */ __name$3((diagnostics, field, value
44252
44337
  diagnostics.errors.push(`"${field}" should, optionally, have a string "address" field but got ${JSON.stringify(value)}.`);
44253
44338
  isValid = false;
44254
44339
  }
44340
+ if (connectHandler.protocol === "udp") for (const option of ["idle_timeout_ms", "max_pending_bytes"]) {
44341
+ if (!(option in connectHandler)) continue;
44342
+ const optionValue = connectHandler[option];
44343
+ if (typeof optionValue !== "number" || !Number.isInteger(optionValue) || optionValue < 0 || optionValue > 4294967295) {
44344
+ diagnostics.errors.push(`"${field}" should have an integer "${option}" field between 0 and 4294967295 but got ${JSON.stringify(value)}.`);
44345
+ isValid = false;
44346
+ }
44347
+ }
44255
44348
  return isValid;
44256
44349
  }, "validateConnectHandler");
44257
44350
  var validateCompatibilityDate = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
@@ -44692,6 +44785,29 @@ function validateWorkerExportCache(diagnostics, field, value) {
44692
44785
  return valid;
44693
44786
  }
44694
44787
  __name$3(validateWorkerExportCache, "validateWorkerExportCache");
44788
+ function validateWorkflowExport(diagnostics, exportName, workflowExport) {
44789
+ const field = `exports.${exportName}`;
44790
+ let valid = true;
44791
+ valid = validateRequiredProperty(diagnostics, field, "name", workflowExport.name, "string") && valid;
44792
+ if (typeof workflowExport.name === "string" && !isValidWorkflowName(workflowExport.name)) {
44793
+ diagnostics.errors.push(`"${field}.name" is invalid. ${workflowNameFormatMessage}`);
44794
+ valid = false;
44795
+ }
44796
+ valid = validateWorkflowSchedules(diagnostics, field, "export", workflowExport) && valid;
44797
+ valid = validateWorkflowLimits(diagnostics, field, "export", workflowExport) && valid;
44798
+ valid = validateWorkflowDefaultRetention(diagnostics, field, "export", workflowExport) && valid;
44799
+ valid = validateWorkflowConcurrency(diagnostics, field, "export", workflowExport) && valid;
44800
+ valid = validateAdditionalProperties(diagnostics, field, Object.keys(workflowExport), [
44801
+ "type",
44802
+ "name",
44803
+ "limits",
44804
+ "concurrency",
44805
+ "schedules",
44806
+ "default_retention"
44807
+ ]) && valid;
44808
+ return valid;
44809
+ }
44810
+ __name$3(validateWorkflowExport, "validateWorkflowExport");
44695
44811
  var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
44696
44812
  if (value === void 0 || value === null) return true;
44697
44813
  if (typeof value !== "object" || Array.isArray(value)) {
@@ -44707,9 +44823,10 @@ var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
44707
44823
  }
44708
44824
  if (exportConfig.type === "durable-object") valid = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid;
44709
44825
  else if (exportConfig.type === "worker") valid = validateWorkerExport(diagnostics, exportName, exportConfig) && valid;
44826
+ else if (exportConfig.type === "workflow") valid = validateWorkflowExport(diagnostics, exportName, exportConfig) && valid;
44710
44827
  else {
44711
44828
  valid = false;
44712
- diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`);
44829
+ diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object", "worker", or "workflow", but got ${JSON.stringify(exportConfig.type)}.`);
44713
44830
  }
44714
44831
  }
44715
44832
  return valid;
@@ -44907,8 +45024,7 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
44907
45024
  const exportsCovers = /* @__PURE__ */ __name$3((className) => {
44908
45025
  const entry = exports$1?.[className];
44909
45026
  if (entry === void 0 || entry.type !== "durable-object") return false;
44910
- const state = entry.state ?? "created";
44911
- return state === "created" || state === "expecting-transfer";
45027
+ return isLiveDurableObjectExport(entry);
44912
45028
  }, "exportsCovers");
44913
45029
  const uncoveredByExports = exportedDurableObjects.filter((binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name));
44914
45030
  if (uncoveredByExports.length === 0 || migrations.length > 0) return;
@@ -44931,6 +45047,19 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
44931
45047
  if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
44932
45048
  }
44933
45049
  __name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
45050
+ function validateWorkflowExportConflicts(diagnostics, exports$1) {
45051
+ const classNamesByWorkflowName = /* @__PURE__ */ new Map();
45052
+ for (const [className, workflowExport] of Object.entries(partitionExports(exports$1).workflow)) {
45053
+ if (typeof workflowExport.name !== "string") continue;
45054
+ const existing = classNamesByWorkflowName.get(workflowExport.name);
45055
+ if (existing !== void 0) {
45056
+ diagnostics.errors.push(`"exports.${existing}" and "exports.${className}" both declare the Workflow "${workflowExport.name}". Workflow names must be unique.`);
45057
+ continue;
45058
+ }
45059
+ classNamesByWorkflowName.set(workflowExport.name, className);
45060
+ }
45061
+ }
45062
+ __name$3(validateWorkflowExportConflicts, "validateWorkflowExportConflicts");
44934
45063
  function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44935
45064
  if (containers !== void 0 && !Array.isArray(containers)) return;
44936
45065
  if (containers === void 0 && containersDeclaredElsewhere) return;
@@ -46800,9 +46929,9 @@ function getInstalledVersion(binPath) {
46800
46929
  }
46801
46930
  __name$3(getInstalledVersion, "getInstalledVersion");
46802
46931
  function isVersionOutdated(installed, latest) {
46803
- const parse$8 = /* @__PURE__ */ __name$3((v) => v.split(".").map(Number), "parse");
46804
- const [iYear, iMonth, iPatch] = parse$8(installed);
46805
- const [lYear, lMonth, lPatch] = parse$8(latest);
46932
+ const parse$7 = /* @__PURE__ */ __name$3((v) => v.split(".").map(Number), "parse");
46933
+ const [iYear, iMonth, iPatch] = parse$7(installed);
46934
+ const [lYear, lMonth, lPatch] = parse$7(latest);
46806
46935
  if (iYear !== lYear) return iYear < lYear;
46807
46936
  if (iMonth !== lMonth) return iMonth < lMonth;
46808
46937
  return iPatch < lPatch;
@@ -47717,7 +47846,7 @@ const SPARSE = -7;
47717
47846
  * @param {string} serialized
47718
47847
  * @param {Record<string, (value: any) => any>} [revivers]
47719
47848
  */
47720
- function parse$5(serialized, revivers) {
47849
+ function parse$4(serialized, revivers) {
47721
47850
  return unflatten(JSON.parse(serialized), revivers);
47722
47851
  }
47723
47852
  /**
@@ -49203,8 +49332,8 @@ var ImportType = function(A$2) {
49203
49332
  return A$2[A$2.Static = 1] = "Static", A$2[A$2.Dynamic = 2] = "Dynamic", A$2[A$2.ImportMeta = 3] = "ImportMeta", A$2[A$2.StaticSourcePhase = 4] = "StaticSourcePhase", A$2[A$2.DynamicSourcePhase = 5] = "DynamicSourcePhase", A$2[A$2.StaticDeferPhase = 6] = "StaticDeferPhase", A$2[A$2.DynamicDeferPhase = 7] = "DynamicDeferPhase", A$2;
49204
49333
  }({});
49205
49334
  const A$1 = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0];
49206
- function parse$4(C$2, g = "@") {
49207
- if (!E) return init.then(() => parse$4(C$2));
49335
+ function parse$3(C$2, g = "@") {
49336
+ if (!E) return init.then(() => parse$3(C$2));
49208
49337
  const I = C$2.length + 1, w$1 = (E.__heap_base.value || E.__heap_base) + 4 * I - E.memory.buffer.byteLength;
49209
49338
  w$1 > 0 && E.memory.grow(Math.ceil(w$1 / 65536));
49210
49339
  const o = E.sa(I - 1);
@@ -50051,7 +50180,7 @@ async function handleV2ModuleFallbackRequest(vite, request$1) {
50051
50180
  */
50052
50181
  async function linkV2VitestModule(vite, contents, modulePath, vitestModulePaths) {
50053
50182
  await init;
50054
- const [imports] = parse$4(contents);
50183
+ const [imports] = parse$3(contents);
50055
50184
  for (let i = imports.length - 1; i >= 0; i--) {
50056
50185
  const imported = imports[i];
50057
50186
  const specifier = imported.n;
@@ -50245,7 +50374,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
50245
50374
  ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
50246
50375
  };
50247
50376
  };
50248
- var dist_default$2 = getStringTruncatedWidth;
50377
+ var dist_default$1 = getStringTruncatedWidth;
50249
50378
 
50250
50379
  //#endregion
50251
50380
  //#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
@@ -50255,9 +50384,9 @@ const NO_TRUNCATION = {
50255
50384
  ellipsisWidth: 0
50256
50385
  };
50257
50386
  const fastStringWidth = (input, options = {}) => {
50258
- return dist_default$2(input, NO_TRUNCATION, options).width;
50387
+ return dist_default$1(input, NO_TRUNCATION, options).width;
50259
50388
  };
50260
- var dist_default$1 = fastStringWidth;
50389
+ var dist_default = fastStringWidth;
50261
50390
 
50262
50391
  //#endregion
50263
50392
  //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
@@ -50290,13 +50419,13 @@ const wrapWord$1 = (rows, word, columns) => {
50290
50419
  let isInsideEscape = false;
50291
50420
  let isInsideLinkEscape = false;
50292
50421
  let lastRow = rows.at(-1);
50293
- let visible = lastRow === void 0 ? 0 : dist_default$1(lastRow);
50422
+ let visible = lastRow === void 0 ? 0 : dist_default(lastRow);
50294
50423
  let currentCharacter = characters.next();
50295
50424
  let nextCharacter = characters.next();
50296
50425
  let rawCharacterIndex = 0;
50297
50426
  while (!currentCharacter.done) {
50298
50427
  const character = currentCharacter.value;
50299
- const characterLength = dist_default$1(character);
50428
+ const characterLength = dist_default(character);
50300
50429
  if (visible + characterLength <= columns) rows[rows.length - 1] += character;
50301
50430
  else {
50302
50431
  rows.push(character);
@@ -50331,7 +50460,7 @@ const stringVisibleTrimSpacesRight$1 = (string$1) => {
50331
50460
  const words = string$1.split(" ");
50332
50461
  let last = words.length;
50333
50462
  while (last) {
50334
- if (dist_default$1(words[last - 1])) break;
50463
+ if (dist_default(words[last - 1])) break;
50335
50464
  last--;
50336
50465
  }
50337
50466
  if (last === words.length) return string$1;
@@ -50352,7 +50481,7 @@ const exec$2 = (string$1, columns, options = {}) => {
50352
50481
  const trimmed = row.trimStart();
50353
50482
  if (row.length !== trimmed.length) {
50354
50483
  rows[rows.length - 1] = trimmed;
50355
- rowLength = dist_default$1(trimmed);
50484
+ rowLength = dist_default(trimmed);
50356
50485
  }
50357
50486
  }
50358
50487
  if (index !== 0) {
@@ -50365,19 +50494,19 @@ const exec$2 = (string$1, columns, options = {}) => {
50365
50494
  rowLength++;
50366
50495
  }
50367
50496
  }
50368
- const wordLength = dist_default$1(word);
50497
+ const wordLength = dist_default(word);
50369
50498
  if (options.hard && wordLength > columns) {
50370
50499
  const remainingColumns = columns - rowLength;
50371
50500
  const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
50372
50501
  if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
50373
50502
  wrapWord$1(rows, word, columns);
50374
- rowLength = dist_default$1(rows.at(-1) ?? "");
50503
+ rowLength = dist_default(rows.at(-1) ?? "");
50375
50504
  continue;
50376
50505
  }
50377
50506
  if (rowLength + wordLength > columns && rowLength && wordLength) {
50378
50507
  if (options.wordWrap === false && rowLength < columns) {
50379
50508
  wrapWord$1(rows, word, columns);
50380
- rowLength = dist_default$1(rows.at(-1) ?? "");
50509
+ rowLength = dist_default(rows.at(-1) ?? "");
50381
50510
  continue;
50382
50511
  }
50383
50512
  rows.push("");
@@ -50385,7 +50514,7 @@ const exec$2 = (string$1, columns, options = {}) => {
50385
50514
  }
50386
50515
  if (rowLength + wordLength > columns && options.wordWrap === false) {
50387
50516
  wrapWord$1(rows, word, columns);
50388
- rowLength = dist_default$1(rows.at(-1) ?? "");
50517
+ rowLength = dist_default(rows.at(-1) ?? "");
50389
50518
  continue;
50390
50519
  }
50391
50520
  rows[rows.length - 1] += word;
@@ -52505,7 +52634,7 @@ var __name$2 = (target, value) => __defProp$2(target, "name", {
52505
52634
  });
52506
52635
 
52507
52636
  //#endregion
52508
- //#region ../workers-auth/dist/chunk-XLADBZ7F.mjs
52637
+ //#region ../workers-auth/dist/chunk-WMSASLDV.mjs
52509
52638
  var import_undici$2 = require_undici();
52510
52639
  var hasWarnedAboutDeprecatedV1ApiToken = false;
52511
52640
  function readStoredAuthState(options) {
@@ -54063,589 +54192,21 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
54063
54192
  }
54064
54193
  }
54065
54194
  __name$2(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
54066
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
54067
- var TomlDate = class _TomlDate extends Date {
54068
- static {
54069
- __name$2(this, "TomlDate");
54070
- }
54071
- #hasDate = false;
54072
- #hasTime = false;
54073
- #offset = null;
54074
- constructor(date$1) {
54075
- let hasDate = true;
54076
- let hasTime = true;
54077
- let offset = "Z";
54078
- if (typeof date$1 === "string") {
54079
- let match = date$1.match(DATE_TIME_RE);
54080
- if (match) {
54081
- if (!match[1]) {
54082
- hasDate = false;
54083
- date$1 = `0000-01-01T${date$1}`;
54084
- }
54085
- hasTime = !!match[2];
54086
- hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
54087
- if (match[2] && +match[2] > 23) date$1 = "";
54088
- else {
54089
- offset = match[3] || null;
54090
- date$1 = date$1.toUpperCase();
54091
- if (!offset && hasTime) date$1 += "Z";
54092
- }
54093
- } else date$1 = "";
54094
- }
54095
- super(date$1);
54096
- if (!isNaN(this.getTime())) {
54097
- this.#hasDate = hasDate;
54098
- this.#hasTime = hasTime;
54099
- this.#offset = offset;
54100
- }
54101
- }
54102
- isDateTime() {
54103
- return this.#hasDate && this.#hasTime;
54104
- }
54105
- isLocal() {
54106
- return !this.#hasDate || !this.#hasTime || !this.#offset;
54107
- }
54108
- isDate() {
54109
- return this.#hasDate && !this.#hasTime;
54110
- }
54111
- isTime() {
54112
- return this.#hasTime && !this.#hasDate;
54113
- }
54114
- isValid() {
54115
- return this.#hasDate || this.#hasTime;
54116
- }
54117
- toISOString() {
54118
- let iso = super.toISOString();
54119
- if (this.isDate()) return iso.slice(0, 10);
54120
- if (this.isTime()) return iso.slice(11, 23);
54121
- if (this.#offset === null) return iso.slice(0, -1);
54122
- if (this.#offset === "Z") return iso;
54123
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
54124
- offset = this.#offset[0] === "-" ? offset : -offset;
54125
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
54126
- }
54127
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
54128
- let date$1 = new _TomlDate(jsDate);
54129
- date$1.#offset = offset;
54130
- return date$1;
54131
- }
54132
- static wrapAsLocalDateTime(jsDate) {
54133
- let date$1 = new _TomlDate(jsDate);
54134
- date$1.#offset = null;
54135
- return date$1;
54136
- }
54137
- static wrapAsLocalDate(jsDate) {
54138
- let date$1 = new _TomlDate(jsDate);
54139
- date$1.#hasTime = false;
54140
- date$1.#offset = null;
54141
- return date$1;
54142
- }
54143
- static wrapAsLocalTime(jsDate) {
54144
- let date$1 = new _TomlDate(jsDate);
54145
- date$1.#hasDate = false;
54146
- date$1.#offset = null;
54147
- return date$1;
54148
- }
54149
- };
54150
- function getLineColFromPtr(string$1, ptr) {
54151
- let lines = string$1.slice(0, ptr).split(/\r\n|\n|\r/g);
54152
- return [lines.length, lines.pop().length + 1];
54153
- }
54154
- __name$2(getLineColFromPtr, "getLineColFromPtr");
54155
- function makeCodeBlock(string$1, line, column) {
54156
- let lines = string$1.split(/\r\n|\n|\r/g);
54157
- let codeblock = "";
54158
- let numberLen = (Math.log10(line + 1) | 0) + 1;
54159
- for (let i = line - 1; i <= line + 1; i++) {
54160
- let l = lines[i - 1];
54161
- if (!l) continue;
54162
- codeblock += i.toString().padEnd(numberLen, " ");
54163
- codeblock += ": ";
54164
- codeblock += l;
54165
- codeblock += "\n";
54166
- if (i === line) {
54167
- codeblock += " ".repeat(numberLen + column + 2);
54168
- codeblock += "^\n";
54169
- }
54170
- }
54171
- return codeblock;
54172
- }
54173
- __name$2(makeCodeBlock, "makeCodeBlock");
54174
- var TomlError = class extends Error {
54175
- static {
54176
- __name$2(this, "TomlError");
54177
- }
54178
- line;
54179
- column;
54180
- codeblock;
54181
- constructor(message, options) {
54182
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
54183
- const codeblock = makeCodeBlock(options.toml, line, column);
54184
- super(`Invalid TOML document: ${message}
54185
-
54186
- ${codeblock}`, options);
54187
- this.line = line;
54188
- this.column = column;
54189
- this.codeblock = codeblock;
54190
- }
54191
- };
54192
- function indexOfNewline(str, start = 0) {
54193
- let idx = str.indexOf("\n", start);
54194
- if (str.charCodeAt(idx - 1) === 13) idx--;
54195
- return idx;
54196
- }
54197
- __name$2(indexOfNewline, "indexOfNewline");
54198
- function skipComment(ctx) {
54199
- for (; ctx.p < ctx.s.length; ctx.p++) {
54200
- let c$1 = ctx.s.charCodeAt(ctx.p);
54201
- if (c$1 === 10) break;
54202
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
54203
- ctx.p++;
54204
- break;
54205
- }
54206
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in comments", {
54207
- toml: ctx.s,
54208
- ptr: ctx.p
54209
- });
54210
- }
54211
- }
54212
- __name$2(skipComment, "skipComment");
54213
- function skipVoid(ctx, banNewLines, banComments) {
54214
- let c$1;
54215
- while (1) {
54216
- while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
54217
- if (banComments || c$1 !== 35) break;
54218
- skipComment(ctx);
54219
- }
54220
- }
54221
- __name$2(skipVoid, "skipVoid");
54222
- function skipUntil(ctx, sep, end) {
54223
- let ptr = ctx.p;
54224
- if (!end) {
54225
- ptr = indexOfNewline(ctx.s, ptr);
54226
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
54227
- return;
54228
- }
54229
- for (; ctx.p < ctx.s.length; ctx.p++) {
54230
- let c$1 = ctx.s.charCodeAt(ctx.p);
54231
- if (c$1 === 35) skipComment(ctx);
54232
- else if (c$1 === end || c$1 === sep) return;
54233
- }
54234
- throw new TomlError("cannot find end of structure", {
54235
- toml: ctx.s,
54236
- ptr
54237
- });
54238
- }
54239
- __name$2(skipUntil, "skipUntil");
54240
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
54241
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
54242
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
54243
- function parseString(ctx) {
54244
- let start = ctx.p;
54245
- let c$1 = ctx.s.charCodeAt(ctx.p++);
54246
- let first = c$1;
54247
- let isLiteral = c$1 === 39;
54248
- let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
54249
- if (isMultiline) {
54250
- if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
54251
- else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
54252
- }
54253
- let parsed = "";
54254
- let sliceStart = ctx.p;
54255
- let state = 0;
54256
- for (; ctx.p < ctx.s.length; ctx.p++) {
54257
- c$1 = ctx.s.charCodeAt(ctx.p);
54258
- if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
54259
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in strings", {
54260
- toml: ctx.s,
54261
- ptr: ctx.p
54262
- });
54263
- else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
54264
- if (isMultiline) {
54265
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
54266
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
54267
- }
54268
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
54269
- ctx.p += isMultiline ? 3 : 1;
54270
- return parsed;
54271
- } else if (!state) {
54272
- if (!isLiteral && c$1 === 92) {
54273
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
54274
- state = 1;
54275
- }
54276
- } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
54277
- let value = 0;
54278
- let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
54279
- for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
54280
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
54281
- let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
54282
- if (digit < 0) throw new TomlError("invalid non-hex character in unicode escape", {
54283
- toml: ctx.s,
54284
- ptr: ctx.p + 1
54285
- });
54286
- value = value << 4 | digit;
54287
- }
54288
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError("invalid unicode escape", {
54289
- toml: ctx.s,
54290
- ptr: ctx.p
54291
- });
54292
- parsed += String.fromCodePoint(value);
54293
- sliceStart = ctx.p + 1;
54294
- state = 0;
54295
- } else if (c$1 === 32 || c$1 === 9) state = 2;
54296
- else {
54297
- if (c$1 === 98) parsed += "\b";
54298
- else if (c$1 === 116) parsed += " ";
54299
- else if (c$1 === 110) parsed += "\n";
54300
- else if (c$1 === 102) parsed += "\f";
54301
- else if (c$1 === 114) parsed += "\r";
54302
- else if (c$1 === 101) parsed += "\x1B";
54303
- else if (c$1 === 34) parsed += "\"";
54304
- else if (c$1 === 92) parsed += "\\";
54305
- else throw new TomlError("unrecognized escape sequence", {
54306
- toml: ctx.s,
54307
- ptr: ctx.p
54308
- });
54309
- sliceStart = ctx.p + 1;
54310
- state = 0;
54311
- }
54312
- else if (c$1 !== 32 && c$1 !== 9) {
54313
- if (state === 2) throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
54314
- toml: ctx.s,
54315
- ptr: sliceStart
54316
- });
54317
- state = !isLiteral && c$1 === 92 ? 1 : 0;
54318
- sliceStart = ctx.p;
54319
- }
54320
- }
54321
- throw new TomlError("unfinished string", {
54322
- toml: ctx.s,
54323
- ptr: start
54324
- });
54325
- }
54326
- __name$2(parseString, "parseString");
54327
- function sliceAndTrimEndOf(ctx, start, end) {
54328
- let value = ctx.s.slice(start, end);
54329
- let commentIdx = value.indexOf("#");
54330
- if (commentIdx > 0) {
54331
- skipComment({
54332
- s: value,
54333
- p: commentIdx
54334
- });
54335
- value = value.slice(0, commentIdx);
54336
- }
54337
- return value.trimEnd();
54338
- }
54339
- __name$2(sliceAndTrimEndOf, "sliceAndTrimEndOf");
54340
- function parseValue(ctx, integersAsBigInt, end) {
54341
- let ptr = ctx.p;
54342
- let err = {
54343
- toml: ctx.s,
54344
- ptr
54345
- };
54346
- skipUntil(ctx, 44, end);
54347
- let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
54348
- if (!value) throw new TomlError("incomplete declaration: value expected", err);
54349
- if (value === "-inf") return -Infinity;
54350
- if (value === "inf" || value === "+inf") return Infinity;
54351
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
54352
- if (value === "-0") return integersAsBigInt ? 0n : 0;
54353
- let isInt = INT_REGEX.test(value);
54354
- if (isInt || FLOAT_REGEX.test(value)) {
54355
- if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", err);
54356
- value = value.replace(/_/g, "");
54357
- let numeric$1 = +value;
54358
- if (isNaN(numeric$1)) throw new TomlError("invalid number", err);
54359
- if (isInt) {
54360
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", err);
54361
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
54362
- }
54363
- return numeric$1;
54364
- }
54365
- const date$1 = new TomlDate(value);
54366
- if (!date$1.isValid()) throw new TomlError("invalid value", err);
54367
- return date$1;
54368
- }
54369
- __name$2(parseValue, "parseValue");
54370
- function extractValue(ctx, end, integersAsBigInt) {
54371
- let ptr = ctx.p;
54372
- let c$1 = ctx.s.charCodeAt(ptr);
54373
- if (c$1 === 91 || c$1 === 123) {
54374
- if (!ctx.d--) throw new TomlError("document contains excessively nested structures. aborting.", {
54375
- toml: ctx.s,
54376
- ptr
54377
- });
54378
- let value = c$1 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
54379
- ctx.d++;
54380
- return value;
54381
- }
54382
- if (c$1 === 34 || c$1 === 39) return parseString(ctx);
54383
- if (c$1 === 116) {
54384
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
54385
- toml: ctx.s,
54386
- ptr
54387
- });
54388
- ctx.p++;
54389
- return true;
54390
- }
54391
- if (c$1 === 102) {
54392
- 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) throw new TomlError("invalid value", {
54393
- toml: ctx.s,
54394
- ptr
54395
- });
54396
- ctx.p++;
54397
- return false;
54398
- }
54399
- return parseValue(ctx, integersAsBigInt, end);
54400
- }
54401
- __name$2(extractValue, "extractValue");
54402
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
54403
- function parseKey(ctx, end = "=") {
54404
- let start = ctx.p;
54405
- let dot = start - 1;
54406
- let parsed = [];
54407
- let endPtr = ctx.s.indexOf(end, start);
54408
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
54409
- toml: ctx.s,
54410
- ptr: start
54411
- });
54412
- do {
54413
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
54414
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
54415
- if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError("multiline strings are not allowed in keys", {
54416
- toml: ctx.s,
54417
- ptr: ctx.p
54418
- });
54419
- let part = parseString(ctx);
54420
- dot = ctx.s.indexOf(".", ctx.p);
54421
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
54422
- let newLine = indexOfNewline(strEnd);
54423
- if (newLine > -1) throw new TomlError("newlines are not allowed in keys", {
54424
- toml: ctx.s,
54425
- ptr: newLine
54426
- });
54427
- if (strEnd.trimStart()) throw new TomlError("found extra tokens after the string part", {
54428
- toml: ctx.s,
54429
- ptr: ctx.p
54430
- });
54431
- if (endPtr < ctx.p) {
54432
- endPtr = ctx.s.indexOf(end, ctx.p);
54433
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
54434
- toml: ctx.s,
54435
- ptr: start
54436
- });
54437
- }
54438
- parsed.push(part);
54439
- } else {
54440
- dot = ctx.s.indexOf(".", ctx.p);
54441
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
54442
- if (!KEY_PART_RE.test(part)) throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
54443
- toml: ctx.s,
54444
- ptr: ctx.p
54445
- });
54446
- parsed.push(part.trimEnd());
54447
- }
54448
- } while (dot + 1 && dot < endPtr);
54449
- ctx.p = endPtr + 1;
54450
- skipVoid(ctx, true, true);
54451
- return parsed;
54452
- }
54453
- __name$2(parseKey, "parseKey");
54454
- function parseInlineTable(ctx, integersAsBigInt) {
54455
- let res = {};
54456
- let seen = /* @__PURE__ */ new Set();
54457
- let c$1;
54458
- ctx.p++;
54459
- while (ctx.p < ctx.s.length) {
54460
- skipVoid(ctx);
54461
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
54462
- ctx.p++;
54463
- return res;
54464
- }
54465
- let k;
54466
- let t$4 = res;
54467
- let hasOwn = false;
54468
- let p$1 = ctx.p;
54469
- let key = parseKey(ctx);
54470
- for (let i = 0; i < key.length; i++) {
54471
- if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54472
- k = key[i];
54473
- if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) throw new TomlError("trying to redefine an already defined value", {
54474
- toml: ctx.s,
54475
- ptr: p$1
54476
- });
54477
- if (!hasOwn && k === "__proto__") Object.defineProperty(t$4, k, {
54478
- enumerable: true,
54479
- configurable: true,
54480
- writable: true
54481
- });
54482
- }
54483
- if (hasOwn) throw new TomlError("trying to redefine an already defined value", {
54484
- toml: ctx.s,
54485
- ptr: ctx.p
54486
- });
54487
- let value = extractValue(ctx, 125, integersAsBigInt);
54488
- seen.add(t$4[k] = value);
54489
- skipVoid(ctx);
54490
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
54491
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
54492
- toml: ctx.s,
54493
- ptr: ctx.p - 1
54494
- });
54495
- }
54496
- throw new TomlError("unfinished table encountered", {
54497
- toml: ctx.s,
54498
- ptr: ctx.p
54499
- });
54500
- }
54501
- __name$2(parseInlineTable, "parseInlineTable");
54502
- function parseArray(ctx, integersAsBigInt) {
54503
- let res = [];
54504
- let c$1;
54505
- ctx.p++;
54506
- while (ctx.p < ctx.s.length) {
54507
- skipVoid(ctx);
54508
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
54509
- ctx.p++;
54510
- return res;
54511
- }
54512
- res.push(extractValue(ctx, 93, integersAsBigInt));
54513
- skipVoid(ctx);
54514
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
54515
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
54516
- toml: ctx.s,
54517
- ptr: ctx.p - 1
54518
- });
54519
- }
54520
- throw new TomlError("unfinished array encountered", {
54521
- toml: ctx.s,
54522
- ptr: ctx.p
54523
- });
54524
- }
54525
- __name$2(parseArray, "parseArray");
54526
- function peekTable(key, table, meta$1, type) {
54527
- let t$4 = table;
54528
- let m = meta$1;
54529
- let k;
54530
- let hasOwn = false;
54531
- let state;
54532
- for (let i = 0; i < key.length; i++) {
54533
- if (i) {
54534
- t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54535
- m = (state = m[k]).c;
54536
- if (type === 0 && (state.t === 1 || state.t === 2)) return null;
54537
- if (state.t === 2) {
54538
- let l = t$4.length - 1;
54539
- t$4 = t$4[l];
54540
- m = m[l].c;
54541
- }
54542
- }
54543
- k = key[i];
54544
- if ((hasOwn = Object.hasOwn(t$4, k)) && m[k]?.t === 0 && m[k]?.d) return null;
54545
- if (!hasOwn) {
54546
- if (k === "__proto__") {
54547
- Object.defineProperty(t$4, k, {
54548
- enumerable: true,
54549
- configurable: true,
54550
- writable: true
54551
- });
54552
- Object.defineProperty(m, k, {
54553
- enumerable: true,
54554
- configurable: true,
54555
- writable: true
54556
- });
54557
- }
54558
- m[k] = {
54559
- t: i < key.length - 1 && type === 2 ? 3 : type,
54560
- d: false,
54561
- i: 0,
54562
- c: {}
54563
- };
54564
- }
54565
- }
54566
- state = m[k];
54567
- if (state.t !== type && !(type === 1 && state.t === 3)) return null;
54568
- if (type === 2) {
54569
- if (!state.d) {
54570
- state.d = true;
54571
- t$4[k] = [];
54572
- }
54573
- t$4[k].push(t$4 = {});
54574
- state.c[state.i++] = state = {
54575
- t: 1,
54576
- d: false,
54577
- i: 0,
54578
- c: {}
54579
- };
54580
- }
54581
- if (state.d) return null;
54582
- state.d = true;
54583
- if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54584
- else if (type === 0 && hasOwn) return null;
54585
- return [
54586
- k,
54587
- t$4,
54588
- state.c
54589
- ];
54590
- }
54591
- __name$2(peekTable, "peekTable");
54592
- function parse$3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
54593
- let ctx = {
54594
- s: toml,
54595
- p: 0,
54596
- d: maxDepth
54597
- };
54598
- let res = {};
54599
- let meta$1 = {};
54600
- let tmp;
54601
- let tbl = res;
54602
- let m = meta$1;
54603
- skipVoid(ctx);
54604
- while (ctx.p < toml.length) {
54605
- if (toml.charCodeAt(ctx.p) === 91) {
54606
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
54607
- tmp = ctx.p += +isTableArray;
54608
- let k = parseKey(ctx, "]");
54609
- if (isTableArray) {
54610
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError("expected end of table declaration", {
54611
- toml,
54612
- ptr: ctx.p - 1
54613
- });
54614
- ctx.p++;
54615
- }
54616
- let p$1 = peekTable(k, res, meta$1, isTableArray ? 2 : 1);
54617
- if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
54618
- toml,
54619
- ptr: tmp
54620
- });
54621
- m = p$1[2];
54622
- tbl = p$1[1];
54623
- } else {
54624
- tmp = ctx.p;
54625
- let p$1 = peekTable(parseKey(ctx), tbl, m, 0);
54626
- if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
54627
- toml,
54628
- ptr: tmp
54629
- });
54630
- p$1[1][p$1[0]] = extractValue(ctx, void 0, integersAsBigInt);
54631
- }
54632
- skipVoid(ctx, true);
54633
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError("each key-value declaration must be followed by an end-of-line", {
54634
- toml,
54635
- ptr: ctx.p
54636
- });
54637
- skipVoid(ctx);
54638
- }
54639
- return res;
54640
- }
54641
- __name$2(parse$3, "parse");
54642
54195
  var BARE_KEY = /^[a-z0-9-_]+$/i;
54196
+ var HAS_WELLFORMED = !!"".isWellFormed;
54643
54197
  function extendedTypeOf(obj) {
54644
54198
  let type = typeof obj;
54645
54199
  if (type === "object") {
54646
54200
  if (Array.isArray(obj)) return "array";
54647
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
54648
- if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
54201
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
54202
+ if (globalThis.Temporal) {
54203
+ if (obj.until) {
54204
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
54205
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
54206
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
54207
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
54208
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
54209
+ }
54649
54210
  }
54650
54211
  return type;
54651
54212
  }
@@ -54655,18 +54216,21 @@ function isArrayOfTables(obj) {
54655
54216
  return obj.length != 0;
54656
54217
  }
54657
54218
  __name$2(isArrayOfTables, "isArrayOfTables");
54219
+ function formatWellFormedStringUnchecked(s) {
54220
+ return JSON.stringify(s).replaceAll("", "\\u007f");
54221
+ }
54222
+ __name$2(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
54658
54223
  function formatString(s) {
54659
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
54224
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
54660
54225
  }
54661
54226
  __name$2(formatString, "formatString");
54662
- function stringifyTemporal(temporal) {
54663
- return temporal.toString({
54664
- calendarName: "never",
54665
- timeZoneName: "never"
54666
- });
54227
+ function formatKey(s) {
54228
+ if (BARE_KEY.test(s)) return s;
54229
+ if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
54230
+ return formatWellFormedStringUnchecked(s);
54667
54231
  }
54668
- __name$2(stringifyTemporal, "stringifyTemporal");
54669
- function stringifyValue(val, type, depth, numberAsFloat) {
54232
+ __name$2(formatKey, "formatKey");
54233
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
54670
54234
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54671
54235
  switch (type) {
54672
54236
  case "number":
@@ -54675,54 +54239,64 @@ function stringifyValue(val, type, depth, numberAsFloat) {
54675
54239
  if (val === -Infinity) return "-inf";
54676
54240
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
54677
54241
  case "bigint":
54678
- case "boolean": return val.toString();
54242
+ case "boolean":
54243
+ case "temporal": return val.toString();
54679
54244
  case "string": return formatString(val);
54680
54245
  case "date":
54681
54246
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
54682
54247
  return val.toISOString();
54683
- case "object": return stringifyInlineTable(val, depth, numberAsFloat);
54684
- case "array": return stringifyArray(val, depth, numberAsFloat);
54685
- case "temporal": return stringifyTemporal(val);
54248
+ case "object": return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
54249
+ case "array": return stringifyArray(val, depth, numberAsFloat, strictTemporal);
54250
+ case "temporal/tz+uc": if (strictTemporal) {
54251
+ let tz = val.timeZoneId;
54252
+ let tzc = tz.charCodeAt(0);
54253
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
54254
+ }
54255
+ case "temporal/uc":
54256
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
54257
+ return val.toString({
54258
+ calendarName: "never",
54259
+ timeZoneName: "never"
54260
+ });
54261
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
54686
54262
  }
54687
54263
  }
54688
54264
  __name$2(stringifyValue, "stringifyValue");
54689
- function stringifyInlineTable(obj, depth, numberAsFloat) {
54265
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
54690
54266
  let keys = Object.keys(obj);
54691
54267
  if (keys.length === 0) return "{}";
54692
54268
  let res = "{ ";
54693
54269
  for (let i = 0; i < keys.length; i++) {
54694
54270
  let k = keys[i];
54695
54271
  if (i) res += ", ";
54696
- res += BARE_KEY.test(k) ? k : formatString(k);
54697
- res += " = ";
54698
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
54272
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
54699
54273
  }
54700
54274
  return res + " }";
54701
54275
  }
54702
54276
  __name$2(stringifyInlineTable, "stringifyInlineTable");
54703
- function stringifyArray(array$1, depth, numberAsFloat) {
54277
+ function stringifyArray(array$1, depth, numberAsFloat, strictTemporal) {
54704
54278
  if (array$1.length === 0) return "[]";
54705
54279
  let res = "[ ";
54706
54280
  for (let i = 0; i < array$1.length; i++) {
54707
54281
  if (i) res += ", ";
54708
54282
  if (array$1[i] === null || array$1[i] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
54709
- res += stringifyValue(array$1[i], extendedTypeOf(array$1[i]), depth - 1, numberAsFloat);
54283
+ res += stringifyValue(array$1[i], extendedTypeOf(array$1[i]), depth - 1, numberAsFloat, strictTemporal);
54710
54284
  }
54711
54285
  return res + " ]";
54712
54286
  }
54713
54287
  __name$2(stringifyArray, "stringifyArray");
54714
- function stringifyArrayTable(array$1, key, depth, numberAsFloat) {
54288
+ function stringifyArrayTable(array$1, key, depth, numberAsFloat, strictTemporal) {
54715
54289
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54716
54290
  let res = "";
54717
54291
  for (let i = 0; i < array$1.length; i++) {
54718
54292
  res += `${res && "\n"}[[${key}]]
54719
54293
  `;
54720
- res += stringifyTable(0, array$1[i], key, depth, numberAsFloat);
54294
+ res += stringifyTable(0, array$1[i], key, depth, numberAsFloat, strictTemporal);
54721
54295
  }
54722
54296
  return res;
54723
54297
  }
54724
54298
  __name$2(stringifyArrayTable, "stringifyArrayTable");
54725
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
54299
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
54726
54300
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54727
54301
  let preamble = "";
54728
54302
  let tables = "";
@@ -54732,15 +54306,15 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
54732
54306
  if (obj[k] !== null && obj[k] !== void 0) {
54733
54307
  let type = extendedTypeOf(obj[k]);
54734
54308
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
54735
- let key = BARE_KEY.test(k) ? k : formatString(k);
54736
- if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
54309
+ let key = formatKey(k);
54310
+ if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
54737
54311
  else if (type === "object") {
54738
54312
  let tblKey = prefix ? `${prefix}.${key}` : key;
54739
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
54313
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
54740
54314
  } else {
54741
54315
  preamble += key;
54742
54316
  preamble += " = ";
54743
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
54317
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
54744
54318
  preamble += "\n";
54745
54319
  }
54746
54320
  }
@@ -54751,23 +54325,17 @@ ${preamble}` : `[${tableKey}]`;
54751
54325
  ${tables}` : preamble || tables;
54752
54326
  }
54753
54327
  __name$2(stringifyTable, "stringifyTable");
54754
- function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
54328
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
54755
54329
  if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
54756
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
54330
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
54757
54331
  if (str[str.length - 1] !== "\n") return str + "\n";
54758
54332
  return str;
54759
54333
  }
54760
54334
  __name$2(stringify, "stringify");
54761
- var dist_default = {
54762
- parse: parse$3,
54763
- stringify,
54764
- TomlDate,
54765
- TomlError
54766
- };
54767
54335
  var FILE_FORMATS = {
54768
54336
  toml: {
54769
54337
  parse: /* @__PURE__ */ __name$2((raw) => parseTOML(raw), "parse"),
54770
- stringify: /* @__PURE__ */ __name$2((value) => dist_default.stringify(value), "stringify")
54338
+ stringify: /* @__PURE__ */ __name$2((value) => stringify(value), "stringify")
54771
54339
  },
54772
54340
  json: {
54773
54341
  parse: /* @__PURE__ */ __name$2((raw) => JSON.parse(raw), "parse"),
@@ -55512,7 +55080,7 @@ function scrubEncryptedCredentials(options) {
55512
55080
  __name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
55513
55081
 
55514
55082
  //#endregion
55515
- //#region ../workers-auth/dist/chunk-3U6VZT7T.mjs
55083
+ //#region ../workers-auth/dist/chunk-V6MEAFHI.mjs
55516
55084
  function createPreferences(getConfigPath) {
55517
55085
  function getUserPreferencesPath() {
55518
55086
  return path.resolve(getConfigPath(), "preferences.json");
@@ -61608,7 +61176,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
61608
61176
  //#endregion
61609
61177
  //#region ../remote-bindings/dist/index.mjs
61610
61178
  var import_undici = require_undici();
61611
- var version = "0.0.33";
61179
+ var version = "0.0.35";
61612
61180
  var NoDefaultValueProvided = class extends UserError$1 {
61613
61181
  constructor() {
61614
61182
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -62932,6 +62500,18 @@ const WorkerEntrypointExportSchema = z$1.strictObject({
62932
62500
  type: z$1.literal("worker"),
62933
62501
  cache: z$1.strictObject({ enabled: z$1.boolean() }).optional()
62934
62502
  });
62503
+ const WorkflowRetentionSchema = z$1.union([z$1.number().int().min(1), z$1.string().min(1)]);
62504
+ const WorkflowExportSchema = z$1.strictObject({
62505
+ type: z$1.literal("workflow"),
62506
+ name: z$1.string(),
62507
+ limits: z$1.strictObject({ steps: z$1.number().int().min(1).optional() }).optional(),
62508
+ concurrency: z$1.strictObject({ limit: z$1.number().int().min(1).optional() }).optional(),
62509
+ schedules: z$1.union([z$1.string().min(1), z$1.array(z$1.string().min(1)).min(1)]).optional(),
62510
+ default_retention: z$1.strictObject({
62511
+ success_retention: WorkflowRetentionSchema.optional(),
62512
+ error_retention: WorkflowRetentionSchema.optional()
62513
+ }).optional()
62514
+ });
62935
62515
  const DurableObjectCreatedSqliteExportSchema = DurableObjectCreatedExportSchema.extend({ storage: z$1.literal("sqlite") });
62936
62516
  const DurableObjectCreatedLegacyKvExportSchema = DurableObjectCreatedExportSchema.omit({ container: true }).extend({ storage: z$1.literal("legacy-kv") });
62937
62517
  const DurableObjectExpectingTransferSqliteExportSchema = DurableObjectExpectingTransferExportSchema.extend({ storage: z$1.literal("sqlite") });
@@ -62944,7 +62524,8 @@ const ExportSchema = z$1.union([
62944
62524
  DurableObjectTransferredExportSchema,
62945
62525
  DurableObjectExpectingTransferSqliteExportSchema,
62946
62526
  DurableObjectExpectingTransferLegacyKvExportSchema,
62947
- WorkerEntrypointExportSchema
62527
+ WorkerEntrypointExportSchema,
62528
+ WorkflowExportSchema
62948
62529
  ]);
62949
62530
  const LimitsSchema = z$1.strictObject({
62950
62531
  cpuMs: z$1.number().optional(),
@@ -63016,12 +62597,19 @@ const TriggerSchema = z$1.discriminatedUnion("type", [
63016
62597
  type: z$1.literal("scheduled"),
63017
62598
  schedule: z$1.string()
63018
62599
  }),
63019
- z$1.strictObject({
62600
+ z$1.discriminatedUnion("protocol", [z$1.strictObject({
63020
62601
  type: z$1.literal("connect"),
63021
- protocol: z$1.enum(["tcp"]),
62602
+ protocol: z$1.literal("tcp"),
63022
62603
  port: z$1.number(),
63023
62604
  address: z$1.string().optional()
63024
- })
62605
+ }), z$1.strictObject({
62606
+ type: z$1.literal("connect"),
62607
+ protocol: z$1.literal("udp"),
62608
+ port: z$1.number(),
62609
+ address: z$1.string().optional(),
62610
+ idleTimeoutMs: z$1.number().int().min(0).max(4294967295).optional(),
62611
+ maxPendingBytes: z$1.number().int().min(0).max(4294967295).optional()
62612
+ })])
63025
62613
  ]);
63026
62614
  const UnsafeSchema = z$1.strictObject({
63027
62615
  metadata: z$1.record(z$1.string(), z$1.unknown()).optional(),
@@ -63696,7 +63284,7 @@ function convertExports(config$1, result) {
63696
63284
  const converted = {};
63697
63285
  const unknownExports = {};
63698
63286
  for (const [exportName, value] of Object.entries(exports$2)) {
63699
- if (value.type === "worker") {
63287
+ if (value.type === "worker" || value.type === "workflow") {
63700
63288
  converted[exportName] = value;
63701
63289
  continue;
63702
63290
  }
@@ -63790,7 +63378,11 @@ function convertTriggers(config$1, result) {
63790
63378
  connectHandlers.push(omitUndefined({
63791
63379
  protocol: trigger.protocol,
63792
63380
  port: trigger.port,
63793
- address: trigger.address
63381
+ address: trigger.address,
63382
+ ...trigger.protocol === "udp" ? {
63383
+ idle_timeout_ms: trigger.idleTimeoutMs,
63384
+ max_pending_bytes: trigger.maxPendingBytes
63385
+ } : {}
63794
63386
  }));
63795
63387
  break;
63796
63388
  }
@@ -64707,7 +64299,7 @@ function structuredSerializableStringify(value) {
64707
64299
  return stringify$1(value, structuredSerializableReducers);
64708
64300
  }
64709
64301
  function structuredSerializableParse(value) {
64710
- return parse$5(value, structuredSerializableRevivers);
64302
+ return parse$4(value, structuredSerializableRevivers);
64711
64303
  }
64712
64304
  const log = new Log(LogLevel.INFO, { prefix: "vpw" });
64713
64305
  const debug = util.debuglog("vitest-plugin");