@cloudflare/vite-plugin 1.59.0 → 1.60.1

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.
package/dist/index.mjs CHANGED
@@ -542,7 +542,7 @@ __export(core_exports2, {
542
542
  isValidJWT: () => isValidJWT$1,
543
543
  locales: () => locales_exports,
544
544
  meta: () => meta$2,
545
- parse: () => parse$13,
545
+ parse: () => parse$12,
546
546
  parseAsync: () => parseAsync$2,
547
547
  prettifyError: () => prettifyError,
548
548
  process: () => process$4,
@@ -1377,7 +1377,7 @@ var _parse$1 = /* @__PURE__ */ __name$6((_Err) => (schema, value, _ctx, _params)
1377
1377
  }
1378
1378
  return result.value;
1379
1379
  }, "_parse");
1380
- var parse$13 = /* @__PURE__ */ _parse$1($ZodRealError$1);
1380
+ var parse$12 = /* @__PURE__ */ _parse$1($ZodRealError$1);
1381
1381
  var _parseAsync$1 = /* @__PURE__ */ __name$6((_Err) => async (schema, value, _ctx, params) => {
1382
1382
  const ctx = _ctx ? {
1383
1383
  ..._ctx,
@@ -3930,9 +3930,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor$1("$ZodFunction", (inst, def) =>
3930
3930
  inst.implement = (func) => {
3931
3931
  if (typeof func !== "function") throw new Error("implement() must be called with a function");
3932
3932
  return function(...args) {
3933
- const parsedArgs = inst._def.input ? parse$13(inst._def.input, args) : args;
3933
+ const parsedArgs = inst._def.input ? parse$12(inst._def.input, args) : args;
3934
3934
  const result = Reflect.apply(func, this, parsedArgs);
3935
- if (inst._def.output) return parse$13(inst._def.output, result);
3935
+ if (inst._def.output) return parse$12(inst._def.output, result);
3936
3936
  return result;
3937
3937
  };
3938
3938
  };
@@ -13860,16 +13860,17 @@ function createFatalError$1(message, isJson, options) {
13860
13860
  __name$6(createFatalError$1, "createFatalError");
13861
13861
 
13862
13862
  //#endregion
13863
- //#region ../workers-utils/dist/chunk-IKXB77SR.mjs
13863
+ //#region ../workers-utils/dist/chunk-FLRJ77A6.mjs
13864
13864
  function hasKnownExportType(entry) {
13865
13865
  const type = entry?.type;
13866
- return type === "durable-object" || type === "worker";
13866
+ return type === "durable-object" || type === "worker" || type === "workflow";
13867
13867
  }
13868
13868
  __name$6(hasKnownExportType, "hasKnownExportType");
13869
13869
  function partitionExports(exports$1) {
13870
13870
  const partitioned = {
13871
13871
  "durable-object": {},
13872
- worker: {}
13872
+ worker: {},
13873
+ workflow: {}
13873
13874
  };
13874
13875
  if (exports$1 === void 0) return partitioned;
13875
13876
  for (const [name, entry] of Object.entries(exports$1)) {
@@ -13879,6 +13880,11 @@ function partitionExports(exports$1) {
13879
13880
  return partitioned;
13880
13881
  }
13881
13882
  __name$6(partitionExports, "partitionExports");
13883
+ function isLiveDurableObjectExport(exportConfig) {
13884
+ const state = exportConfig.state ?? "created";
13885
+ return state === "created" || state === "expecting-transfer";
13886
+ }
13887
+ __name$6(isLiveDurableObjectExport, "isLiveDurableObjectExport");
13882
13888
  function getDurableObjectExports(exports$1) {
13883
13889
  return partitionExports(exports$1)["durable-object"];
13884
13890
  }
@@ -13953,7 +13959,7 @@ function getDurableObjectClassNameToUseSQLiteMap(migrations, exports$1) {
13953
13959
  const durableObjectExports = getDurableObjectExports(exports$1 ?? {});
13954
13960
  for (const [className, entry] of Object.entries(durableObjectExports)) {
13955
13961
  if (entry.type !== "durable-object") continue;
13956
- if (entry.state === void 0 || entry.state === "created" || entry.state === "expecting-transfer") durableObjectClassNameToUseSQLiteMap.set(className, entry.storage === "sqlite");
13962
+ if (isLiveDurableObjectExport(entry)) durableObjectClassNameToUseSQLiteMap.set(className, entry.storage === "sqlite");
13957
13963
  }
13958
13964
  return durableObjectClassNameToUseSQLiteMap;
13959
13965
  }
@@ -14526,7 +14532,7 @@ var ParseOptions;
14526
14532
  (function(ParseOptions2) {
14527
14533
  ParseOptions2.DEFAULT = { allowTrailingComma: false };
14528
14534
  })(ParseOptions || (ParseOptions = {}));
14529
- function parse$12(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14535
+ function parse$11(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14530
14536
  let currentProperty = null;
14531
14537
  let currentParent = [];
14532
14538
  const previousParents = [];
@@ -14570,7 +14576,7 @@ function parse$12(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14570
14576
  }, options);
14571
14577
  return currentParent[0];
14572
14578
  }
14573
- __name$6(parse$12, "parse");
14579
+ __name$6(parse$11, "parse");
14574
14580
  function parseTree(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14575
14581
  let currentParent = {
14576
14582
  type: "array",
@@ -14747,15 +14753,15 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14747
14753
  }
14748
14754
  }
14749
14755
  __name$6(scanNext, "scanNext");
14750
- function handleError(error$2, skipUntilAfter = [], skipUntil2 = []) {
14756
+ function handleError(error$2, skipUntilAfter = [], skipUntil = []) {
14751
14757
  onError$1(error$2);
14752
- if (skipUntilAfter.length + skipUntil2.length > 0) {
14758
+ if (skipUntilAfter.length + skipUntil.length > 0) {
14753
14759
  let token = _scanner.getToken();
14754
14760
  while (token !== 17) {
14755
14761
  if (skipUntilAfter.indexOf(token) !== -1) {
14756
14762
  scanNext();
14757
14763
  break;
14758
- } else if (skipUntil2.indexOf(token) !== -1) break;
14764
+ } else if (skipUntil.indexOf(token) !== -1) break;
14759
14765
  token = scanNext();
14760
14766
  }
14761
14767
  }
@@ -14807,7 +14813,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14807
14813
  if (_scanner.getToken() === 6) {
14808
14814
  onSeparator(":");
14809
14815
  scanNext();
14810
- if (!parseValue2()) handleError(4, [], [2, 5]);
14816
+ if (!parseValue()) handleError(4, [], [2, 5]);
14811
14817
  } else handleError(5, [], [2, 5]);
14812
14818
  _jsonPath.pop();
14813
14819
  return true;
@@ -14849,7 +14855,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14849
14855
  _jsonPath.push(0);
14850
14856
  isFirstElement = false;
14851
14857
  } else _jsonPath[_jsonPath.length - 1]++;
14852
- if (!parseValue2()) handleError(4, [], [4, 5]);
14858
+ if (!parseValue()) handleError(4, [], [4, 5]);
14853
14859
  needsComma = true;
14854
14860
  }
14855
14861
  onArrayEnd();
@@ -14859,7 +14865,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14859
14865
  return true;
14860
14866
  }
14861
14867
  __name$6(parseArray2, "parseArray");
14862
- function parseValue2() {
14868
+ function parseValue() {
14863
14869
  switch (_scanner.getToken()) {
14864
14870
  case 3: return parseArray2();
14865
14871
  case 1: return parseObject();
@@ -14867,14 +14873,14 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14867
14873
  default: return parseLiteral();
14868
14874
  }
14869
14875
  }
14870
- __name$6(parseValue2, "parseValue");
14876
+ __name$6(parseValue, "parseValue");
14871
14877
  scanNext();
14872
14878
  if (_scanner.getToken() === 17) {
14873
14879
  if (options.allowEmptyContent) return true;
14874
14880
  handleError(4, [], []);
14875
14881
  return false;
14876
14882
  }
14877
- if (!parseValue2()) {
14883
+ if (!parseValue()) {
14878
14884
  handleError(4, [], []);
14879
14885
  return false;
14880
14886
  }
@@ -15098,7 +15104,7 @@ var SyntaxKind;
15098
15104
  SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
15099
15105
  SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
15100
15106
  })(SyntaxKind || (SyntaxKind = {}));
15101
- var parse2 = parse$12;
15107
+ var parse2 = parse$11;
15102
15108
  var ParseErrorCode;
15103
15109
  (function(ParseErrorCode2) {
15104
15110
  ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
@@ -15164,97 +15170,13 @@ function applyEdits(text, edits) {
15164
15170
  return text;
15165
15171
  }
15166
15172
  __name$6(applyEdits, "applyEdits");
15167
- 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;
15168
- var TomlDate$1 = class _TomlDate extends Date {
15169
- static {
15170
- __name$6(this, "TomlDate");
15171
- }
15172
- #hasDate = false;
15173
- #hasTime = false;
15174
- #offset = null;
15175
- constructor(date$3) {
15176
- let hasDate = true;
15177
- let hasTime = true;
15178
- let offset = "Z";
15179
- if (typeof date$3 === "string") {
15180
- let match = date$3.match(DATE_TIME_RE$1);
15181
- if (match) {
15182
- if (!match[1]) {
15183
- hasDate = false;
15184
- date$3 = `0000-01-01T${date$3}`;
15185
- }
15186
- hasTime = !!match[2];
15187
- hasTime && date$3[10] === " " && (date$3 = date$3.replace(" ", "T"));
15188
- if (match[2] && +match[2] > 23) date$3 = "";
15189
- else {
15190
- offset = match[3] || null;
15191
- date$3 = date$3.toUpperCase();
15192
- if (!offset && hasTime) date$3 += "Z";
15193
- }
15194
- } else date$3 = "";
15195
- }
15196
- super(date$3);
15197
- if (!isNaN(this.getTime())) {
15198
- this.#hasDate = hasDate;
15199
- this.#hasTime = hasTime;
15200
- this.#offset = offset;
15201
- }
15202
- }
15203
- isDateTime() {
15204
- return this.#hasDate && this.#hasTime;
15205
- }
15206
- isLocal() {
15207
- return !this.#hasDate || !this.#hasTime || !this.#offset;
15208
- }
15209
- isDate() {
15210
- return this.#hasDate && !this.#hasTime;
15211
- }
15212
- isTime() {
15213
- return this.#hasTime && !this.#hasDate;
15214
- }
15215
- isValid() {
15216
- return this.#hasDate || this.#hasTime;
15217
- }
15218
- toISOString() {
15219
- let iso = super.toISOString();
15220
- if (this.isDate()) return iso.slice(0, 10);
15221
- if (this.isTime()) return iso.slice(11, 23);
15222
- if (this.#offset === null) return iso.slice(0, -1);
15223
- if (this.#offset === "Z") return iso;
15224
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15225
- offset = this.#offset[0] === "-" ? offset : -offset;
15226
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15227
- }
15228
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15229
- let date$3 = new _TomlDate(jsDate);
15230
- date$3.#offset = offset;
15231
- return date$3;
15232
- }
15233
- static wrapAsLocalDateTime(jsDate) {
15234
- let date$3 = new _TomlDate(jsDate);
15235
- date$3.#offset = null;
15236
- return date$3;
15237
- }
15238
- static wrapAsLocalDate(jsDate) {
15239
- let date$3 = new _TomlDate(jsDate);
15240
- date$3.#hasTime = false;
15241
- date$3.#offset = null;
15242
- return date$3;
15243
- }
15244
- static wrapAsLocalTime(jsDate) {
15245
- let date$3 = new _TomlDate(jsDate);
15246
- date$3.#hasDate = false;
15247
- date$3.#offset = null;
15248
- return date$3;
15249
- }
15250
- };
15251
- function getLineColFromPtr$1(string$3, ptr) {
15252
- let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
15173
+ function getLineColFromPtr(string$3, ptr) {
15174
+ let lines = string$3.slice(0, ptr).split(/\r?\n/);
15253
15175
  return [lines.length, lines.pop().length + 1];
15254
15176
  }
15255
- __name$6(getLineColFromPtr$1, "getLineColFromPtr");
15256
- function makeCodeBlock$1(string$3, line, column) {
15257
- let lines = string$3.split(/\r\n|\n|\r/g);
15177
+ __name$6(getLineColFromPtr, "getLineColFromPtr");
15178
+ function makeCodeBlock(string$3, line, column) {
15179
+ let lines = string$3.split(/\r?\n/);
15258
15180
  let codeblock = "";
15259
15181
  let numberLen = (Math.log10(line + 1) | 0) + 1;
15260
15182
  for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
@@ -15271,8 +15193,8 @@ function makeCodeBlock$1(string$3, line, column) {
15271
15193
  }
15272
15194
  return codeblock;
15273
15195
  }
15274
- __name$6(makeCodeBlock$1, "makeCodeBlock");
15275
- var TomlError$1 = class extends Error {
15196
+ __name$6(makeCodeBlock, "makeCodeBlock");
15197
+ var TomlError = class _TomlError extends Error {
15276
15198
  static {
15277
15199
  __name$6(this, "TomlError");
15278
15200
  }
@@ -15280,8 +15202,8 @@ var TomlError$1 = class extends Error {
15280
15202
  column;
15281
15203
  codeblock;
15282
15204
  constructor(message, options) {
15283
- const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
15284
- const codeblock = makeCodeBlock$1(options.toml, line, column);
15205
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
15206
+ const codeblock = makeCodeBlock(options.toml, line, column);
15285
15207
  super(`Invalid TOML document: ${message}
15286
15208
 
15287
15209
  ${codeblock}`, options);
@@ -15289,60 +15211,16 @@ ${codeblock}`, options);
15289
15211
  this.column = column;
15290
15212
  this.codeblock = codeblock;
15291
15213
  }
15292
- };
15293
- function indexOfNewline$1(str, start = 0) {
15294
- let idx = str.indexOf("\n", start);
15295
- if (str.charCodeAt(idx - 1) === 13) idx--;
15296
- return idx;
15297
- }
15298
- __name$6(indexOfNewline$1, "indexOfNewline");
15299
- function skipComment$1(ctx) {
15300
- for (; ctx.p < ctx.s.length; ctx.p++) {
15301
- let c$1 = ctx.s.charCodeAt(ctx.p);
15302
- if (c$1 === 10) break;
15303
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15304
- ctx.p++;
15305
- break;
15306
- }
15307
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in comments", {
15214
+ /** @internal */
15215
+ static x(message, ctx, ptr) {
15216
+ throw new _TomlError(message, {
15308
15217
  toml: ctx.s,
15309
- ptr: ctx.p
15218
+ ptr: ptr ?? ctx.p
15310
15219
  });
15311
15220
  }
15312
- }
15313
- __name$6(skipComment$1, "skipComment");
15314
- function skipVoid$1(ctx, banNewLines, banComments) {
15315
- let c$1;
15316
- while (1) {
15317
- 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++;
15318
- if (banComments || c$1 !== 35) break;
15319
- skipComment$1(ctx);
15320
- }
15321
- }
15322
- __name$6(skipVoid$1, "skipVoid");
15323
- function skipUntil$1(ctx, sep$1, end) {
15324
- let ptr = ctx.p;
15325
- if (!end) {
15326
- ptr = indexOfNewline$1(ctx.s, ptr);
15327
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
15328
- return;
15329
- }
15330
- for (; ctx.p < ctx.s.length; ctx.p++) {
15331
- let c$1 = ctx.s.charCodeAt(ctx.p);
15332
- if (c$1 === 35) skipComment$1(ctx);
15333
- else if (c$1 === end || c$1 === sep$1) return;
15334
- }
15335
- throw new TomlError$1("cannot find end of structure", {
15336
- toml: ctx.s,
15337
- ptr
15338
- });
15339
- }
15340
- __name$6(skipUntil$1, "skipUntil");
15341
- var INT_REGEX$1 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
15342
- var FLOAT_REGEX$1 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
15343
- var LEADING_ZERO$1 = /^[+-]?0[0-9_]/;
15344
- function parseString$1(ctx) {
15345
- let start = ctx.p;
15221
+ };
15222
+ function parseString(ctx) {
15223
+ let startPtr = ctx.p;
15346
15224
  let c$1 = ctx.s.charCodeAt(ctx.p++);
15347
15225
  let first = c$1;
15348
15226
  let isLiteral = c$1 === 39;
@@ -15357,16 +15235,16 @@ function parseString$1(ctx) {
15357
15235
  for (; ctx.p < ctx.s.length; ctx.p++) {
15358
15236
  c$1 = ctx.s.charCodeAt(ctx.p);
15359
15237
  if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
15360
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in strings", {
15361
- toml: ctx.s,
15362
- ptr: ctx.p
15363
- });
15238
+ else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in strings", ctx);
15364
15239
  else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
15365
15240
  if (isMultiline) {
15366
15241
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15367
15242
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15368
15243
  }
15369
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
15244
+ if (!state) {
15245
+ let s = ctx.s.slice(sliceStart, ctx.p);
15246
+ parsed = parsed ? parsed + s : s;
15247
+ }
15370
15248
  ctx.p += isMultiline ? 3 : 1;
15371
15249
  return parsed;
15372
15250
  } else if (!state) {
@@ -15375,25 +15253,20 @@ function parseString$1(ctx) {
15375
15253
  state = 1;
15376
15254
  }
15377
15255
  } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
15256
+ let errPtr = ctx.p++ - 1;
15378
15257
  let value = 0;
15379
15258
  let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
15380
15259
  for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
15381
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
15260
+ let hex$1 = ctx.s.charCodeAt(ctx.p);
15382
15261
  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;
15383
- if (digit < 0) throw new TomlError$1("invalid non-hex character in unicode escape", {
15384
- toml: ctx.s,
15385
- ptr: ctx.p + 1
15386
- });
15262
+ if (digit < 0) TomlError.x("invalid non-hex character in unicode escape", ctx);
15387
15263
  value = value << 4 | digit;
15388
15264
  }
15389
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError$1("invalid unicode escape", {
15390
- toml: ctx.s,
15391
- ptr: ctx.p
15392
- });
15265
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) TomlError.x("invalid unicode escape", ctx, errPtr);
15393
15266
  parsed += String.fromCodePoint(value);
15394
- sliceStart = ctx.p + 1;
15267
+ sliceStart = ctx.p--;
15395
15268
  state = 0;
15396
- } else if (c$1 === 32 || c$1 === 9) state = 2;
15269
+ } else if (isMultiline && (c$1 === 32 || c$1 === 9)) state = 2;
15397
15270
  else {
15398
15271
  if (c$1 === 98) parsed += "\b";
15399
15272
  else if (c$1 === 116) parsed += " ";
@@ -15403,162 +15276,326 @@ function parseString$1(ctx) {
15403
15276
  else if (c$1 === 101) parsed += "\x1B";
15404
15277
  else if (c$1 === 34) parsed += "\"";
15405
15278
  else if (c$1 === 92) parsed += "\\";
15406
- else throw new TomlError$1("unrecognized escape sequence", {
15407
- toml: ctx.s,
15408
- ptr: ctx.p
15409
- });
15279
+ else TomlError.x("unrecognised escape sequence", ctx);
15410
15280
  sliceStart = ctx.p + 1;
15411
15281
  state = 0;
15412
15282
  }
15413
15283
  else if (c$1 !== 32 && c$1 !== 9) {
15414
- if (state === 2) throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
15415
- toml: ctx.s,
15416
- ptr: sliceStart
15417
- });
15284
+ if (state === 2) TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
15418
15285
  state = !isLiteral && c$1 === 92 ? 1 : 0;
15419
15286
  sliceStart = ctx.p;
15420
15287
  }
15421
15288
  }
15422
- throw new TomlError$1("unfinished string", {
15423
- toml: ctx.s,
15424
- ptr: start
15425
- });
15426
- }
15427
- __name$6(parseString$1, "parseString");
15428
- function sliceAndTrimEndOf$1(ctx, start, end) {
15429
- let value = ctx.s.slice(start, end);
15430
- let commentIdx = value.indexOf("#");
15431
- if (commentIdx > 0) {
15432
- skipComment$1({
15433
- s: value,
15434
- p: commentIdx
15435
- });
15436
- value = value.slice(0, commentIdx);
15437
- }
15438
- return value.trimEnd();
15439
- }
15440
- __name$6(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
15441
- function parseValue$1(ctx, integersAsBigInt, end) {
15442
- let ptr = ctx.p;
15443
- let err = {
15444
- toml: ctx.s,
15445
- ptr
15446
- };
15447
- skipUntil$1(ctx, 44, end);
15448
- let value = sliceAndTrimEndOf$1(ctx, ptr, ctx.p);
15449
- if (!value) throw new TomlError$1("incomplete declaration: value expected", err);
15450
- if (value === "-inf") return -Infinity;
15451
- if (value === "inf" || value === "+inf") return Infinity;
15452
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
15453
- if (value === "-0") return integersAsBigInt ? 0n : 0;
15454
- let isInt = INT_REGEX$1.test(value);
15455
- if (isInt || FLOAT_REGEX$1.test(value)) {
15456
- if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", err);
15457
- value = value.replace(/_/g, "");
15458
- let numeric$1 = +value;
15459
- if (isNaN(numeric$1)) throw new TomlError$1("invalid number", err);
15460
- if (isInt) {
15461
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", err);
15462
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
15289
+ TomlError.x("unfinished string", ctx, startPtr);
15290
+ }
15291
+ __name$6(parseString, "parseString");
15292
+ 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;
15293
+ var TomlDate = class _TomlDate extends Date {
15294
+ static {
15295
+ __name$6(this, "TomlDate");
15296
+ }
15297
+ #hasDate = false;
15298
+ #hasTime = false;
15299
+ #offset = null;
15300
+ constructor(date$3, fasttype, unsafeDelim) {
15301
+ let hasDate = true;
15302
+ let hasTime = true;
15303
+ let offset = "Z";
15304
+ let c$1;
15305
+ if (typeof date$3 === "string") if (fasttype) prep: {
15306
+ if (fasttype < 3) {
15307
+ if (+date$3.slice(11, 13) > 23) {
15308
+ date$3 = "";
15309
+ break prep;
15310
+ }
15311
+ if (fasttype === 2) {
15312
+ offset = null;
15313
+ date$3 += "Z";
15314
+ } else if ((c$1 = date$3.charCodeAt(date$3.length - 1)) !== 90 && c$1 !== 122) offset = date$3.slice(date$3.length - 6);
15315
+ if (unsafeDelim) date$3 = date$3.slice(0, 10) + "T" + date$3.slice(11);
15316
+ } else if (fasttype === 4) date$3 = +date$3.slice(0, 2) > 23 ? "" : `0000-01-01T${date$3}Z`;
15317
+ hasDate = fasttype !== 4;
15318
+ hasTime = fasttype !== 3;
15463
15319
  }
15464
- return numeric$1;
15320
+ else {
15321
+ let match = date$3.match(DATE_TIME_RE);
15322
+ if (match) {
15323
+ if (!match[1]) {
15324
+ hasDate = false;
15325
+ date$3 = `0000-01-01T${date$3}`;
15326
+ }
15327
+ hasTime = !!match[2];
15328
+ hasTime && date$3[10] === " " && (date$3 = date$3.replace(" ", "T"));
15329
+ if (match[2] && +match[2] > 23) date$3 = "";
15330
+ else {
15331
+ offset = match[3] || null;
15332
+ if (!offset && hasTime) date$3 += "Z";
15333
+ }
15334
+ } else date$3 = "";
15335
+ }
15336
+ super(date$3);
15337
+ if (!isNaN(this.getTime())) {
15338
+ this.#hasDate = hasDate;
15339
+ this.#hasTime = hasTime;
15340
+ this.#offset = offset;
15341
+ }
15342
+ }
15343
+ isDateTime() {
15344
+ return this.#hasDate && this.#hasTime;
15345
+ }
15346
+ isLocal() {
15347
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
15348
+ }
15349
+ isDate() {
15350
+ return this.#hasDate && !this.#hasTime;
15351
+ }
15352
+ isTime() {
15353
+ return this.#hasTime && !this.#hasDate;
15354
+ }
15355
+ isValid() {
15356
+ return this.#hasDate || this.#hasTime;
15357
+ }
15358
+ toISOString() {
15359
+ let iso = super.toISOString();
15360
+ if (this.isDate()) return iso.slice(0, 10);
15361
+ if (this.isTime()) return iso.slice(11, 23);
15362
+ if (this.#offset === null) return iso.slice(0, -1);
15363
+ if (this.#offset === "Z" || this.#offset === "z") return iso;
15364
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15365
+ offset = this.#offset[0] === "-" ? offset : -offset;
15366
+ return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15367
+ }
15368
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15369
+ let date$3 = new _TomlDate(jsDate);
15370
+ date$3.#offset = offset;
15371
+ return date$3;
15372
+ }
15373
+ static wrapAsLocalDateTime(jsDate) {
15374
+ let date$3 = new _TomlDate(jsDate);
15375
+ date$3.#offset = null;
15376
+ return date$3;
15465
15377
  }
15466
- const date$3 = new TomlDate$1(value);
15467
- if (!date$3.isValid()) throw new TomlError$1("invalid value", err);
15468
- return date$3;
15378
+ static wrapAsLocalDate(jsDate) {
15379
+ let date$3 = new _TomlDate(jsDate);
15380
+ date$3.#hasTime = false;
15381
+ date$3.#offset = null;
15382
+ return date$3;
15383
+ }
15384
+ static wrapAsLocalTime(jsDate) {
15385
+ let date$3 = new _TomlDate(jsDate);
15386
+ date$3.#hasDate = false;
15387
+ date$3.#offset = null;
15388
+ return date$3;
15389
+ }
15390
+ };
15391
+ function isDigit2(char, base = 10) {
15392
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
15393
+ }
15394
+ __name$6(isDigit2, "isDigit");
15395
+ function isEndOfValue(char, delim) {
15396
+ return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
15469
15397
  }
15470
- __name$6(parseValue$1, "parseValue");
15471
- function extractValue$1(ctx, end, integersAsBigInt) {
15472
- let ptr = ctx.p;
15473
- let c$1 = ctx.s.charCodeAt(ptr);
15398
+ __name$6(isEndOfValue, "isEndOfValue");
15399
+ function extractValue(ctx, end) {
15400
+ let errPtr = ctx.p;
15401
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15474
15402
  if (c$1 === 91 || c$1 === 123) {
15475
- if (!ctx.d--) throw new TomlError$1("document contains excessively nested structures. aborting.", {
15476
- toml: ctx.s,
15477
- ptr
15478
- });
15479
- let value = c$1 === 91 ? parseArray$1(ctx, integersAsBigInt) : parseInlineTable$1(ctx, integersAsBigInt);
15403
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
15404
+ let value = c$1 === 91 ? parseArray(ctx) : parseInlineTable(ctx);
15480
15405
  ctx.d++;
15481
15406
  return value;
15482
15407
  }
15483
- if (c$1 === 34 || c$1 === 39) return parseString$1(ctx);
15408
+ if (c$1 === 34 || c$1 === 39) return parseString(ctx);
15484
15409
  if (c$1 === 116) {
15485
- 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", {
15486
- toml: ctx.s,
15487
- ptr
15488
- });
15489
- ctx.p++;
15490
- return true;
15410
+ 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);
15411
+ return ctx.p++, true;
15491
15412
  }
15492
15413
  if (c$1 === 102) {
15493
- 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", {
15494
- toml: ctx.s,
15495
- ptr
15496
- });
15497
- ctx.p++;
15498
- return false;
15414
+ 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);
15415
+ return ctx.p++, false;
15499
15416
  }
15500
- return parseValue$1(ctx, integersAsBigInt, end);
15417
+ if (c$1 === 43 || c$1 === 45) return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c$1, end);
15418
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) return parseDate(ctx, c$1, end);
15419
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) return parseTime(ctx, c$1, end);
15420
+ return parseNumber(ctx, ctx.p, c$1, 0, end);
15501
15421
  }
15502
- __name$6(extractValue$1, "extractValue");
15503
- var KEY_PART_RE$1 = /^[a-zA-Z0-9-_]+[ \t]*$/;
15504
- function parseKey$1(ctx, end = "=") {
15422
+ __name$6(extractValue, "extractValue");
15423
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
15424
+ let c$1 = startChr;
15425
+ let state = 0;
15426
+ let hasUnderscores = false;
15427
+ if (c$1 === 105) {
15428
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102) TomlError.x("invalid value", ctx, startPtr);
15429
+ return ctx.p++, (sign || 1) / 0;
15430
+ }
15431
+ if (c$1 === 110) {
15432
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110) TomlError.x("invalid value", ctx, startPtr);
15433
+ return ctx.p++, NaN;
15434
+ }
15435
+ if (c$1 === 48) {
15436
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c$1 = ctx.s.charCodeAt(ctx.p), endChr)) return ctx.bi === true ? 0n : 0;
15437
+ if (!sign) {
15438
+ if (c$1 === 120) return parseIntegerBaseN(ctx, startPtr, 16, endChr);
15439
+ else if (c$1 === 98) return parseIntegerBaseN(ctx, startPtr, 2, endChr);
15440
+ else if (c$1 === 111) return parseIntegerBaseN(ctx, startPtr, 8, endChr);
15441
+ }
15442
+ if (c$1 === 46) state = 2;
15443
+ else if (c$1 === 101 || c$1 === 69) state = 4;
15444
+ else TomlError.x("illegal leading zero", ctx, startPtr);
15445
+ } else if (!isDigit2(c$1)) TomlError.x("invalid value", ctx, startPtr);
15446
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) {
15447
+ if (!state) state = 1;
15448
+ if (c$1 === 95) {
15449
+ if (!(state & 1)) TomlError.x("illegal underscore", ctx);
15450
+ state += 11;
15451
+ hasUnderscores = true;
15452
+ } else if (state === 1 && c$1 === 46) state = 2;
15453
+ else if ((state === 1 || state === 3) && (c$1 === 101 || c$1 === 69)) state = 4;
15454
+ else if (state === 4 && (c$1 === 43 || c$1 === 45));
15455
+ else if (!isDigit2(c$1)) TomlError.x(`illegal character in numeric literal`, ctx);
15456
+ else if (state > 9) state -= 11;
15457
+ else if (!(state & 1)) state++;
15458
+ }
15459
+ if (!state) {
15460
+ let val = (startChr - 48) * (sign || 1);
15461
+ return ctx.bi === true ? BigInt(val) : val;
15462
+ }
15463
+ if (!(state & 1)) TomlError.x("unfinished numeric value", ctx, startPtr);
15464
+ let str = ctx.s.slice(startPtr, ctx.p);
15465
+ if (hasUnderscores) str = str.replaceAll("_", "");
15466
+ return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
15467
+ }
15468
+ __name$6(parseNumber, "parseNumber");
15469
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
15470
+ let c$1, underscore = 1;
15471
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) if (c$1 === 95) {
15472
+ if (underscore & 1) TomlError.x("illegal underscore", ctx);
15473
+ underscore = 3;
15474
+ } else if (!isDigit2(c$1, base)) TomlError.x(`illegal character in numeric literal`, ctx);
15475
+ else if (underscore & 1) underscore--;
15476
+ if (underscore & 1) TomlError.x("unfinished numeric value", ctx);
15477
+ let str = ctx.s.slice(startPtr + 2, ctx.p);
15478
+ if (underscore) str = str.replaceAll("_", "");
15479
+ return parseInteger(ctx, str, base, startPtr);
15480
+ }
15481
+ __name$6(parseIntegerBaseN, "parseIntegerBaseN");
15482
+ function parseInteger(ctx, str, base, startPtr) {
15483
+ if (ctx.bi !== true) int: {
15484
+ let val = parseInt(str, base);
15485
+ if (!Number.isSafeInteger(val)) {
15486
+ if (ctx.bi) break int;
15487
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
15488
+ }
15489
+ return val;
15490
+ }
15491
+ return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
15492
+ }
15493
+ __name$6(parseInteger, "parseInteger");
15494
+ function parseDate(ctx, c$1, endChr) {
15495
+ let startPtr = ctx.p++, unsafeSeparator;
15496
+ 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);
15497
+ ctx.p += 5;
15498
+ if (!isDigit2(ctx.s.charCodeAt(ctx.p++))) TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
15499
+ 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);
15500
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58) TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
15501
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58) ctx.p += 3;
15502
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15503
+ if (c$1 = ctx.s.charCodeAt(ctx.p)) {
15504
+ if (c$1 === 90 || c$1 === 122) return readDate(ctx, ctx.s.slice(startPtr, ++ctx.p), 1, unsafeSeparator, startPtr, "[+00:00]");
15505
+ 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) + "]");
15506
+ }
15507
+ return readDate(ctx, ctx.s.slice(startPtr, ctx.p), 2, unsafeSeparator, startPtr);
15508
+ }
15509
+ __name$6(parseDate, "parseDate");
15510
+ function parseTime(ctx, c$1, endChr) {
15505
15511
  let start = ctx.p;
15506
- let dot = start - 1;
15512
+ if (!isDigit2(c$1) || !isDigit2(ctx.s.charCodeAt(++ctx.p))) return parseNumber(ctx, --ctx.p, c$1, 0, endChr);
15513
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58) ctx.p += 3;
15514
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15515
+ return readDate(ctx, ctx.s.slice(start, ctx.p), 4, false, start);
15516
+ }
15517
+ __name$6(parseTime, "parseTime");
15518
+ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
15519
+ if (ctx.ld) {
15520
+ let date$3 = new TomlDate(str, type, unsafeDelim);
15521
+ if (!date$3.isValid()) TomlError.x("invalid date", ctx, errPtr);
15522
+ return date$3;
15523
+ }
15524
+ try {
15525
+ if (temporalSuffix) str += temporalSuffix;
15526
+ switch (type) {
15527
+ case 1: return Temporal.ZonedDateTime.from(str);
15528
+ case 2: return Temporal.PlainDateTime.from(str);
15529
+ case 3: return Temporal.PlainDate.from(str);
15530
+ case 4: return Temporal.PlainTime.from(str);
15531
+ }
15532
+ } catch (e) {
15533
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
15534
+ }
15535
+ }
15536
+ __name$6(readDate, "readDate");
15537
+ function skipComment(ctx) {
15538
+ for (; ctx.p < ctx.s.length; ctx.p++) {
15539
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15540
+ if (c$1 === 10) break;
15541
+ if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15542
+ ctx.p++;
15543
+ break;
15544
+ }
15545
+ if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in comments", ctx);
15546
+ }
15547
+ }
15548
+ __name$6(skipComment, "skipComment");
15549
+ function skipVoid(ctx, banNewLines, banComments) {
15550
+ let c$1;
15551
+ while (ctx.p < ctx.s.length) {
15552
+ 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++;
15553
+ if (banComments || c$1 !== 35) break;
15554
+ skipComment(ctx);
15555
+ }
15556
+ }
15557
+ __name$6(skipVoid, "skipVoid");
15558
+ function parseKey(ctx, end = 61) {
15559
+ let startPtr;
15560
+ let state = 0;
15507
15561
  let parsed = [];
15508
- let endPtr = ctx.s.indexOf(end, start);
15509
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15510
- toml: ctx.s,
15511
- ptr: start
15512
- });
15513
- do {
15514
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
15515
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
15516
- 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", {
15517
- toml: ctx.s,
15518
- ptr: ctx.p
15519
- });
15520
- let part = parseString$1(ctx);
15521
- dot = ctx.s.indexOf(".", ctx.p);
15522
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15523
- let newLine = indexOfNewline$1(strEnd);
15524
- if (newLine > -1) throw new TomlError$1("newlines are not allowed in keys", {
15525
- toml: ctx.s,
15526
- ptr: newLine
15527
- });
15528
- if (strEnd.trimStart()) throw new TomlError$1("found extra tokens after the string part", {
15529
- toml: ctx.s,
15530
- ptr: ctx.p
15531
- });
15532
- if (endPtr < ctx.p) {
15533
- endPtr = ctx.s.indexOf(end, ctx.p);
15534
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15535
- toml: ctx.s,
15536
- ptr: start
15537
- });
15538
- }
15539
- parsed.push(part);
15540
- } else {
15541
- dot = ctx.s.indexOf(".", ctx.p);
15542
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15543
- if (!KEY_PART_RE$1.test(part)) throw new TomlError$1("only letter, numbers, dashes and underscores are allowed in keys", {
15544
- toml: ctx.s,
15545
- ptr: ctx.p
15546
- });
15547
- parsed.push(part.trimEnd());
15562
+ let sliceStart;
15563
+ let c$1 = ctx.s.charCodeAt(startPtr = ctx.p);
15564
+ do
15565
+ if (c$1 === end) {
15566
+ if (!state) TomlError.x("unexpected end of key", ctx);
15567
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15568
+ return ctx.p++, parsed;
15569
+ } else if (c$1 === 46) {
15570
+ if (!state) TomlError.x("illegal empty bare key", ctx);
15571
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15572
+ state = 0;
15573
+ } else if (!state && (c$1 === 34 || c$1 === 39)) {
15574
+ 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);
15575
+ parsed.push(parseString(ctx));
15576
+ state = 2;
15577
+ ctx.p--;
15578
+ } else if (c$1 === 32 || c$1 === 9) {
15579
+ if (state === 1) {
15580
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
15581
+ state = 2;
15582
+ }
15583
+ } 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);
15584
+ else if (!state) {
15585
+ state = 1;
15586
+ sliceStart = ctx.p;
15548
15587
  }
15549
- } while (dot + 1 && dot < endPtr);
15550
- ctx.p = endPtr + 1;
15551
- skipVoid$1(ctx, true, true);
15552
- return parsed;
15588
+ while (c$1 = ctx.s.charCodeAt(++ctx.p));
15589
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
15553
15590
  }
15554
- __name$6(parseKey$1, "parseKey");
15555
- function parseInlineTable$1(ctx, integersAsBigInt) {
15556
- let res = {};
15591
+ __name$6(parseKey, "parseKey");
15592
+ function parseInlineTable(ctx) {
15593
+ let startPtr = ctx.p++;
15594
+ let res = /* @__PURE__ */ Object.create(null);
15557
15595
  let seen = /* @__PURE__ */ new Set();
15558
15596
  let c$1;
15559
- ctx.p++;
15560
15597
  while (ctx.p < ctx.s.length) {
15561
- skipVoid$1(ctx);
15598
+ skipVoid(ctx);
15562
15599
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
15563
15600
  ctx.p++;
15564
15601
  return res;
@@ -15566,65 +15603,53 @@ function parseInlineTable$1(ctx, integersAsBigInt) {
15566
15603
  let k;
15567
15604
  let t$5 = res;
15568
15605
  let hasOwn$1 = false;
15569
- let p$2 = ctx.p;
15570
- let key = parseKey$1(ctx);
15606
+ let errPtr = ctx.p;
15607
+ let key = parseKey(ctx);
15571
15608
  for (let i$1 = 0; i$1 < key.length; i$1++) {
15572
- if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
15609
+ if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = /* @__PURE__ */ Object.create(null);
15573
15610
  k = key[i$1];
15574
- if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError$1("trying to redefine an already defined value", {
15575
- toml: ctx.s,
15576
- ptr: p$2
15577
- });
15578
- if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
15611
+ if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15612
+ let unsafe = k === "__proto__";
15613
+ if (ctx.uk && (unsafe || k === "constructor")) {
15614
+ t$5 = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
15615
+ break;
15616
+ }
15617
+ if (!hasOwn$1 && unsafe) Object.defineProperty(t$5, k, {
15579
15618
  enumerable: true,
15580
15619
  configurable: true,
15581
15620
  writable: true
15582
15621
  });
15583
15622
  }
15584
- if (hasOwn$1) throw new TomlError$1("trying to redefine an already defined value", {
15585
- toml: ctx.s,
15586
- ptr: ctx.p
15587
- });
15588
- let value = extractValue$1(ctx, 125, integersAsBigInt);
15589
- seen.add(t$5[k] = value);
15590
- skipVoid$1(ctx);
15623
+ if (hasOwn$1) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15624
+ skipVoid(ctx, true, true);
15625
+ let value = extractValue(ctx, 125);
15626
+ if (t$5 && typeof (t$5[k] = value) === "object") seen.add(value);
15627
+ skipVoid(ctx);
15591
15628
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
15592
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15593
- toml: ctx.s,
15594
- ptr: ctx.p - 1
15595
- });
15629
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15596
15630
  }
15597
- throw new TomlError$1("unfinished table encountered", {
15598
- toml: ctx.s,
15599
- ptr: ctx.p
15600
- });
15631
+ TomlError.x("unfinished table", ctx, startPtr);
15601
15632
  }
15602
- __name$6(parseInlineTable$1, "parseInlineTable");
15603
- function parseArray$1(ctx, integersAsBigInt) {
15633
+ __name$6(parseInlineTable, "parseInlineTable");
15634
+ function parseArray(ctx) {
15635
+ let startPtr = ctx.p++;
15604
15636
  let res = [];
15605
15637
  let c$1;
15606
- ctx.p++;
15607
15638
  while (ctx.p < ctx.s.length) {
15608
- skipVoid$1(ctx);
15639
+ skipVoid(ctx);
15609
15640
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
15610
15641
  ctx.p++;
15611
15642
  return res;
15612
15643
  }
15613
- res.push(extractValue$1(ctx, 93, integersAsBigInt));
15614
- skipVoid$1(ctx);
15644
+ res.push(extractValue(ctx, 93));
15645
+ skipVoid(ctx);
15615
15646
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
15616
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15617
- toml: ctx.s,
15618
- ptr: ctx.p - 1
15619
- });
15647
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15620
15648
  }
15621
- throw new TomlError$1("unfinished array encountered", {
15622
- toml: ctx.s,
15623
- ptr: ctx.p
15624
- });
15649
+ TomlError.x("unfinished array", ctx, startPtr);
15625
15650
  }
15626
- __name$6(parseArray$1, "parseArray");
15627
- function peekTable$1(key, table, meta$3, type) {
15651
+ __name$6(parseArray, "parseArray");
15652
+ function peekTable(ctx, key, table, meta$3, type) {
15628
15653
  let t$5 = table;
15629
15654
  let m = meta$3;
15630
15655
  let k;
@@ -15632,7 +15657,7 @@ function peekTable$1(key, table, meta$3, type) {
15632
15657
  let state;
15633
15658
  for (let i$1 = 0; i$1 < key.length; i$1++) {
15634
15659
  if (i$1) {
15635
- t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
15660
+ t$5 = hasOwn$1 ? t$5[k] : t$5[k] = /* @__PURE__ */ Object.create(null);
15636
15661
  m = (state = m[k]).c;
15637
15662
  if (type === 0 && (state.t === 1 || state.t === 2)) return null;
15638
15663
  if (state.t === 2) {
@@ -15644,7 +15669,9 @@ function peekTable$1(key, table, meta$3, type) {
15644
15669
  k = key[i$1];
15645
15670
  if ((hasOwn$1 = Object.hasOwn(t$5, k)) && m[k]?.t === 0 && m[k]?.d) return null;
15646
15671
  if (!hasOwn$1) {
15647
- if (k === "__proto__") {
15672
+ let unsafe = k === "__proto__";
15673
+ if (ctx.uk && (unsafe || k === "constructor")) return false;
15674
+ if (unsafe) {
15648
15675
  Object.defineProperty(t$5, k, {
15649
15676
  enumerable: true,
15650
15677
  configurable: true,
@@ -15660,7 +15687,7 @@ function peekTable$1(key, table, meta$3, type) {
15660
15687
  t: i$1 < key.length - 1 && type === 2 ? 3 : type,
15661
15688
  d: false,
15662
15689
  i: 0,
15663
- c: {}
15690
+ c: /* @__PURE__ */ Object.create(null)
15664
15691
  };
15665
15692
  }
15666
15693
  }
@@ -15671,17 +15698,17 @@ function peekTable$1(key, table, meta$3, type) {
15671
15698
  state.d = true;
15672
15699
  t$5[k] = [];
15673
15700
  }
15674
- t$5[k].push(t$5 = {});
15701
+ t$5[k].push(t$5 = /* @__PURE__ */ Object.create(null));
15675
15702
  state.c[state.i++] = state = {
15676
15703
  t: 1,
15677
15704
  d: false,
15678
15705
  i: 0,
15679
- c: {}
15706
+ c: /* @__PURE__ */ Object.create(null)
15680
15707
  };
15681
15708
  }
15682
15709
  if (state.d) return null;
15683
15710
  state.d = true;
15684
- if (type === 1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
15711
+ if (type === 1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = /* @__PURE__ */ Object.create(null);
15685
15712
  else if (type === 0 && hasOwn$1) return null;
15686
15713
  return [
15687
15714
  k,
@@ -15689,64 +15716,76 @@ function peekTable$1(key, table, meta$3, type) {
15689
15716
  state.c
15690
15717
  ];
15691
15718
  }
15692
- __name$6(peekTable$1, "peekTable");
15693
- function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
15719
+ __name$6(peekTable, "peekTable");
15720
+ function validateTablePeek(ctx, peek, ptr) {
15721
+ 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);
15722
+ }
15723
+ __name$6(validateTablePeek, "validateTablePeek");
15724
+ function parse3(toml, options = {}) {
15694
15725
  let ctx = {
15695
15726
  s: toml,
15696
15727
  p: 0,
15697
- d: maxDepth
15728
+ d: options.maxDepth ?? 1e3,
15729
+ bi: options.integersAsBigInt ?? false,
15730
+ ld: options.useLegacyDate ?? true,
15731
+ uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
15698
15732
  };
15699
- let res = {};
15700
- let meta$3 = {};
15733
+ let res = /* @__PURE__ */ Object.create(null);
15734
+ let meta$3 = /* @__PURE__ */ Object.create(null);
15701
15735
  let tmp;
15736
+ let skipping = false;
15702
15737
  let tbl = res;
15703
15738
  let m = meta$3;
15704
- skipVoid$1(ctx);
15739
+ if (toml.charCodeAt(0) === 65279) ctx.p++;
15740
+ skipVoid(ctx);
15705
15741
  while (ctx.p < toml.length) {
15706
15742
  if (toml.charCodeAt(ctx.p) === 91) {
15707
15743
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
15708
15744
  tmp = ctx.p += +isTableArray;
15709
- let k = parseKey$1(ctx, "]");
15745
+ skipping = false;
15746
+ let k = parseKey(ctx, 93);
15710
15747
  if (isTableArray) {
15711
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError$1("expected end of table declaration", {
15712
- toml,
15713
- ptr: ctx.p - 1
15714
- });
15748
+ if (toml.charCodeAt(ctx.p) !== 93) TomlError.x("expected end of table array declaration", ctx);
15715
15749
  ctx.p++;
15716
15750
  }
15717
- let p$2 = peekTable$1(k, res, meta$3, isTableArray ? 2 : 1);
15718
- if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
15719
- toml,
15720
- ptr: tmp
15721
- });
15722
- m = p$2[2];
15723
- tbl = p$2[1];
15751
+ let p$2 = peekTable(ctx, k, res, meta$3, isTableArray ? 2 : 1);
15752
+ if (!p$2) {
15753
+ validateTablePeek(ctx, p$2, tmp);
15754
+ skipping = true;
15755
+ } else {
15756
+ m = p$2[2];
15757
+ tbl = p$2[1];
15758
+ }
15724
15759
  } else {
15725
15760
  tmp = ctx.p;
15726
- let p$2 = peekTable$1(parseKey$1(ctx), tbl, m, 0);
15727
- if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
15728
- toml,
15729
- ptr: tmp
15730
- });
15731
- p$2[1][p$2[0]] = extractValue$1(ctx, void 0, integersAsBigInt);
15761
+ let p$2 = peekTable(ctx, parseKey(ctx), tbl, m, 0);
15762
+ if (!p$2 && !skipping) validateTablePeek(ctx, p$2, tmp);
15763
+ skipVoid(ctx, true, true);
15764
+ let v = extractValue(ctx, void 0);
15765
+ if (p$2 && !skipping) p$2[1][p$2[0]] = v;
15732
15766
  }
15733
- skipVoid$1(ctx, true);
15734
- 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", {
15735
- toml,
15736
- ptr: ctx.p
15737
- });
15738
- skipVoid$1(ctx);
15767
+ skipVoid(ctx, true);
15768
+ 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);
15769
+ skipVoid(ctx);
15739
15770
  }
15740
15771
  return res;
15741
15772
  }
15742
15773
  __name$6(parse3, "parse");
15743
15774
  var BARE_KEY$1 = /^[a-z0-9-_]+$/i;
15775
+ var HAS_WELLFORMED$1 = !!"".isWellFormed;
15744
15776
  function extendedTypeOf$1(obj) {
15745
15777
  let type = typeof obj;
15746
15778
  if (type === "object") {
15747
15779
  if (Array.isArray(obj)) return "array";
15748
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
15749
- 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";
15780
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
15781
+ if (globalThis.Temporal) {
15782
+ if (obj.until) {
15783
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
15784
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
15785
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
15786
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
15787
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
15788
+ }
15750
15789
  }
15751
15790
  return type;
15752
15791
  }
@@ -15756,18 +15795,21 @@ function isArrayOfTables$1(obj) {
15756
15795
  return obj.length != 0;
15757
15796
  }
15758
15797
  __name$6(isArrayOfTables$1, "isArrayOfTables");
15798
+ function formatWellFormedStringUnchecked$1(s) {
15799
+ return JSON.stringify(s).replaceAll("", "\\u007f");
15800
+ }
15801
+ __name$6(formatWellFormedStringUnchecked$1, "formatWellFormedStringUnchecked");
15759
15802
  function formatString$1(s) {
15760
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
15803
+ return formatWellFormedStringUnchecked$1(HAS_WELLFORMED$1 ? s.toWellFormed() : s);
15761
15804
  }
15762
15805
  __name$6(formatString$1, "formatString");
15763
- function stringifyTemporal$1(temporal) {
15764
- return temporal.toString({
15765
- calendarName: "never",
15766
- timeZoneName: "never"
15767
- });
15806
+ function formatKey$1(s) {
15807
+ if (BARE_KEY$1.test(s)) return s;
15808
+ if (HAS_WELLFORMED$1 && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
15809
+ return formatWellFormedStringUnchecked$1(s);
15768
15810
  }
15769
- __name$6(stringifyTemporal$1, "stringifyTemporal");
15770
- function stringifyValue$1(val, type, depth$1, numberAsFloat) {
15811
+ __name$6(formatKey$1, "formatKey");
15812
+ function stringifyValue$1(val, type, depth$1, numberAsFloat, strictTemporal) {
15771
15813
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15772
15814
  switch (type) {
15773
15815
  case "number":
@@ -15776,54 +15818,64 @@ function stringifyValue$1(val, type, depth$1, numberAsFloat) {
15776
15818
  if (val === -Infinity) return "-inf";
15777
15819
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
15778
15820
  case "bigint":
15779
- case "boolean": return val.toString();
15821
+ case "boolean":
15822
+ case "temporal": return val.toString();
15780
15823
  case "string": return formatString$1(val);
15781
15824
  case "date":
15782
15825
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
15783
15826
  return val.toISOString();
15784
- case "object": return stringifyInlineTable$1(val, depth$1, numberAsFloat);
15785
- case "array": return stringifyArray$1(val, depth$1, numberAsFloat);
15786
- case "temporal": return stringifyTemporal$1(val);
15827
+ case "object": return stringifyInlineTable$1(val, depth$1, numberAsFloat, strictTemporal);
15828
+ case "array": return stringifyArray$1(val, depth$1, numberAsFloat, strictTemporal);
15829
+ case "temporal/tz+uc": if (strictTemporal) {
15830
+ let tz = val.timeZoneId;
15831
+ let tzc = tz.charCodeAt(0);
15832
+ 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");
15833
+ }
15834
+ case "temporal/uc":
15835
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
15836
+ return val.toString({
15837
+ calendarName: "never",
15838
+ timeZoneName: "never"
15839
+ });
15840
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
15787
15841
  }
15788
15842
  }
15789
15843
  __name$6(stringifyValue$1, "stringifyValue");
15790
- function stringifyInlineTable$1(obj, depth$1, numberAsFloat) {
15844
+ function stringifyInlineTable$1(obj, depth$1, numberAsFloat, strictTemporal) {
15791
15845
  let keys = Object.keys(obj);
15792
15846
  if (keys.length === 0) return "{}";
15793
15847
  let res = "{ ";
15794
15848
  for (let i$1 = 0; i$1 < keys.length; i$1++) {
15795
15849
  let k = keys[i$1];
15796
15850
  if (i$1) res += ", ";
15797
- res += BARE_KEY$1.test(k) ? k : formatString$1(k);
15798
- res += " = ";
15799
- res += stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth$1 - 1, numberAsFloat);
15851
+ res += formatKey$1(k) + " = " + stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth$1 - 1, numberAsFloat, strictTemporal);
15800
15852
  }
15801
15853
  return res + " }";
15802
15854
  }
15803
15855
  __name$6(stringifyInlineTable$1, "stringifyInlineTable");
15804
- function stringifyArray$1(array$2, depth$1, numberAsFloat) {
15856
+ function stringifyArray$1(array$2, depth$1, numberAsFloat, strictTemporal) {
15805
15857
  if (array$2.length === 0) return "[]";
15806
15858
  let res = "[ ";
15807
15859
  for (let i$1 = 0; i$1 < array$2.length; i$1++) {
15808
15860
  if (i$1) res += ", ";
15809
15861
  if (array$2[i$1] === null || array$2[i$1] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
15810
- res += stringifyValue$1(array$2[i$1], extendedTypeOf$1(array$2[i$1]), depth$1 - 1, numberAsFloat);
15862
+ res += stringifyValue$1(array$2[i$1], extendedTypeOf$1(array$2[i$1]), depth$1 - 1, numberAsFloat, strictTemporal);
15811
15863
  }
15812
15864
  return res + " ]";
15813
15865
  }
15814
15866
  __name$6(stringifyArray$1, "stringifyArray");
15815
- function stringifyArrayTable$1(array$2, key, depth$1, numberAsFloat) {
15867
+ function stringifyArrayTable$1(array$2, key, depth$1, numberAsFloat, strictTemporal) {
15816
15868
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15817
15869
  let res = "";
15818
15870
  for (let i$1 = 0; i$1 < array$2.length; i$1++) {
15819
15871
  res += `${res && "\n"}[[${key}]]
15820
15872
  `;
15821
- res += stringifyTable$1(0, array$2[i$1], key, depth$1, numberAsFloat);
15873
+ res += stringifyTable$1(0, array$2[i$1], key, depth$1, numberAsFloat, strictTemporal);
15822
15874
  }
15823
15875
  return res;
15824
15876
  }
15825
15877
  __name$6(stringifyArrayTable$1, "stringifyArrayTable");
15826
- function stringifyTable$1(tableKey, obj, prefix, depth$1, numberAsFloat) {
15878
+ function stringifyTable$1(tableKey, obj, prefix, depth$1, numberAsFloat, strictTemporal) {
15827
15879
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15828
15880
  let preamble = "";
15829
15881
  let tables = "";
@@ -15833,15 +15885,15 @@ function stringifyTable$1(tableKey, obj, prefix, depth$1, numberAsFloat) {
15833
15885
  if (obj[k] !== null && obj[k] !== void 0) {
15834
15886
  let type = extendedTypeOf$1(obj[k]);
15835
15887
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
15836
- let key = BARE_KEY$1.test(k) ? k : formatString$1(k);
15837
- if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth$1 - 1, numberAsFloat);
15888
+ let key = formatKey$1(k);
15889
+ if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth$1 - 1, numberAsFloat, strictTemporal);
15838
15890
  else if (type === "object") {
15839
15891
  let tblKey = prefix ? `${prefix}.${key}` : key;
15840
- tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth$1 - 1, numberAsFloat);
15892
+ tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth$1 - 1, numberAsFloat, strictTemporal);
15841
15893
  } else {
15842
15894
  preamble += key;
15843
15895
  preamble += " = ";
15844
- preamble += stringifyValue$1(obj[k], type, depth$1, numberAsFloat);
15896
+ preamble += stringifyValue$1(obj[k], type, depth$1, numberAsFloat, strictTemporal);
15845
15897
  preamble += "\n";
15846
15898
  }
15847
15899
  }
@@ -15852,19 +15904,13 @@ ${preamble}` : `[${tableKey}]`;
15852
15904
  ${tables}` : preamble || tables;
15853
15905
  }
15854
15906
  __name$6(stringifyTable$1, "stringifyTable");
15855
- function stringify$4(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
15907
+ function stringify$1(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
15856
15908
  if (extendedTypeOf$1(obj) !== "object") throw new TypeError("stringify can only be called with an object");
15857
- let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat);
15909
+ let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
15858
15910
  if (str[str.length - 1] !== "\n") return str + "\n";
15859
15911
  return str;
15860
15912
  }
15861
- __name$6(stringify$4, "stringify");
15862
- var dist_default$3 = {
15863
- parse: parse3,
15864
- stringify: stringify$4,
15865
- TomlDate: TomlDate$1,
15866
- TomlError: TomlError$1
15867
- };
15913
+ __name$6(stringify$1, "stringify");
15868
15914
  var ParseError = class extends UserError {
15869
15915
  static {
15870
15916
  __name$6(this, "ParseError");
@@ -15931,9 +15977,9 @@ var APIError = class extends ParseError {
15931
15977
  };
15932
15978
  function parseTOML(tomlContent, filePath) {
15933
15979
  try {
15934
- return dist_default$3.parse(tomlContent);
15980
+ return parse3(tomlContent);
15935
15981
  } catch (err) {
15936
- if (!(err instanceof TomlError$1)) throw err;
15982
+ if (!(err instanceof TomlError)) throw err;
15937
15983
  const location = {
15938
15984
  lineText: tomlContent.split("\n")[err.line - 1],
15939
15985
  line: err.line,
@@ -16313,14 +16359,14 @@ function configFileName(configPath) {
16313
16359
  }
16314
16360
  __name$6(configFileName, "configFileName");
16315
16361
  function formatConfigSnippet(snippet, configPath, formatted = true) {
16316
- if (configFormat(configPath) === "toml") return dist_default$3.stringify(snippet);
16362
+ if (configFormat(configPath) === "toml") return stringify$1(snippet);
16317
16363
  else return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
16318
16364
  }
16319
16365
  __name$6(formatConfigSnippet, "formatConfigSnippet");
16320
16366
 
16321
16367
  //#endregion
16322
- //#region ../workers-utils/dist/chunk-4PNP2TCS.mjs
16323
- var DEFAULT_COMPAT_DATE = "2026-09-21";
16368
+ //#region ../workers-utils/dist/chunk-DKSA7K25.mjs
16369
+ var DEFAULT_COMPAT_DATE = "2026-09-23";
16324
16370
  function assertNever(_value) {}
16325
16371
  __name$6(assertNever, "assertNever");
16326
16372
  function mapWorkerMetadataBindings(bindings) {
@@ -18370,7 +18416,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/un
18370
18416
  const { IncomingMessage } = __require$3("node:http");
18371
18417
  const stream$1 = __require$3("node:stream");
18372
18418
  const net$4 = __require$3("node:net");
18373
- const { stringify: stringify$3 } = __require$3("node:querystring");
18419
+ const { stringify: stringify$4 } = __require$3("node:querystring");
18374
18420
  const { EventEmitter: EE$3 } = __require$3("node:events");
18375
18421
  const timers$1 = require_timers();
18376
18422
  const { InvalidArgumentError: InvalidArgumentError$37, ConnectTimeoutError } = require_errors();
@@ -18445,7 +18491,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/un
18445
18491
  */
18446
18492
  function serializePathWithQuery$4(url$2, queryParams) {
18447
18493
  if (pathHasQueryOrFragment$1(url$2)) throw new Error("Query params cannot be passed when url already contains \"?\" or \"#\".");
18448
- const stringified = stringify$3(queryParams);
18494
+ const stringified = stringify$4(queryParams);
18449
18495
  if (stringified) url$2 += "?" + stringified;
18450
18496
  return url$2;
18451
18497
  }
@@ -21271,7 +21317,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/
21271
21317
  * @param {{ position: number }} position
21272
21318
  * @param {boolean} [extractValue=false]
21273
21319
  */
21274
- function collectAnHTTPQuotedString$1(input, position, extractValue$2 = false) {
21320
+ function collectAnHTTPQuotedString$1(input, position, extractValue$1 = false) {
21275
21321
  const positionStart = position.position;
21276
21322
  let value = "";
21277
21323
  assert$30(input[position.position] === "\"");
@@ -21293,7 +21339,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/
21293
21339
  break;
21294
21340
  }
21295
21341
  }
21296
- if (extractValue$2) return value;
21342
+ if (extractValue$1) return value;
21297
21343
  return input.slice(positionStart, position.position);
21298
21344
  }
21299
21345
  /**
@@ -36521,7 +36567,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/un
36521
36567
  * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
36522
36568
  * @param {import('./index').Cookie} cookie
36523
36569
  */
36524
- function stringify$2(cookie) {
36570
+ function stringify$3(cookie) {
36525
36571
  if (cookie.name.length === 0) return null;
36526
36572
  validateCookieName(cookie.name);
36527
36573
  validateCookieValue(cookie.value);
@@ -36565,7 +36611,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/un
36565
36611
  validateCookiePath,
36566
36612
  validateCookieValue,
36567
36613
  toIMFDate,
36568
- stringify: stringify$2
36614
+ stringify: stringify$3
36569
36615
  };
36570
36616
  }) });
36571
36617
 
@@ -36676,7 +36722,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/u
36676
36722
  //#region ../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js
36677
36723
  var require_cookies = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js": ((exports, module) => {
36678
36724
  const { parseSetCookie } = require_parse$2();
36679
- const { stringify: stringify$1 } = require_util$2();
36725
+ const { stringify: stringify$2 } = require_util$2();
36680
36726
  const { webidl: webidl$5 } = require_webidl();
36681
36727
  const { Headers: Headers$3 } = require_headers();
36682
36728
  const brandChecks = webidl$5.brandCheckMultiple([Headers$3, globalThis.Headers].filter(Boolean));
@@ -36757,7 +36803,7 @@ var require_cookies = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/u
36757
36803
  webidl$5.argumentLengthCheck(arguments, 2, "setCookie");
36758
36804
  brandChecks(headers);
36759
36805
  cookie = webidl$5.converters.Cookie(cookie);
36760
- const str = stringify$1(cookie);
36806
+ const str = stringify$2(cookie);
36761
36807
  if (str) headers.append("set-cookie", str, true);
36762
36808
  }
36763
36809
  webidl$5.converters.DeleteCookieAttributes = webidl$5.dictionaryConverter([{
@@ -40337,7 +40383,7 @@ var require_utils$1 = __commonJS$2({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
40337
40383
  var ini = require_ini();
40338
40384
  var path6 = __require$2("path");
40339
40385
  var stripJsonComments = require_strip_json_comments();
40340
- var parse$14 = exports$1.parse = function(content) {
40386
+ var parse$13 = exports$1.parse = function(content) {
40341
40387
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
40342
40388
  return ini.parse(content);
40343
40389
  };
@@ -40355,7 +40401,7 @@ var require_utils$1 = __commonJS$2({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
40355
40401
  };
40356
40402
  exports$1.json = function() {
40357
40403
  var content = file$2.apply(null, arguments);
40358
- return content ? parse$14(content) : null;
40404
+ return content ? parse$13(content) : null;
40359
40405
  };
40360
40406
  exports$1.env = function(prefix, env2) {
40361
40407
  env2 = env2 || process.env;
@@ -40635,11 +40681,11 @@ var require_rc = __commonJS$2({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40635
40681
  var etc = "/etc";
40636
40682
  var win = process.platform === "win32";
40637
40683
  var home = win ? process.env.USERPROFILE : process.env.HOME;
40638
- module$1.exports = function(name, defaults, argv$1, parse$14) {
40684
+ module$1.exports = function(name, defaults, argv$1, parse$13) {
40639
40685
  if ("string" !== typeof name) throw new Error("rc(name): name *must* be string");
40640
40686
  if (!argv$1) argv$1 = require_minimist()(process.argv.slice(2));
40641
40687
  defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
40642
- parse$14 = parse$14 || cc.parse;
40688
+ parse$13 = parse$13 || cc.parse;
40643
40689
  var env$3 = cc.env(name + "_");
40644
40690
  var configs = [defaults];
40645
40691
  var configFiles = [];
@@ -40647,7 +40693,7 @@ var require_rc = __commonJS$2({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40647
40693
  if (configFiles.indexOf(file$2) >= 0) return;
40648
40694
  var fileConfig = cc.file(file$2);
40649
40695
  if (fileConfig) {
40650
- configs.push(parse$14(fileConfig));
40696
+ configs.push(parse$13(fileConfig));
40651
40697
  configFiles.push(file$2);
40652
40698
  }
40653
40699
  }
@@ -42644,6 +42690,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
42644
42690
  };
42645
42691
  warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
42646
42692
  errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
42693
+ validateWorkflowExportConflicts(diagnostics, environment.exports);
42647
42694
  const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
42648
42695
  validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
42649
42696
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
@@ -42922,14 +42969,93 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name$6((diagnostics, field,
42922
42969
  return isValid;
42923
42970
  }, "validateDurableObjectBinding");
42924
42971
  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.`;
42925
- function validateWorkflowRetentionValue(diagnostics, field, key, value) {
42972
+ function validateWorkflowRetentionValue(diagnostics, field, kind, key, value) {
42926
42973
  const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
42927
42974
  const isValidString = typeof value === "string" && value.length > 0;
42928
42975
  if (isValidNumber || isValidString) return true;
42929
- 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)}.`);
42976
+ 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)}.`);
42930
42977
  return false;
42931
42978
  }
42932
42979
  __name$6(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
42980
+ function validateWorkflowSchedules(diagnostics, field, kind, value) {
42981
+ const { schedules } = value;
42982
+ if (schedules === void 0) return true;
42983
+ if (typeof schedules === "string") {
42984
+ if (schedules.length === 0) {
42985
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty string.`);
42986
+ return false;
42987
+ }
42988
+ return true;
42989
+ }
42990
+ if (Array.isArray(schedules)) {
42991
+ if (schedules.length === 0) {
42992
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty array.`);
42993
+ return false;
42994
+ }
42995
+ if (!schedules.every((s) => typeof s === "string")) {
42996
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
42997
+ return false;
42998
+ }
42999
+ if (schedules.some((s) => s === "")) {
43000
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not contain empty strings.`);
43001
+ return false;
43002
+ }
43003
+ return true;
43004
+ }
43005
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43006
+ return false;
43007
+ }
43008
+ __name$6(validateWorkflowSchedules, "validateWorkflowSchedules");
43009
+ function validateWorkflowLimits(diagnostics, field, kind, value) {
43010
+ const { limits } = value;
43011
+ if (limits === void 0) return true;
43012
+ if (typeof limits !== "object" || limits === null || Array.isArray(limits)) {
43013
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
43014
+ return false;
43015
+ }
43016
+ let valid$2 = true;
43017
+ const { steps } = limits;
43018
+ if (steps !== void 0) {
43019
+ if (typeof steps !== "number" || !Number.isInteger(steps) || steps < 1) {
43020
+ diagnostics.errors.push(`"${field}" ${kind} "limits.steps" field must be a positive integer but got ${JSON.stringify(steps)}.`);
43021
+ valid$2 = false;
43022
+ } 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.`);
43023
+ }
43024
+ validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
43025
+ return valid$2;
43026
+ }
43027
+ __name$6(validateWorkflowLimits, "validateWorkflowLimits");
43028
+ function validateWorkflowDefaultRetention(diagnostics, field, kind, value) {
43029
+ const { default_retention: defaultRetention } = value;
43030
+ if (defaultRetention === void 0) return true;
43031
+ if (typeof defaultRetention !== "object" || defaultRetention === null || Array.isArray(defaultRetention)) {
43032
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
43033
+ return false;
43034
+ }
43035
+ let valid$2 = true;
43036
+ const retention = defaultRetention;
43037
+ for (const key of ["success_retention", "error_retention"]) if (retention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, kind, key, retention[key])) valid$2 = false;
43038
+ validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(retention), ["success_retention", "error_retention"]);
43039
+ return valid$2;
43040
+ }
43041
+ __name$6(validateWorkflowDefaultRetention, "validateWorkflowDefaultRetention");
43042
+ function validateWorkflowConcurrency(diagnostics, field, kind, value) {
43043
+ const { concurrency } = value;
43044
+ if (concurrency === void 0) return true;
43045
+ if (typeof concurrency !== "object" || concurrency === null || Array.isArray(concurrency)) {
43046
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43047
+ return false;
43048
+ }
43049
+ let valid$2 = true;
43050
+ const { limit } = concurrency;
43051
+ if (limit !== void 0 && (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1)) {
43052
+ diagnostics.errors.push(`"${field}" ${kind} "concurrency.limit" field must be a positive integer but got ${JSON.stringify(limit)}.`);
43053
+ valid$2 = false;
43054
+ }
43055
+ validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43056
+ return valid$2;
43057
+ }
43058
+ __name$6(validateWorkflowConcurrency, "validateWorkflowConcurrency");
42933
43059
  var validateWorkflowBinding = /* @__PURE__ */ __name$6((diagnostics, field, value) => {
42934
43060
  if (typeof value !== "object" || value === null) {
42935
43061
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -42955,58 +43081,11 @@ var validateWorkflowBinding = /* @__PURE__ */ __name$6((diagnostics, field, valu
42955
43081
  diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(value)}.`);
42956
43082
  isValid = false;
42957
43083
  }
42958
- if (hasProperty(value, "schedules") && value.schedules !== void 0) if (typeof value.schedules === "string") {
42959
- if (value.schedules.length === 0) {
42960
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty string.`);
42961
- isValid = false;
42962
- }
42963
- } else if (Array.isArray(value.schedules)) {
42964
- if (value.schedules.length === 0) {
42965
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty array.`);
42966
- isValid = false;
42967
- } else if (!value.schedules.every((s) => typeof s === "string")) {
42968
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
42969
- isValid = false;
42970
- } else if (value.schedules.some((s) => s === "")) {
42971
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not contain empty strings.`);
42972
- isValid = false;
42973
- }
42974
- } else {
42975
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
42976
- isValid = false;
42977
- }
42978
- if (hasProperty(value, "limits") && value.limits !== void 0) if (typeof value.limits !== "object" || value.limits === null || Array.isArray(value.limits)) {
42979
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
42980
- isValid = false;
42981
- } else {
42982
- const limits = value.limits;
42983
- if (limits.steps !== void 0) {
42984
- if (typeof limits.steps !== "number" || !Number.isInteger(limits.steps) || limits.steps < 1) {
42985
- diagnostics.errors.push(`"${field}" bindings "limits.steps" field must be a positive integer but got ${JSON.stringify(limits.steps)}.`);
42986
- isValid = false;
42987
- } 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.`);
42988
- }
42989
- validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
42990
- }
42991
- 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)) {
42992
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
42993
- isValid = false;
42994
- } else {
42995
- const defaultRetention = value.default_retention;
42996
- for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, key, defaultRetention[key])) isValid = false;
42997
- validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
42998
- }
42999
- if (hasProperty(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
43000
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43001
- isValid = false;
43002
- } else {
43003
- const concurrency = value.concurrency;
43004
- if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
43005
- diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
43006
- isValid = false;
43007
- }
43008
- validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43009
- }
43084
+ const settings = value;
43085
+ isValid = validateWorkflowSchedules(diagnostics, field, "bindings", settings) && isValid;
43086
+ isValid = validateWorkflowLimits(diagnostics, field, "bindings", settings) && isValid;
43087
+ isValid = validateWorkflowDefaultRetention(diagnostics, field, "bindings", settings) && isValid;
43088
+ isValid = validateWorkflowConcurrency(diagnostics, field, "bindings", settings) && isValid;
43010
43089
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
43011
43090
  "binding",
43012
43091
  "name",
@@ -43207,6 +43286,13 @@ function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
43207
43286
  }
43208
43287
  }
43209
43288
  __name$6(validateSshPublicKeys, "validateSshPublicKeys");
43289
+ function validateContainerSshConfig(diagnostics, field, value) {
43290
+ const sshConfig = typeof value === "object" && value !== null ? value : {};
43291
+ if (!isRequiredProperty(sshConfig, "enabled", "boolean")) diagnostics.errors.push(`${field}.enabled must be a boolean`);
43292
+ const port = "port" in sshConfig ? sshConfig.port : void 0;
43293
+ 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`);
43294
+ }
43295
+ __name$6(validateContainerSshConfig, "validateContainerSshConfig");
43210
43296
  function validatePreviewsContainers(envName, configPath) {
43211
43297
  const innerValidator = validateContainerApp(envName, void 0, configPath, { generateDefaultName: false });
43212
43298
  return (diagnostics, field, value, config$2) => {
@@ -43358,9 +43444,13 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43358
43444
  "scheduling_policy",
43359
43445
  "images",
43360
43446
  "observability",
43447
+ "ssh",
43448
+ "authorized_keys",
43361
43449
  "unsafe"
43362
43450
  ].includes(key));
43363
- 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.`);
43451
+ 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.`);
43452
+ if ("ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43453
+ if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43364
43454
  continue;
43365
43455
  }
43366
43456
  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.`);
@@ -43471,23 +43561,11 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43471
43561
  "vcpu",
43472
43562
  "memory_mib"
43473
43563
  ]);
43474
- let sshField;
43475
- let sshConfig;
43476
43564
  if ("ssh" in containerAppOptional) {
43477
- sshField = "ssh";
43478
- sshConfig = containerAppOptional.ssh;
43565
+ validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43479
43566
  containerAppOptional.wrangler_ssh = containerAppOptional.ssh;
43480
43567
  delete containerAppOptional.ssh;
43481
- } else if ("wrangler_ssh" in containerAppOptional) {
43482
- sshField = "wrangler_ssh";
43483
- sshConfig = containerAppOptional.wrangler_ssh;
43484
- }
43485
- if (sshField !== void 0) {
43486
- const sshConfigObject = typeof sshConfig === "object" && sshConfig !== null ? sshConfig : {};
43487
- if (!isRequiredProperty(sshConfigObject, "enabled", "boolean")) diagnostics.errors.push(`${field}.${sshField}.enabled must be a boolean`);
43488
- const sshPort = "port" in sshConfigObject ? sshConfigObject.port : void 0;
43489
- 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`);
43490
- }
43568
+ } else if ("wrangler_ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.wrangler_ssh`, containerAppOptional.wrangler_ssh);
43491
43569
  if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43492
43570
  if ("trusted_user_ca_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.trusted_user_ca_keys`, containerAppOptional.trusted_user_ca_keys, false);
43493
43571
  if (validateOptionalProperty(diagnostics, field, "constraints", containerAppOptional.constraints, "object") && containerAppOptional.constraints) {
@@ -44205,16 +44283,23 @@ var validateConnectHandler = /* @__PURE__ */ __name$6((diagnostics, field, value
44205
44283
  return false;
44206
44284
  }
44207
44285
  let isValid = true;
44208
- if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), [
44286
+ const connectHandler = value;
44287
+ if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), connectHandler.protocol === "udp" ? [
44288
+ "protocol",
44289
+ "port",
44290
+ "address",
44291
+ "idle_timeout_ms",
44292
+ "max_pending_bytes"
44293
+ ] : [
44209
44294
  "protocol",
44210
44295
  "port",
44211
44296
  "address"
44212
44297
  ])) isValid = false;
44213
- if ("protocol" in value && value.protocol !== "tcp") {
44214
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value.protocol)}.`);
44298
+ if ("protocol" in value && value.protocol !== "tcp" && value.protocol !== "udp") {
44299
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value.protocol)}.`);
44215
44300
  isValid = false;
44216
44301
  } else if (!("protocol" in value)) {
44217
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value)}.`);
44302
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value)}.`);
44218
44303
  isValid = false;
44219
44304
  }
44220
44305
  if (!isRequiredProperty(value, "port", "number")) {
@@ -44228,6 +44313,14 @@ var validateConnectHandler = /* @__PURE__ */ __name$6((diagnostics, field, value
44228
44313
  diagnostics.errors.push(`"${field}" should, optionally, have a string "address" field but got ${JSON.stringify(value)}.`);
44229
44314
  isValid = false;
44230
44315
  }
44316
+ if (connectHandler.protocol === "udp") for (const option of ["idle_timeout_ms", "max_pending_bytes"]) {
44317
+ if (!(option in connectHandler)) continue;
44318
+ const optionValue = connectHandler[option];
44319
+ if (typeof optionValue !== "number" || !Number.isInteger(optionValue) || optionValue < 0 || optionValue > 4294967295) {
44320
+ diagnostics.errors.push(`"${field}" should have an integer "${option}" field between 0 and 4294967295 but got ${JSON.stringify(value)}.`);
44321
+ isValid = false;
44322
+ }
44323
+ }
44231
44324
  return isValid;
44232
44325
  }, "validateConnectHandler");
44233
44326
  var validateCompatibilityDate = /* @__PURE__ */ __name$6((diagnostics, field, value) => {
@@ -44668,6 +44761,29 @@ function validateWorkerExportCache(diagnostics, field, value) {
44668
44761
  return valid$2;
44669
44762
  }
44670
44763
  __name$6(validateWorkerExportCache, "validateWorkerExportCache");
44764
+ function validateWorkflowExport(diagnostics, exportName, workflowExport) {
44765
+ const field = `exports.${exportName}`;
44766
+ let valid$2 = true;
44767
+ valid$2 = validateRequiredProperty(diagnostics, field, "name", workflowExport.name, "string") && valid$2;
44768
+ if (typeof workflowExport.name === "string" && !isValidWorkflowName(workflowExport.name)) {
44769
+ diagnostics.errors.push(`"${field}.name" is invalid. ${workflowNameFormatMessage}`);
44770
+ valid$2 = false;
44771
+ }
44772
+ valid$2 = validateWorkflowSchedules(diagnostics, field, "export", workflowExport) && valid$2;
44773
+ valid$2 = validateWorkflowLimits(diagnostics, field, "export", workflowExport) && valid$2;
44774
+ valid$2 = validateWorkflowDefaultRetention(diagnostics, field, "export", workflowExport) && valid$2;
44775
+ valid$2 = validateWorkflowConcurrency(diagnostics, field, "export", workflowExport) && valid$2;
44776
+ valid$2 = validateAdditionalProperties(diagnostics, field, Object.keys(workflowExport), [
44777
+ "type",
44778
+ "name",
44779
+ "limits",
44780
+ "concurrency",
44781
+ "schedules",
44782
+ "default_retention"
44783
+ ]) && valid$2;
44784
+ return valid$2;
44785
+ }
44786
+ __name$6(validateWorkflowExport, "validateWorkflowExport");
44671
44787
  var validateExports = /* @__PURE__ */ __name$6((diagnostics, field, value) => {
44672
44788
  if (value === void 0 || value === null) return true;
44673
44789
  if (typeof value !== "object" || Array.isArray(value)) {
@@ -44683,9 +44799,10 @@ var validateExports = /* @__PURE__ */ __name$6((diagnostics, field, value) => {
44683
44799
  }
44684
44800
  if (exportConfig.type === "durable-object") valid$2 = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid$2;
44685
44801
  else if (exportConfig.type === "worker") valid$2 = validateWorkerExport(diagnostics, exportName, exportConfig) && valid$2;
44802
+ else if (exportConfig.type === "workflow") valid$2 = validateWorkflowExport(diagnostics, exportName, exportConfig) && valid$2;
44686
44803
  else {
44687
44804
  valid$2 = false;
44688
- diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`);
44805
+ diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object", "worker", or "workflow", but got ${JSON.stringify(exportConfig.type)}.`);
44689
44806
  }
44690
44807
  }
44691
44808
  return valid$2;
@@ -44883,8 +45000,7 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
44883
45000
  const exportsCovers = /* @__PURE__ */ __name$6((className) => {
44884
45001
  const entry = exports$1?.[className];
44885
45002
  if (entry === void 0 || entry.type !== "durable-object") return false;
44886
- const state = entry.state ?? "created";
44887
- return state === "created" || state === "expecting-transfer";
45003
+ return isLiveDurableObjectExport(entry);
44888
45004
  }, "exportsCovers");
44889
45005
  const uncoveredByExports = exportedDurableObjects.filter((binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name));
44890
45006
  if (uncoveredByExports.length === 0 || migrations.length > 0) return;
@@ -44907,6 +45023,19 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
44907
45023
  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.`);
44908
45024
  }
44909
45025
  __name$6(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
45026
+ function validateWorkflowExportConflicts(diagnostics, exports$1) {
45027
+ const classNamesByWorkflowName = /* @__PURE__ */ new Map();
45028
+ for (const [className, workflowExport] of Object.entries(partitionExports(exports$1).workflow)) {
45029
+ if (typeof workflowExport.name !== "string") continue;
45030
+ const existing = classNamesByWorkflowName.get(workflowExport.name);
45031
+ if (existing !== void 0) {
45032
+ diagnostics.errors.push(`"exports.${existing}" and "exports.${className}" both declare the Workflow "${workflowExport.name}". Workflow names must be unique.`);
45033
+ continue;
45034
+ }
45035
+ classNamesByWorkflowName.set(workflowExport.name, className);
45036
+ }
45037
+ }
45038
+ __name$6(validateWorkflowExportConflicts, "validateWorkflowExportConflicts");
44910
45039
  function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44911
45040
  if (containers !== void 0 && !Array.isArray(containers)) return;
44912
45041
  if (containers === void 0 && containersDeclaredElsewhere) return;
@@ -46776,9 +46905,9 @@ function getInstalledVersion(binPath) {
46776
46905
  }
46777
46906
  __name$6(getInstalledVersion, "getInstalledVersion");
46778
46907
  function isVersionOutdated(installed, latest) {
46779
- const parse$14 = /* @__PURE__ */ __name$6((v) => v.split(".").map(Number), "parse");
46780
- const [iYear, iMonth, iPatch] = parse$14(installed);
46781
- const [lYear, lMonth, lPatch] = parse$14(latest);
46908
+ const parse$13 = /* @__PURE__ */ __name$6((v) => v.split(".").map(Number), "parse");
46909
+ const [iYear, iMonth, iPatch] = parse$13(installed);
46910
+ const [lYear, lMonth, lPatch] = parse$13(latest);
46782
46911
  if (iYear !== lYear) return iYear < lYear;
46783
46912
  if (iMonth !== lMonth) return iMonth < lMonth;
46784
46913
  return iPatch < lPatch;
@@ -47819,7 +47948,7 @@ var require_semver$1 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/
47819
47948
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
47820
47949
  var require_parse$1 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js": ((exports, module) => {
47821
47950
  const SemVer$14 = require_semver$1();
47822
- const parse$11 = (version$6, options, throwErrors = false) => {
47951
+ const parse$10 = (version$6, options, throwErrors = false) => {
47823
47952
  if (version$6 instanceof SemVer$14) return version$6;
47824
47953
  try {
47825
47954
  return new SemVer$14(version$6, options);
@@ -47828,15 +47957,15 @@ var require_parse$1 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/s
47828
47957
  throw er;
47829
47958
  }
47830
47959
  };
47831
- module.exports = parse$11;
47960
+ module.exports = parse$10;
47832
47961
  }) });
47833
47962
 
47834
47963
  //#endregion
47835
47964
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
47836
47965
  var require_valid$1 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js": ((exports, module) => {
47837
- const parse$10 = require_parse$1();
47966
+ const parse$9 = require_parse$1();
47838
47967
  const valid$1 = (version$6, options) => {
47839
- const v = parse$10(version$6, options);
47968
+ const v = parse$9(version$6, options);
47840
47969
  return v ? v.version : null;
47841
47970
  };
47842
47971
  module.exports = valid$1;
@@ -47845,9 +47974,9 @@ var require_valid$1 = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/s
47845
47974
  //#endregion
47846
47975
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
47847
47976
  var require_clean = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js": ((exports, module) => {
47848
- const parse$9 = require_parse$1();
47977
+ const parse$8 = require_parse$1();
47849
47978
  const clean$1 = (version$6, options) => {
47850
- const s = parse$9(version$6.trim().replace(/^[=v]+/, ""), options);
47979
+ const s = parse$8(version$6.trim().replace(/^[=v]+/, ""), options);
47851
47980
  return s ? s.version : null;
47852
47981
  };
47853
47982
  module.exports = clean$1;
@@ -47875,10 +48004,10 @@ var require_inc = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semve
47875
48004
  //#endregion
47876
48005
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
47877
48006
  var require_diff = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js": ((exports, module) => {
47878
- const parse$8 = require_parse$1();
48007
+ const parse$7 = require_parse$1();
47879
48008
  const diff$1 = (version1, version2) => {
47880
- const v1 = parse$8(version1, null, true);
47881
- const v2 = parse$8(version2, null, true);
48009
+ const v1 = parse$7(version1, null, true);
48010
+ const v2 = parse$7(version2, null, true);
47882
48011
  const comparison = v1.compare(v2);
47883
48012
  if (comparison === 0) return null;
47884
48013
  const v1Higher = comparison > 0;
@@ -47928,9 +48057,9 @@ var require_patch = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/sem
47928
48057
  //#endregion
47929
48058
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
47930
48059
  var require_prerelease = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js": ((exports, module) => {
47931
- const parse$7 = require_parse$1();
48060
+ const parse$6 = require_parse$1();
47932
48061
  const prerelease$1 = (version$6, options) => {
47933
- const parsed = parse$7(version$6, options);
48062
+ const parsed = parse$6(version$6, options);
47934
48063
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
47935
48064
  };
47936
48065
  module.exports = prerelease$1;
@@ -48073,7 +48202,7 @@ var require_cmp = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semve
48073
48202
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js
48074
48203
  var require_coerce = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js": ((exports, module) => {
48075
48204
  const SemVer$7 = require_semver$1();
48076
- const parse$6 = require_parse$1();
48205
+ const parse$5 = require_parse$1();
48077
48206
  const { safeRe: re$2, t: t$2 } = require_re();
48078
48207
  const coerce$1 = (version$6, options) => {
48079
48208
  if (version$6 instanceof SemVer$7) return version$6;
@@ -48093,7 +48222,7 @@ var require_coerce = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/se
48093
48222
  }
48094
48223
  if (match === null) return null;
48095
48224
  const major$2 = match[2];
48096
- return parse$6(`${major$2}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
48225
+ return parse$5(`${major$2}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
48097
48226
  };
48098
48227
  module.exports = coerce$1;
48099
48228
  }) });
@@ -48825,7 +48954,7 @@ var require_semver = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/se
48825
48954
  const constants$5 = require_constants$2();
48826
48955
  const SemVer = require_semver$1();
48827
48956
  const identifiers = require_identifiers();
48828
- const parse$5 = require_parse$1();
48957
+ const parse$4 = require_parse$1();
48829
48958
  const valid = require_valid$1();
48830
48959
  const clean = require_clean();
48831
48960
  const inc = require_inc();
@@ -48863,7 +48992,7 @@ var require_semver = /* @__PURE__ */ __commonJS$3({ "../../node_modules/.pnpm/se
48863
48992
  const simplifyRange = require_simplify();
48864
48993
  const subset = require_subset();
48865
48994
  module.exports = {
48866
- parse: parse$5,
48995
+ parse: parse$4,
48867
48996
  valid,
48868
48997
  clean,
48869
48998
  inc,
@@ -52049,7 +52178,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
52049
52178
  }
52050
52179
  return result.value;
52051
52180
  };
52052
- const parse$4 = /* @__PURE__ */ _parse($ZodRealError);
52181
+ const parse$3 = /* @__PURE__ */ _parse($ZodRealError);
52053
52182
  const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
52054
52183
  const ctx = _ctx ? {
52055
52184
  ..._ctx,
@@ -55198,7 +55327,7 @@ const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Par
55198
55327
 
55199
55328
  //#endregion
55200
55329
  //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
55201
- const parse$3 = /* @__PURE__ */ _parse(ZodRealError);
55330
+ const parse$2 = /* @__PURE__ */ _parse(ZodRealError);
55202
55331
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
55203
55332
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
55204
55333
  const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -55259,7 +55388,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
55259
55388
  inst.def = def;
55260
55389
  inst.type = def.type;
55261
55390
  Object.defineProperty(inst, "_def", { value: def });
55262
- inst.parse = (data$1, params) => parse$3(inst, data$1, params, { callee: inst.parse });
55391
+ inst.parse = (data$1, params) => parse$2(inst, data$1, params, { callee: inst.parse });
55263
55392
  inst.safeParse = (data$1, params) => safeParse(inst, data$1, params);
55264
55393
  inst.parseAsync = async (data$1, params) => parseAsync(inst, data$1, params, { callee: inst.parseAsync });
55265
55394
  inst.safeParseAsync = async (data$1, params) => safeParseAsync(inst, data$1, params);
@@ -56494,6 +56623,18 @@ const WorkerEntrypointExportSchema = strictObject({
56494
56623
  type: literal$1("worker"),
56495
56624
  cache: strictObject({ enabled: boolean() }).optional()
56496
56625
  });
56626
+ const WorkflowRetentionSchema = union([number().int().min(1), string().min(1)]);
56627
+ const WorkflowExportSchema = strictObject({
56628
+ type: literal$1("workflow"),
56629
+ name: string(),
56630
+ limits: strictObject({ steps: number().int().min(1).optional() }).optional(),
56631
+ concurrency: strictObject({ limit: number().int().min(1).optional() }).optional(),
56632
+ schedules: union([string().min(1), array(string().min(1)).min(1)]).optional(),
56633
+ default_retention: strictObject({
56634
+ success_retention: WorkflowRetentionSchema.optional(),
56635
+ error_retention: WorkflowRetentionSchema.optional()
56636
+ }).optional()
56637
+ });
56497
56638
  const DurableObjectCreatedSqliteExportSchema = DurableObjectCreatedExportSchema.extend({ storage: literal$1("sqlite") });
56498
56639
  const DurableObjectCreatedLegacyKvExportSchema = DurableObjectCreatedExportSchema.omit({ container: true }).extend({ storage: literal$1("legacy-kv") });
56499
56640
  const DurableObjectExpectingTransferSqliteExportSchema = DurableObjectExpectingTransferExportSchema.extend({ storage: literal$1("sqlite") });
@@ -56506,7 +56647,8 @@ const ExportSchema = union([
56506
56647
  DurableObjectTransferredExportSchema,
56507
56648
  DurableObjectExpectingTransferSqliteExportSchema,
56508
56649
  DurableObjectExpectingTransferLegacyKvExportSchema,
56509
- WorkerEntrypointExportSchema
56650
+ WorkerEntrypointExportSchema,
56651
+ WorkflowExportSchema
56510
56652
  ]);
56511
56653
  const LimitsSchema = strictObject({
56512
56654
  cpuMs: number().optional(),
@@ -56578,12 +56720,19 @@ const TriggerSchema = discriminatedUnion("type", [
56578
56720
  type: literal$1("scheduled"),
56579
56721
  schedule: string()
56580
56722
  }),
56581
- strictObject({
56723
+ discriminatedUnion("protocol", [strictObject({
56582
56724
  type: literal$1("connect"),
56583
- protocol: _enum(["tcp"]),
56725
+ protocol: literal$1("tcp"),
56584
56726
  port: number(),
56585
56727
  address: string().optional()
56586
- })
56728
+ }), strictObject({
56729
+ type: literal$1("connect"),
56730
+ protocol: literal$1("udp"),
56731
+ port: number(),
56732
+ address: string().optional(),
56733
+ idleTimeoutMs: number().int().min(0).max(4294967295).optional(),
56734
+ maxPendingBytes: number().int().min(0).max(4294967295).optional()
56735
+ })])
56587
56736
  ]);
56588
56737
  const UnsafeSchema = strictObject({
56589
56738
  metadata: record(string(), unknown()).optional(),
@@ -57292,7 +57441,7 @@ function convertExports(config$2, result) {
57292
57441
  const converted = {};
57293
57442
  const unknownExports = {};
57294
57443
  for (const [exportName, value] of Object.entries(exports$2)) {
57295
- if (value.type === "worker") {
57444
+ if (value.type === "worker" || value.type === "workflow") {
57296
57445
  converted[exportName] = value;
57297
57446
  continue;
57298
57447
  }
@@ -57386,7 +57535,11 @@ function convertTriggers(config$2, result) {
57386
57535
  connectHandlers.push(omitUndefined({
57387
57536
  protocol: trigger.protocol,
57388
57537
  port: trigger.port,
57389
- address: trigger.address
57538
+ address: trigger.address,
57539
+ ...trigger.protocol === "udp" ? {
57540
+ idle_timeout_ms: trigger.idleTimeoutMs,
57541
+ max_pending_bytes: trigger.maxPendingBytes
57542
+ } : {}
57390
57543
  }));
57391
57544
  break;
57392
57545
  }
@@ -58223,13 +58376,15 @@ async function readBuildOutput(root) {
58223
58376
  async function readWorkers(root) {
58224
58377
  const workersDir = getWorkersDir(root);
58225
58378
  const defaultWorker = await readWorker(root, DEFAULT_WORKER_DIRECTORY_NAME);
58379
+ if (defaultWorker === void 0) throw new BuildOutputError(`Default Worker at ${getWorkerDir(root, DEFAULT_WORKER_DIRECTORY_NAME)} has neither a bundle directory (${getWorkerBundleDir(root, DEFAULT_WORKER_DIRECTORY_NAME)}) nor an assets directory (${getWorkerAssetsDir(root, DEFAULT_WORKER_DIRECTORY_NAME)}).`);
58226
58380
  const additionalWorkerDirectoryNames = (await fsp.readdir(workersDir, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== DEFAULT_WORKER_DIRECTORY_NAME).map((entry) => entry.name);
58227
58381
  const additionalWorkers = await Promise.all(additionalWorkerDirectoryNames.map(async (workerDirectoryName) => {
58228
- return [workerDirectoryName, await readWorker(root, workerDirectoryName)];
58382
+ const worker = await readWorker(root, workerDirectoryName);
58383
+ return worker === void 0 ? void 0 : [workerDirectoryName, worker];
58229
58384
  }));
58230
58385
  return {
58231
58386
  default: defaultWorker,
58232
- ...Object.fromEntries(additionalWorkers)
58387
+ ...Object.fromEntries(additionalWorkers.filter((entry) => entry !== void 0))
58233
58388
  };
58234
58389
  }
58235
58390
  /** Read and parse all Container configs, if any. */
@@ -58255,7 +58410,8 @@ async function readContainer(root, containerDirectoryName) {
58255
58410
  * Read and parse the Worker's `worker.config.json` and resolve its
58256
58411
  * `bundle/` / `assets/` directories.
58257
58412
  *
58258
- * @returns the Worker, with whichever of its directories exist resolved.
58413
+ * @returns the Worker, with whichever of its directories exist resolved, or
58414
+ * `undefined` when it has no deployable output.
58259
58415
  * @throws {BuildOutputError} if the config is missing, is not valid JSON, or
58260
58416
  * does not match its schema.
58261
58417
  */
@@ -58269,7 +58425,6 @@ async function readWorker(root, workerDirectoryName) {
58269
58425
  const assetsDir = getWorkerAssetsDir(root, workerDirectoryName);
58270
58426
  const hasBundleDir = fs$1.existsSync(bundleDir);
58271
58427
  const hasAssetsDir = fs$1.existsSync(assetsDir);
58272
- if (result.data.manifest && !hasBundleDir) throw new BuildOutputError(`Worker config at ${configPath} contains a manifest, but no bundle directory exists at ${bundleDir}.`);
58273
58428
  if (hasBundleDir) return {
58274
58429
  configPath,
58275
58430
  config: await resolveManifest(result.data, configPath, bundleDir),
@@ -58285,7 +58440,6 @@ async function readWorker(root, workerDirectoryName) {
58285
58440
  assetsDir
58286
58441
  };
58287
58442
  }
58288
- throw new BuildOutputError(`Worker config at ${configPath} has neither a bundle directory (${bundleDir}) nor an assets directory (${assetsDir}).`);
58289
58443
  }
58290
58444
  /** Resolve the manifest against the bundle contents. */
58291
58445
  async function resolveManifest(config$2, configPath, bundleDir) {
@@ -59788,7 +59942,7 @@ var prototypeAccessors = {
59788
59942
  allowUsing: { configurable: true },
59789
59943
  inClassStaticBlock: { configurable: true }
59790
59944
  };
59791
- Parser.prototype.parse = function parse$14() {
59945
+ Parser.prototype.parse = function parse$13() {
59792
59946
  var node = this.options.program || this.startNode();
59793
59947
  this.nextToken();
59794
59948
  return this.parseTopLevel(node);
@@ -59847,7 +60001,7 @@ Parser.extend = function extend$2() {
59847
60001
  for (var i$1 = 0; i$1 < plugins.length; i$1++) cls = plugins[i$1](cls);
59848
60002
  return cls;
59849
60003
  };
59850
- Parser.parse = function parse$14(input, options) {
60004
+ Parser.parse = function parse$13(input, options) {
59851
60005
  return new this(options, input).parse();
59852
60006
  };
59853
60007
  Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
@@ -67184,6 +67338,7 @@ function printLocalExplorerAgentHint(server, mode) {
67184
67338
  `The Local Explorer API is available at ${explorerApiUrl}`,
67185
67339
  `Useful routes:`,
67186
67340
  ` GET ${explorerApiUrl}/local/workers - local Workers and bindings`,
67341
+ ` POST ${explorerApiUrl}/local/scheduled?worker=<name> - invoke a Worker's scheduled handler; cron is required (see the OpenAPI schema for the full request)`,
67187
67342
  ` GET ${explorerApiUrl}/storage/kv/namespaces - KV namespaces`,
67188
67343
  ` GET ${explorerApiUrl}/d1/database - D1 databases`,
67189
67344
  ` GET ${explorerApiUrl}/r2/buckets - R2 buckets`,
@@ -70372,7 +70527,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
70372
70527
  ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
70373
70528
  };
70374
70529
  };
70375
- var dist_default$2 = getStringTruncatedWidth;
70530
+ var dist_default$1 = getStringTruncatedWidth;
70376
70531
 
70377
70532
  //#endregion
70378
70533
  //#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
@@ -70382,9 +70537,9 @@ const NO_TRUNCATION = {
70382
70537
  ellipsisWidth: 0
70383
70538
  };
70384
70539
  const fastStringWidth = (input, options = {}) => {
70385
- return dist_default$2(input, NO_TRUNCATION, options).width;
70540
+ return dist_default$1(input, NO_TRUNCATION, options).width;
70386
70541
  };
70387
- var dist_default$1 = fastStringWidth;
70542
+ var dist_default = fastStringWidth;
70388
70543
 
70389
70544
  //#endregion
70390
70545
  //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
@@ -70417,13 +70572,13 @@ const wrapWord$1 = (rows, word, columns) => {
70417
70572
  let isInsideEscape = false;
70418
70573
  let isInsideLinkEscape = false;
70419
70574
  let lastRow = rows.at(-1);
70420
- let visible = lastRow === void 0 ? 0 : dist_default$1(lastRow);
70575
+ let visible = lastRow === void 0 ? 0 : dist_default(lastRow);
70421
70576
  let currentCharacter = characters.next();
70422
70577
  let nextCharacter = characters.next();
70423
70578
  let rawCharacterIndex = 0;
70424
70579
  while (!currentCharacter.done) {
70425
70580
  const character = currentCharacter.value;
70426
- const characterLength = dist_default$1(character);
70581
+ const characterLength = dist_default(character);
70427
70582
  if (visible + characterLength <= columns) rows[rows.length - 1] += character;
70428
70583
  else {
70429
70584
  rows.push(character);
@@ -70458,7 +70613,7 @@ const stringVisibleTrimSpacesRight$1 = (string$3) => {
70458
70613
  const words = string$3.split(" ");
70459
70614
  let last = words.length;
70460
70615
  while (last) {
70461
- if (dist_default$1(words[last - 1])) break;
70616
+ if (dist_default(words[last - 1])) break;
70462
70617
  last--;
70463
70618
  }
70464
70619
  if (last === words.length) return string$3;
@@ -70479,7 +70634,7 @@ const exec$2 = (string$3, columns, options = {}) => {
70479
70634
  const trimmed = row.trimStart();
70480
70635
  if (row.length !== trimmed.length) {
70481
70636
  rows[rows.length - 1] = trimmed;
70482
- rowLength = dist_default$1(trimmed);
70637
+ rowLength = dist_default(trimmed);
70483
70638
  }
70484
70639
  }
70485
70640
  if (index !== 0) {
@@ -70492,19 +70647,19 @@ const exec$2 = (string$3, columns, options = {}) => {
70492
70647
  rowLength++;
70493
70648
  }
70494
70649
  }
70495
- const wordLength = dist_default$1(word);
70650
+ const wordLength = dist_default(word);
70496
70651
  if (options.hard && wordLength > columns) {
70497
70652
  const remainingColumns = columns - rowLength;
70498
70653
  const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
70499
70654
  if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
70500
70655
  wrapWord$1(rows, word, columns);
70501
- rowLength = dist_default$1(rows.at(-1) ?? "");
70656
+ rowLength = dist_default(rows.at(-1) ?? "");
70502
70657
  continue;
70503
70658
  }
70504
70659
  if (rowLength + wordLength > columns && rowLength && wordLength) {
70505
70660
  if (options.wordWrap === false && rowLength < columns) {
70506
70661
  wrapWord$1(rows, word, columns);
70507
- rowLength = dist_default$1(rows.at(-1) ?? "");
70662
+ rowLength = dist_default(rows.at(-1) ?? "");
70508
70663
  continue;
70509
70664
  }
70510
70665
  rows.push("");
@@ -70512,7 +70667,7 @@ const exec$2 = (string$3, columns, options = {}) => {
70512
70667
  }
70513
70668
  if (rowLength + wordLength > columns && options.wordWrap === false) {
70514
70669
  wrapWord$1(rows, word, columns);
70515
- rowLength = dist_default$1(rows.at(-1) ?? "");
70670
+ rowLength = dist_default(rows.at(-1) ?? "");
70516
70671
  continue;
70517
70672
  }
70518
70673
  rows[rows.length - 1] += word;
@@ -74039,7 +74194,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
74039
74194
  else dest[name].push(elem);
74040
74195
  }
74041
74196
  __name$2(push, "push");
74042
- function parse$14(header) {
74197
+ function parse$13(header) {
74043
74198
  const offers = /* @__PURE__ */ Object.create(null);
74044
74199
  let params = /* @__PURE__ */ Object.create(null);
74045
74200
  let mustUnescape = false;
@@ -74132,7 +74287,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
74132
74287
  }
74133
74288
  return offers;
74134
74289
  }
74135
- __name$2(parse$14, "parse");
74290
+ __name$2(parse$13, "parse");
74136
74291
  function format$3(extensions) {
74137
74292
  return Object.keys(extensions).map((extension2) => {
74138
74293
  let configurations = extensions[extension2];
@@ -74149,7 +74304,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
74149
74304
  __name$2(format$3, "format");
74150
74305
  module$1.exports = {
74151
74306
  format: format$3,
74152
- parse: parse$14
74307
+ parse: parse$13
74153
74308
  };
74154
74309
  } });
74155
74310
  var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js"(exports$1, module$1) {
@@ -74167,7 +74322,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
74167
74322
  var { isBlob: isBlob2 } = require_validation();
74168
74323
  var { BINARY_TYPES, CLOSE_TIMEOUT, EMPTY_BUFFER: EMPTY_BUFFER$1, GUID, kForOnEventAttribute, kListener: kListener$1, kStatusCode, kWebSocket, NOOP } = require_constants$1();
74169
74324
  var { EventTarget: { addEventListener, removeEventListener } } = require_event_target();
74170
- var { format: format$3, parse: parse$14 } = require_extension();
74325
+ var { format: format$3, parse: parse$13 } = require_extension();
74171
74326
  var { toBuffer: toBuffer$1 } = require_buffer_util();
74172
74327
  var kAborted = Symbol("kAborted");
74173
74328
  var protocolVersions = [8, 13];
@@ -74776,7 +74931,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
74776
74931
  }
74777
74932
  let extensions;
74778
74933
  try {
74779
- extensions = parse$14(secWebSocketExtensions);
74934
+ extensions = parse$13(secWebSocketExtensions);
74780
74935
  } catch (err) {
74781
74936
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
74782
74937
  return;
@@ -75060,7 +75215,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
75060
75215
  } });
75061
75216
  var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports$1, module$1) {
75062
75217
  var { tokenChars } = require_validation();
75063
- function parse$14(header) {
75218
+ function parse$13(header) {
75064
75219
  const protocols = /* @__PURE__ */ new Set();
75065
75220
  let start = -1;
75066
75221
  let end = -1;
@@ -75086,8 +75241,8 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
75086
75241
  protocols.add(protocol);
75087
75242
  return protocols;
75088
75243
  }
75089
- __name$2(parse$14, "parse");
75090
- module$1.exports = { parse: parse$14 };
75244
+ __name$2(parse$13, "parse");
75245
+ module$1.exports = { parse: parse$13 };
75091
75246
  } });
75092
75247
  var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports$1, module$1) {
75093
75248
  var EventEmitter$4 = __require$1("events");
@@ -78029,12 +78184,14 @@ async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containe
78029
78184
  ]);
78030
78185
  if (JSON.parse(remoteManifest).Descriptor.digest === hash$1) {
78031
78186
  logger$1.log("Image already exists remotely, skipping push");
78032
- logger$1.debug(`Untagging built image: ${sourceTag} since there was no change.`);
78033
- await runDockerCmd(pathToDocker, [
78034
- "image",
78035
- "rm",
78036
- sourceTag
78037
- ]);
78187
+ if (cleanupSourceTag !== false) {
78188
+ logger$1.debug(`Untagging built image: ${sourceTag} since there was no change.`);
78189
+ await runDockerCmd(pathToDocker, [
78190
+ "image",
78191
+ "rm",
78192
+ sourceTag
78193
+ ]);
78194
+ }
78038
78195
  return { remoteDigest: remoteDigest2 };
78039
78196
  }
78040
78197
  } catch (error$2) {
@@ -80145,7 +80302,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
80145
80302
  });
80146
80303
 
80147
80304
  //#endregion
80148
- //#region ../workers-auth/dist/chunk-XLADBZ7F.mjs
80305
+ //#region ../workers-auth/dist/chunk-WMSASLDV.mjs
80149
80306
  var import_undici$2 = require_undici();
80150
80307
  var hasWarnedAboutDeprecatedV1ApiToken = false;
80151
80308
  function readStoredAuthState(options) {
@@ -81703,589 +81860,21 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
81703
81860
  }
81704
81861
  }
81705
81862
  __name$1(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
81706
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
81707
- var TomlDate = class _TomlDate extends Date {
81708
- static {
81709
- __name$1(this, "TomlDate");
81710
- }
81711
- #hasDate = false;
81712
- #hasTime = false;
81713
- #offset = null;
81714
- constructor(date$3) {
81715
- let hasDate = true;
81716
- let hasTime = true;
81717
- let offset = "Z";
81718
- if (typeof date$3 === "string") {
81719
- let match = date$3.match(DATE_TIME_RE);
81720
- if (match) {
81721
- if (!match[1]) {
81722
- hasDate = false;
81723
- date$3 = `0000-01-01T${date$3}`;
81724
- }
81725
- hasTime = !!match[2];
81726
- hasTime && date$3[10] === " " && (date$3 = date$3.replace(" ", "T"));
81727
- if (match[2] && +match[2] > 23) date$3 = "";
81728
- else {
81729
- offset = match[3] || null;
81730
- date$3 = date$3.toUpperCase();
81731
- if (!offset && hasTime) date$3 += "Z";
81732
- }
81733
- } else date$3 = "";
81734
- }
81735
- super(date$3);
81736
- if (!isNaN(this.getTime())) {
81737
- this.#hasDate = hasDate;
81738
- this.#hasTime = hasTime;
81739
- this.#offset = offset;
81740
- }
81741
- }
81742
- isDateTime() {
81743
- return this.#hasDate && this.#hasTime;
81744
- }
81745
- isLocal() {
81746
- return !this.#hasDate || !this.#hasTime || !this.#offset;
81747
- }
81748
- isDate() {
81749
- return this.#hasDate && !this.#hasTime;
81750
- }
81751
- isTime() {
81752
- return this.#hasTime && !this.#hasDate;
81753
- }
81754
- isValid() {
81755
- return this.#hasDate || this.#hasTime;
81756
- }
81757
- toISOString() {
81758
- let iso = super.toISOString();
81759
- if (this.isDate()) return iso.slice(0, 10);
81760
- if (this.isTime()) return iso.slice(11, 23);
81761
- if (this.#offset === null) return iso.slice(0, -1);
81762
- if (this.#offset === "Z") return iso;
81763
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
81764
- offset = this.#offset[0] === "-" ? offset : -offset;
81765
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
81766
- }
81767
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
81768
- let date$3 = new _TomlDate(jsDate);
81769
- date$3.#offset = offset;
81770
- return date$3;
81771
- }
81772
- static wrapAsLocalDateTime(jsDate) {
81773
- let date$3 = new _TomlDate(jsDate);
81774
- date$3.#offset = null;
81775
- return date$3;
81776
- }
81777
- static wrapAsLocalDate(jsDate) {
81778
- let date$3 = new _TomlDate(jsDate);
81779
- date$3.#hasTime = false;
81780
- date$3.#offset = null;
81781
- return date$3;
81782
- }
81783
- static wrapAsLocalTime(jsDate) {
81784
- let date$3 = new _TomlDate(jsDate);
81785
- date$3.#hasDate = false;
81786
- date$3.#offset = null;
81787
- return date$3;
81788
- }
81789
- };
81790
- function getLineColFromPtr(string$3, ptr) {
81791
- let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
81792
- return [lines.length, lines.pop().length + 1];
81793
- }
81794
- __name$1(getLineColFromPtr, "getLineColFromPtr");
81795
- function makeCodeBlock(string$3, line, column) {
81796
- let lines = string$3.split(/\r\n|\n|\r/g);
81797
- let codeblock = "";
81798
- let numberLen = (Math.log10(line + 1) | 0) + 1;
81799
- for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
81800
- let l = lines[i$1 - 1];
81801
- if (!l) continue;
81802
- codeblock += i$1.toString().padEnd(numberLen, " ");
81803
- codeblock += ": ";
81804
- codeblock += l;
81805
- codeblock += "\n";
81806
- if (i$1 === line) {
81807
- codeblock += " ".repeat(numberLen + column + 2);
81808
- codeblock += "^\n";
81809
- }
81810
- }
81811
- return codeblock;
81812
- }
81813
- __name$1(makeCodeBlock, "makeCodeBlock");
81814
- var TomlError = class extends Error {
81815
- static {
81816
- __name$1(this, "TomlError");
81817
- }
81818
- line;
81819
- column;
81820
- codeblock;
81821
- constructor(message, options) {
81822
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
81823
- const codeblock = makeCodeBlock(options.toml, line, column);
81824
- super(`Invalid TOML document: ${message}
81825
-
81826
- ${codeblock}`, options);
81827
- this.line = line;
81828
- this.column = column;
81829
- this.codeblock = codeblock;
81830
- }
81831
- };
81832
- function indexOfNewline(str, start = 0) {
81833
- let idx = str.indexOf("\n", start);
81834
- if (str.charCodeAt(idx - 1) === 13) idx--;
81835
- return idx;
81836
- }
81837
- __name$1(indexOfNewline, "indexOfNewline");
81838
- function skipComment(ctx) {
81839
- for (; ctx.p < ctx.s.length; ctx.p++) {
81840
- let c$1 = ctx.s.charCodeAt(ctx.p);
81841
- if (c$1 === 10) break;
81842
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
81843
- ctx.p++;
81844
- break;
81845
- }
81846
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in comments", {
81847
- toml: ctx.s,
81848
- ptr: ctx.p
81849
- });
81850
- }
81851
- }
81852
- __name$1(skipComment, "skipComment");
81853
- function skipVoid(ctx, banNewLines, banComments) {
81854
- let c$1;
81855
- while (1) {
81856
- 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++;
81857
- if (banComments || c$1 !== 35) break;
81858
- skipComment(ctx);
81859
- }
81860
- }
81861
- __name$1(skipVoid, "skipVoid");
81862
- function skipUntil(ctx, sep$1, end) {
81863
- let ptr = ctx.p;
81864
- if (!end) {
81865
- ptr = indexOfNewline(ctx.s, ptr);
81866
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
81867
- return;
81868
- }
81869
- for (; ctx.p < ctx.s.length; ctx.p++) {
81870
- let c$1 = ctx.s.charCodeAt(ctx.p);
81871
- if (c$1 === 35) skipComment(ctx);
81872
- else if (c$1 === end || c$1 === sep$1) return;
81873
- }
81874
- throw new TomlError("cannot find end of structure", {
81875
- toml: ctx.s,
81876
- ptr
81877
- });
81878
- }
81879
- __name$1(skipUntil, "skipUntil");
81880
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
81881
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
81882
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
81883
- function parseString(ctx) {
81884
- let start = ctx.p;
81885
- let c$1 = ctx.s.charCodeAt(ctx.p++);
81886
- let first = c$1;
81887
- let isLiteral = c$1 === 39;
81888
- let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
81889
- if (isMultiline) {
81890
- if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
81891
- else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
81892
- }
81893
- let parsed = "";
81894
- let sliceStart = ctx.p;
81895
- let state = 0;
81896
- for (; ctx.p < ctx.s.length; ctx.p++) {
81897
- c$1 = ctx.s.charCodeAt(ctx.p);
81898
- if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
81899
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in strings", {
81900
- toml: ctx.s,
81901
- ptr: ctx.p
81902
- });
81903
- else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
81904
- if (isMultiline) {
81905
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
81906
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
81907
- }
81908
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
81909
- ctx.p += isMultiline ? 3 : 1;
81910
- return parsed;
81911
- } else if (!state) {
81912
- if (!isLiteral && c$1 === 92) {
81913
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
81914
- state = 1;
81915
- }
81916
- } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
81917
- let value = 0;
81918
- let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
81919
- for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
81920
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
81921
- 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;
81922
- if (digit < 0) throw new TomlError("invalid non-hex character in unicode escape", {
81923
- toml: ctx.s,
81924
- ptr: ctx.p + 1
81925
- });
81926
- value = value << 4 | digit;
81927
- }
81928
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError("invalid unicode escape", {
81929
- toml: ctx.s,
81930
- ptr: ctx.p
81931
- });
81932
- parsed += String.fromCodePoint(value);
81933
- sliceStart = ctx.p + 1;
81934
- state = 0;
81935
- } else if (c$1 === 32 || c$1 === 9) state = 2;
81936
- else {
81937
- if (c$1 === 98) parsed += "\b";
81938
- else if (c$1 === 116) parsed += " ";
81939
- else if (c$1 === 110) parsed += "\n";
81940
- else if (c$1 === 102) parsed += "\f";
81941
- else if (c$1 === 114) parsed += "\r";
81942
- else if (c$1 === 101) parsed += "\x1B";
81943
- else if (c$1 === 34) parsed += "\"";
81944
- else if (c$1 === 92) parsed += "\\";
81945
- else throw new TomlError("unrecognized escape sequence", {
81946
- toml: ctx.s,
81947
- ptr: ctx.p
81948
- });
81949
- sliceStart = ctx.p + 1;
81950
- state = 0;
81951
- }
81952
- else if (c$1 !== 32 && c$1 !== 9) {
81953
- if (state === 2) throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
81954
- toml: ctx.s,
81955
- ptr: sliceStart
81956
- });
81957
- state = !isLiteral && c$1 === 92 ? 1 : 0;
81958
- sliceStart = ctx.p;
81959
- }
81960
- }
81961
- throw new TomlError("unfinished string", {
81962
- toml: ctx.s,
81963
- ptr: start
81964
- });
81965
- }
81966
- __name$1(parseString, "parseString");
81967
- function sliceAndTrimEndOf(ctx, start, end) {
81968
- let value = ctx.s.slice(start, end);
81969
- let commentIdx = value.indexOf("#");
81970
- if (commentIdx > 0) {
81971
- skipComment({
81972
- s: value,
81973
- p: commentIdx
81974
- });
81975
- value = value.slice(0, commentIdx);
81976
- }
81977
- return value.trimEnd();
81978
- }
81979
- __name$1(sliceAndTrimEndOf, "sliceAndTrimEndOf");
81980
- function parseValue(ctx, integersAsBigInt, end) {
81981
- let ptr = ctx.p;
81982
- let err = {
81983
- toml: ctx.s,
81984
- ptr
81985
- };
81986
- skipUntil(ctx, 44, end);
81987
- let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
81988
- if (!value) throw new TomlError("incomplete declaration: value expected", err);
81989
- if (value === "-inf") return -Infinity;
81990
- if (value === "inf" || value === "+inf") return Infinity;
81991
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
81992
- if (value === "-0") return integersAsBigInt ? 0n : 0;
81993
- let isInt = INT_REGEX.test(value);
81994
- if (isInt || FLOAT_REGEX.test(value)) {
81995
- if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", err);
81996
- value = value.replace(/_/g, "");
81997
- let numeric$1 = +value;
81998
- if (isNaN(numeric$1)) throw new TomlError("invalid number", err);
81999
- if (isInt) {
82000
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", err);
82001
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
82002
- }
82003
- return numeric$1;
82004
- }
82005
- const date$3 = new TomlDate(value);
82006
- if (!date$3.isValid()) throw new TomlError("invalid value", err);
82007
- return date$3;
82008
- }
82009
- __name$1(parseValue, "parseValue");
82010
- function extractValue(ctx, end, integersAsBigInt) {
82011
- let ptr = ctx.p;
82012
- let c$1 = ctx.s.charCodeAt(ptr);
82013
- if (c$1 === 91 || c$1 === 123) {
82014
- if (!ctx.d--) throw new TomlError("document contains excessively nested structures. aborting.", {
82015
- toml: ctx.s,
82016
- ptr
82017
- });
82018
- let value = c$1 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
82019
- ctx.d++;
82020
- return value;
82021
- }
82022
- if (c$1 === 34 || c$1 === 39) return parseString(ctx);
82023
- if (c$1 === 116) {
82024
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
82025
- toml: ctx.s,
82026
- ptr
82027
- });
82028
- ctx.p++;
82029
- return true;
82030
- }
82031
- if (c$1 === 102) {
82032
- 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", {
82033
- toml: ctx.s,
82034
- ptr
82035
- });
82036
- ctx.p++;
82037
- return false;
82038
- }
82039
- return parseValue(ctx, integersAsBigInt, end);
82040
- }
82041
- __name$1(extractValue, "extractValue");
82042
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
82043
- function parseKey(ctx, end = "=") {
82044
- let start = ctx.p;
82045
- let dot = start - 1;
82046
- let parsed = [];
82047
- let endPtr = ctx.s.indexOf(end, start);
82048
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
82049
- toml: ctx.s,
82050
- ptr: start
82051
- });
82052
- do {
82053
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
82054
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
82055
- 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", {
82056
- toml: ctx.s,
82057
- ptr: ctx.p
82058
- });
82059
- let part = parseString(ctx);
82060
- dot = ctx.s.indexOf(".", ctx.p);
82061
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
82062
- let newLine = indexOfNewline(strEnd);
82063
- if (newLine > -1) throw new TomlError("newlines are not allowed in keys", {
82064
- toml: ctx.s,
82065
- ptr: newLine
82066
- });
82067
- if (strEnd.trimStart()) throw new TomlError("found extra tokens after the string part", {
82068
- toml: ctx.s,
82069
- ptr: ctx.p
82070
- });
82071
- if (endPtr < ctx.p) {
82072
- endPtr = ctx.s.indexOf(end, ctx.p);
82073
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
82074
- toml: ctx.s,
82075
- ptr: start
82076
- });
82077
- }
82078
- parsed.push(part);
82079
- } else {
82080
- dot = ctx.s.indexOf(".", ctx.p);
82081
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
82082
- if (!KEY_PART_RE.test(part)) throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
82083
- toml: ctx.s,
82084
- ptr: ctx.p
82085
- });
82086
- parsed.push(part.trimEnd());
82087
- }
82088
- } while (dot + 1 && dot < endPtr);
82089
- ctx.p = endPtr + 1;
82090
- skipVoid(ctx, true, true);
82091
- return parsed;
82092
- }
82093
- __name$1(parseKey, "parseKey");
82094
- function parseInlineTable(ctx, integersAsBigInt) {
82095
- let res = {};
82096
- let seen = /* @__PURE__ */ new Set();
82097
- let c$1;
82098
- ctx.p++;
82099
- while (ctx.p < ctx.s.length) {
82100
- skipVoid(ctx);
82101
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
82102
- ctx.p++;
82103
- return res;
82104
- }
82105
- let k;
82106
- let t$5 = res;
82107
- let hasOwn$1 = false;
82108
- let p$2 = ctx.p;
82109
- let key = parseKey(ctx);
82110
- for (let i$1 = 0; i$1 < key.length; i$1++) {
82111
- if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
82112
- k = key[i$1];
82113
- if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError("trying to redefine an already defined value", {
82114
- toml: ctx.s,
82115
- ptr: p$2
82116
- });
82117
- if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
82118
- enumerable: true,
82119
- configurable: true,
82120
- writable: true
82121
- });
82122
- }
82123
- if (hasOwn$1) throw new TomlError("trying to redefine an already defined value", {
82124
- toml: ctx.s,
82125
- ptr: ctx.p
82126
- });
82127
- let value = extractValue(ctx, 125, integersAsBigInt);
82128
- seen.add(t$5[k] = value);
82129
- skipVoid(ctx);
82130
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
82131
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
82132
- toml: ctx.s,
82133
- ptr: ctx.p - 1
82134
- });
82135
- }
82136
- throw new TomlError("unfinished table encountered", {
82137
- toml: ctx.s,
82138
- ptr: ctx.p
82139
- });
82140
- }
82141
- __name$1(parseInlineTable, "parseInlineTable");
82142
- function parseArray(ctx, integersAsBigInt) {
82143
- let res = [];
82144
- let c$1;
82145
- ctx.p++;
82146
- while (ctx.p < ctx.s.length) {
82147
- skipVoid(ctx);
82148
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
82149
- ctx.p++;
82150
- return res;
82151
- }
82152
- res.push(extractValue(ctx, 93, integersAsBigInt));
82153
- skipVoid(ctx);
82154
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
82155
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
82156
- toml: ctx.s,
82157
- ptr: ctx.p - 1
82158
- });
82159
- }
82160
- throw new TomlError("unfinished array encountered", {
82161
- toml: ctx.s,
82162
- ptr: ctx.p
82163
- });
82164
- }
82165
- __name$1(parseArray, "parseArray");
82166
- function peekTable(key, table, meta$3, type) {
82167
- let t$5 = table;
82168
- let m = meta$3;
82169
- let k;
82170
- let hasOwn$1 = false;
82171
- let state;
82172
- for (let i$1 = 0; i$1 < key.length; i$1++) {
82173
- if (i$1) {
82174
- t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
82175
- m = (state = m[k]).c;
82176
- if (type === 0 && (state.t === 1 || state.t === 2)) return null;
82177
- if (state.t === 2) {
82178
- let l = t$5.length - 1;
82179
- t$5 = t$5[l];
82180
- m = m[l].c;
82181
- }
82182
- }
82183
- k = key[i$1];
82184
- if ((hasOwn$1 = Object.hasOwn(t$5, k)) && m[k]?.t === 0 && m[k]?.d) return null;
82185
- if (!hasOwn$1) {
82186
- if (k === "__proto__") {
82187
- Object.defineProperty(t$5, k, {
82188
- enumerable: true,
82189
- configurable: true,
82190
- writable: true
82191
- });
82192
- Object.defineProperty(m, k, {
82193
- enumerable: true,
82194
- configurable: true,
82195
- writable: true
82196
- });
82197
- }
82198
- m[k] = {
82199
- t: i$1 < key.length - 1 && type === 2 ? 3 : type,
82200
- d: false,
82201
- i: 0,
82202
- c: {}
82203
- };
82204
- }
82205
- }
82206
- state = m[k];
82207
- if (state.t !== type && !(type === 1 && state.t === 3)) return null;
82208
- if (type === 2) {
82209
- if (!state.d) {
82210
- state.d = true;
82211
- t$5[k] = [];
82212
- }
82213
- t$5[k].push(t$5 = {});
82214
- state.c[state.i++] = state = {
82215
- t: 1,
82216
- d: false,
82217
- i: 0,
82218
- c: {}
82219
- };
82220
- }
82221
- if (state.d) return null;
82222
- state.d = true;
82223
- if (type === 1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
82224
- else if (type === 0 && hasOwn$1) return null;
82225
- return [
82226
- k,
82227
- t$5,
82228
- state.c
82229
- ];
82230
- }
82231
- __name$1(peekTable, "peekTable");
82232
- function parse$2(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
82233
- let ctx = {
82234
- s: toml,
82235
- p: 0,
82236
- d: maxDepth
82237
- };
82238
- let res = {};
82239
- let meta$3 = {};
82240
- let tmp;
82241
- let tbl = res;
82242
- let m = meta$3;
82243
- skipVoid(ctx);
82244
- while (ctx.p < toml.length) {
82245
- if (toml.charCodeAt(ctx.p) === 91) {
82246
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
82247
- tmp = ctx.p += +isTableArray;
82248
- let k = parseKey(ctx, "]");
82249
- if (isTableArray) {
82250
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError("expected end of table declaration", {
82251
- toml,
82252
- ptr: ctx.p - 1
82253
- });
82254
- ctx.p++;
82255
- }
82256
- let p$2 = peekTable(k, res, meta$3, isTableArray ? 2 : 1);
82257
- if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
82258
- toml,
82259
- ptr: tmp
82260
- });
82261
- m = p$2[2];
82262
- tbl = p$2[1];
82263
- } else {
82264
- tmp = ctx.p;
82265
- let p$2 = peekTable(parseKey(ctx), tbl, m, 0);
82266
- if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
82267
- toml,
82268
- ptr: tmp
82269
- });
82270
- p$2[1][p$2[0]] = extractValue(ctx, void 0, integersAsBigInt);
82271
- }
82272
- skipVoid(ctx, true);
82273
- 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", {
82274
- toml,
82275
- ptr: ctx.p
82276
- });
82277
- skipVoid(ctx);
82278
- }
82279
- return res;
82280
- }
82281
- __name$1(parse$2, "parse");
82282
81863
  var BARE_KEY = /^[a-z0-9-_]+$/i;
81864
+ var HAS_WELLFORMED = !!"".isWellFormed;
82283
81865
  function extendedTypeOf(obj) {
82284
81866
  let type = typeof obj;
82285
81867
  if (type === "object") {
82286
81868
  if (Array.isArray(obj)) return "array";
82287
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
82288
- 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";
81869
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
81870
+ if (globalThis.Temporal) {
81871
+ if (obj.until) {
81872
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
81873
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
81874
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
81875
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
81876
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
81877
+ }
82289
81878
  }
82290
81879
  return type;
82291
81880
  }
@@ -82295,18 +81884,21 @@ function isArrayOfTables(obj) {
82295
81884
  return obj.length != 0;
82296
81885
  }
82297
81886
  __name$1(isArrayOfTables, "isArrayOfTables");
81887
+ function formatWellFormedStringUnchecked(s) {
81888
+ return JSON.stringify(s).replaceAll("", "\\u007f");
81889
+ }
81890
+ __name$1(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
82298
81891
  function formatString(s) {
82299
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
81892
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
82300
81893
  }
82301
81894
  __name$1(formatString, "formatString");
82302
- function stringifyTemporal(temporal) {
82303
- return temporal.toString({
82304
- calendarName: "never",
82305
- timeZoneName: "never"
82306
- });
81895
+ function formatKey(s) {
81896
+ if (BARE_KEY.test(s)) return s;
81897
+ if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
81898
+ return formatWellFormedStringUnchecked(s);
82307
81899
  }
82308
- __name$1(stringifyTemporal, "stringifyTemporal");
82309
- function stringifyValue(val, type, depth$1, numberAsFloat) {
81900
+ __name$1(formatKey, "formatKey");
81901
+ function stringifyValue(val, type, depth$1, numberAsFloat, strictTemporal) {
82310
81902
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
82311
81903
  switch (type) {
82312
81904
  case "number":
@@ -82315,54 +81907,64 @@ function stringifyValue(val, type, depth$1, numberAsFloat) {
82315
81907
  if (val === -Infinity) return "-inf";
82316
81908
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
82317
81909
  case "bigint":
82318
- case "boolean": return val.toString();
81910
+ case "boolean":
81911
+ case "temporal": return val.toString();
82319
81912
  case "string": return formatString(val);
82320
81913
  case "date":
82321
81914
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
82322
81915
  return val.toISOString();
82323
- case "object": return stringifyInlineTable(val, depth$1, numberAsFloat);
82324
- case "array": return stringifyArray(val, depth$1, numberAsFloat);
82325
- case "temporal": return stringifyTemporal(val);
81916
+ case "object": return stringifyInlineTable(val, depth$1, numberAsFloat, strictTemporal);
81917
+ case "array": return stringifyArray(val, depth$1, numberAsFloat, strictTemporal);
81918
+ case "temporal/tz+uc": if (strictTemporal) {
81919
+ let tz = val.timeZoneId;
81920
+ let tzc = tz.charCodeAt(0);
81921
+ 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");
81922
+ }
81923
+ case "temporal/uc":
81924
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
81925
+ return val.toString({
81926
+ calendarName: "never",
81927
+ timeZoneName: "never"
81928
+ });
81929
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
82326
81930
  }
82327
81931
  }
82328
81932
  __name$1(stringifyValue, "stringifyValue");
82329
- function stringifyInlineTable(obj, depth$1, numberAsFloat) {
81933
+ function stringifyInlineTable(obj, depth$1, numberAsFloat, strictTemporal) {
82330
81934
  let keys = Object.keys(obj);
82331
81935
  if (keys.length === 0) return "{}";
82332
81936
  let res = "{ ";
82333
81937
  for (let i$1 = 0; i$1 < keys.length; i$1++) {
82334
81938
  let k = keys[i$1];
82335
81939
  if (i$1) res += ", ";
82336
- res += BARE_KEY.test(k) ? k : formatString(k);
82337
- res += " = ";
82338
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth$1 - 1, numberAsFloat);
81940
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth$1 - 1, numberAsFloat, strictTemporal);
82339
81941
  }
82340
81942
  return res + " }";
82341
81943
  }
82342
81944
  __name$1(stringifyInlineTable, "stringifyInlineTable");
82343
- function stringifyArray(array$2, depth$1, numberAsFloat) {
81945
+ function stringifyArray(array$2, depth$1, numberAsFloat, strictTemporal) {
82344
81946
  if (array$2.length === 0) return "[]";
82345
81947
  let res = "[ ";
82346
81948
  for (let i$1 = 0; i$1 < array$2.length; i$1++) {
82347
81949
  if (i$1) res += ", ";
82348
81950
  if (array$2[i$1] === null || array$2[i$1] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
82349
- res += stringifyValue(array$2[i$1], extendedTypeOf(array$2[i$1]), depth$1 - 1, numberAsFloat);
81951
+ res += stringifyValue(array$2[i$1], extendedTypeOf(array$2[i$1]), depth$1 - 1, numberAsFloat, strictTemporal);
82350
81952
  }
82351
81953
  return res + " ]";
82352
81954
  }
82353
81955
  __name$1(stringifyArray, "stringifyArray");
82354
- function stringifyArrayTable(array$2, key, depth$1, numberAsFloat) {
81956
+ function stringifyArrayTable(array$2, key, depth$1, numberAsFloat, strictTemporal) {
82355
81957
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
82356
81958
  let res = "";
82357
81959
  for (let i$1 = 0; i$1 < array$2.length; i$1++) {
82358
81960
  res += `${res && "\n"}[[${key}]]
82359
81961
  `;
82360
- res += stringifyTable(0, array$2[i$1], key, depth$1, numberAsFloat);
81962
+ res += stringifyTable(0, array$2[i$1], key, depth$1, numberAsFloat, strictTemporal);
82361
81963
  }
82362
81964
  return res;
82363
81965
  }
82364
81966
  __name$1(stringifyArrayTable, "stringifyArrayTable");
82365
- function stringifyTable(tableKey, obj, prefix, depth$1, numberAsFloat) {
81967
+ function stringifyTable(tableKey, obj, prefix, depth$1, numberAsFloat, strictTemporal) {
82366
81968
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
82367
81969
  let preamble = "";
82368
81970
  let tables = "";
@@ -82372,15 +81974,15 @@ function stringifyTable(tableKey, obj, prefix, depth$1, numberAsFloat) {
82372
81974
  if (obj[k] !== null && obj[k] !== void 0) {
82373
81975
  let type = extendedTypeOf(obj[k]);
82374
81976
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
82375
- let key = BARE_KEY.test(k) ? k : formatString(k);
82376
- if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth$1 - 1, numberAsFloat);
81977
+ let key = formatKey(k);
81978
+ if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth$1 - 1, numberAsFloat, strictTemporal);
82377
81979
  else if (type === "object") {
82378
81980
  let tblKey = prefix ? `${prefix}.${key}` : key;
82379
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth$1 - 1, numberAsFloat);
81981
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth$1 - 1, numberAsFloat, strictTemporal);
82380
81982
  } else {
82381
81983
  preamble += key;
82382
81984
  preamble += " = ";
82383
- preamble += stringifyValue(obj[k], type, depth$1, numberAsFloat);
81985
+ preamble += stringifyValue(obj[k], type, depth$1, numberAsFloat, strictTemporal);
82384
81986
  preamble += "\n";
82385
81987
  }
82386
81988
  }
@@ -82391,23 +81993,17 @@ ${preamble}` : `[${tableKey}]`;
82391
81993
  ${tables}` : preamble || tables;
82392
81994
  }
82393
81995
  __name$1(stringifyTable, "stringifyTable");
82394
- function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
81996
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
82395
81997
  if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
82396
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
81998
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
82397
81999
  if (str[str.length - 1] !== "\n") return str + "\n";
82398
82000
  return str;
82399
82001
  }
82400
82002
  __name$1(stringify, "stringify");
82401
- var dist_default = {
82402
- parse: parse$2,
82403
- stringify,
82404
- TomlDate,
82405
- TomlError
82406
- };
82407
82003
  var FILE_FORMATS = {
82408
82004
  toml: {
82409
82005
  parse: /* @__PURE__ */ __name$1((raw) => parseTOML(raw), "parse"),
82410
- stringify: /* @__PURE__ */ __name$1((value) => dist_default.stringify(value), "stringify")
82006
+ stringify: /* @__PURE__ */ __name$1((value) => stringify(value), "stringify")
82411
82007
  },
82412
82008
  json: {
82413
82009
  parse: /* @__PURE__ */ __name$1((raw) => JSON.parse(raw), "parse"),
@@ -83152,7 +82748,7 @@ function scrubEncryptedCredentials(options) {
83152
82748
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
83153
82749
 
83154
82750
  //#endregion
83155
- //#region ../workers-auth/dist/chunk-3U6VZT7T.mjs
82751
+ //#region ../workers-auth/dist/chunk-V6MEAFHI.mjs
83156
82752
  function createPreferences(getConfigPath) {
83157
82753
  function getUserPreferencesPath() {
83158
82754
  return path__default.resolve(getConfigPath(), "preferences.json");
@@ -85667,7 +85263,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
85667
85263
  //#endregion
85668
85264
  //#region ../remote-bindings/dist/index.mjs
85669
85265
  var import_undici = require_undici();
85670
- var version$2 = "0.0.33";
85266
+ var version$2 = "0.0.35";
85671
85267
  var NoDefaultValueProvided = class extends UserError {
85672
85268
  constructor() {
85673
85269
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });