@equinor/fusion-framework-vite-plugin-spa 5.0.0 → 5.1.0

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.
@@ -3712,13 +3712,13 @@ function fromIterable(iterable) {
3712
3712
  }
3713
3713
  function fromAsyncIterable(asyncIterable) {
3714
3714
  return new Observable(function (subscriber) {
3715
- process$2(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
3715
+ process$1(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
3716
3716
  });
3717
3717
  }
3718
3718
  function fromReadableStreamLike(readableStream) {
3719
3719
  return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
3720
3720
  }
3721
- function process$2(asyncIterable, subscriber) {
3721
+ function process$1(asyncIterable, subscriber) {
3722
3722
  var asyncIterable_1, asyncIterable_1_1;
3723
3723
  var e_2, _a;
3724
3724
  return __awaiter(this, void 0, void 0, function () {
@@ -4499,16 +4499,23 @@ function jsonStringifyReplacer(_, value) {
4499
4499
  return value.toString();
4500
4500
  return value;
4501
4501
  }
4502
+ // the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)
4503
+ class Cached {
4504
+ constructor(getter) {
4505
+ this._getter = getter;
4506
+ this._value = undefined;
4507
+ }
4508
+ get value() {
4509
+ const getter = this._getter;
4510
+ if (getter !== undefined) {
4511
+ this._value = getter();
4512
+ this._getter = undefined;
4513
+ }
4514
+ return this._value;
4515
+ }
4516
+ }
4502
4517
  function cached(getter) {
4503
- return {
4504
- get value() {
4505
- {
4506
- const value = getter();
4507
- Object.defineProperty(this, "value", { value });
4508
- return value;
4509
- }
4510
- },
4511
- };
4518
+ return new Cached(getter);
4512
4519
  }
4513
4520
  function nullish(input) {
4514
4521
  return input === null || input === undefined;
@@ -4535,6 +4542,71 @@ function assignProp(target, prop, value) {
4535
4542
  configurable: true,
4536
4543
  });
4537
4544
  }
4545
+ /**
4546
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
4547
+ *
4548
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
4549
+ */
4550
+ function rawShape(def) {
4551
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
4552
+ return desc?.get ? desc.get.raw : desc?.value;
4553
+ }
4554
+ // where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.
4555
+ function sourceShape(schema) {
4556
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
4557
+ }
4558
+ // a key whose value is not settled yet, self-caching so every read after the first gets the same one
4559
+ function deferProp(target, key, getter) {
4560
+ Object.defineProperty(target, key, {
4561
+ get() {
4562
+ const value = getter();
4563
+ assignProp(this, key, value);
4564
+ return value;
4565
+ },
4566
+ enumerable: true,
4567
+ configurable: true,
4568
+ });
4569
+ }
4570
+ // Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.
4571
+ function putProp(target, key, value) {
4572
+ if (key in target)
4573
+ assignProp(target, key, value);
4574
+ else
4575
+ target[key] = value;
4576
+ }
4577
+ /**
4578
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
4579
+ *
4580
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
4581
+ */
4582
+ function mirrorShape(target, source, keys, wrap) {
4583
+ const raw = sourceShape(source);
4584
+ for (const key of keys) {
4585
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
4586
+ if (!desc.enumerable)
4587
+ continue;
4588
+ if (desc.get) {
4589
+ deferProp(target, key, () => {
4590
+ const value = source._zod.def.shape[key];
4591
+ return wrap ? wrap(value, key) : value;
4592
+ });
4593
+ }
4594
+ else
4595
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
4596
+ }
4597
+ }
4598
+ // same, for a plain shape a caller passed rather than a schema's
4599
+ function mirrorProps(target, source) {
4600
+ for (const key of Reflect.ownKeys(source)) {
4601
+ const desc = Object.getOwnPropertyDescriptor(source, key);
4602
+ if (!desc.enumerable)
4603
+ continue;
4604
+ if (desc.get)
4605
+ deferProp(target, key, () => source[key]);
4606
+ else
4607
+ putProp(target, key, desc.value);
4608
+ }
4609
+ }
4538
4610
  function mergeDefs(...defs) {
4539
4611
  const mergedDescriptors = {};
4540
4612
  for (const def of defs) {
@@ -4653,6 +4725,10 @@ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
4653
4725
  float32: [-34028234663852886e22, 3.4028234663852886e38],
4654
4726
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
4655
4727
  }))();
4728
+ const BIGINT_FORMAT_RANGES = {
4729
+ int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
4730
+ uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
4731
+ };
4656
4732
  function pick(schema, mask) {
4657
4733
  const currDef = schema._zod.def;
4658
4734
  const checks = currDef.checks;
@@ -4660,24 +4736,23 @@ function pick(schema, mask) {
4660
4736
  if (hasChecks) {
4661
4737
  throw new Error(".pick() cannot be used on object schemas containing refinements");
4662
4738
  }
4663
- const def = mergeDefs(schema._zod.def, {
4664
- get shape() {
4665
- const newShape = {};
4666
- // `for...in` skips symbols, so a symbol in the mask would select nothing
4667
- for (const key of Reflect.ownKeys(mask)) {
4668
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
4669
- throw new Error(`Unrecognized key: "${String(key)}"`);
4670
- }
4671
- if (!mask[key])
4672
- continue;
4673
- assignProp(newShape, key, currDef.shape[key]);
4674
- }
4675
- assignProp(this, "shape", newShape); // self-caching
4676
- return newShape;
4677
- },
4678
- checks: [],
4679
- });
4680
- return clone(schema, def);
4739
+ const newShape = {};
4740
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
4741
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
4742
+ }
4743
+ // the mask keys that select something, checked against the source's shape without resolving it
4744
+ function maskedKeys(schema, mask) {
4745
+ const raw = sourceShape(schema);
4746
+ const keys = [];
4747
+ // `for...in` skips symbols, so a symbol in the mask would select nothing
4748
+ for (const key of Reflect.ownKeys(mask)) {
4749
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
4750
+ throw new Error(`Unrecognized key: "${String(key)}"`);
4751
+ }
4752
+ if (mask[key])
4753
+ keys.push(key);
4754
+ }
4755
+ return keys;
4681
4756
  }
4682
4757
  function omit(schema, mask) {
4683
4758
  const currDef = schema._zod.def;
@@ -4686,23 +4761,10 @@ function omit(schema, mask) {
4686
4761
  if (hasChecks) {
4687
4762
  throw new Error(".omit() cannot be used on object schemas containing refinements");
4688
4763
  }
4689
- const def = mergeDefs(schema._zod.def, {
4690
- get shape() {
4691
- const newShape = { ...schema._zod.def.shape };
4692
- for (const key of Reflect.ownKeys(mask)) {
4693
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
4694
- throw new Error(`Unrecognized key: "${String(key)}"`);
4695
- }
4696
- if (!mask[key])
4697
- continue;
4698
- delete newShape[key];
4699
- }
4700
- assignProp(this, "shape", newShape); // self-caching
4701
- return newShape;
4702
- },
4703
- checks: [],
4704
- });
4705
- return clone(schema, def);
4764
+ const omitted = new Set(maskedKeys(schema, mask));
4765
+ const newShape = {};
4766
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
4767
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
4706
4768
  }
4707
4769
  function extend(schema, shape) {
4708
4770
  if (!isPlainObject$2(shape)) {
@@ -4712,34 +4774,27 @@ function extend(schema, shape) {
4712
4774
  const hasChecks = checks && checks.length > 0;
4713
4775
  if (hasChecks) {
4714
4776
  // Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
4715
- const existingShape = schema._zod.def.shape;
4777
+ const existingShape = sourceShape(schema);
4716
4778
  for (const key of Reflect.ownKeys(shape)) {
4717
4779
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
4718
4780
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
4719
4781
  }
4720
4782
  }
4721
4783
  }
4722
- const def = mergeDefs(schema._zod.def, {
4723
- get shape() {
4724
- const _shape = { ...schema._zod.def.shape, ...shape };
4725
- assignProp(this, "shape", _shape); // self-caching
4726
- return _shape;
4727
- },
4728
- });
4729
- return clone(schema, def);
4784
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
4785
+ }
4786
+ // the source's keys, then the caller's overlaid on top
4787
+ function extended(schema, shape) {
4788
+ const newShape = {};
4789
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
4790
+ mirrorProps(newShape, shape);
4791
+ return newShape;
4730
4792
  }
4731
4793
  function safeExtend(schema, shape) {
4732
4794
  if (!isPlainObject$2(shape)) {
4733
4795
  throw new Error("Invalid input to safeExtend: expected a plain object");
4734
4796
  }
4735
- const def = mergeDefs(schema._zod.def, {
4736
- get shape() {
4737
- const _shape = { ...schema._zod.def.shape, ...shape };
4738
- assignProp(this, "shape", _shape); // self-caching
4739
- return _shape;
4740
- },
4741
- });
4742
- return clone(schema, def);
4797
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
4743
4798
  }
4744
4799
  function merge(a, b) {
4745
4800
  if (!b?._zod?.def) {
@@ -4748,12 +4803,11 @@ function merge(a, b) {
4748
4803
  if (a._zod.def.checks?.length) {
4749
4804
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
4750
4805
  }
4806
+ const newShape = {};
4807
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
4808
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
4751
4809
  const def = mergeDefs(a._zod.def, {
4752
- get shape() {
4753
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
4754
- assignProp(this, "shape", _shape); // self-caching
4755
- return _shape;
4756
- },
4810
+ shape: newShape,
4757
4811
  get catchall() {
4758
4812
  return b._zod.def.catchall;
4759
4813
  },
@@ -4768,78 +4822,19 @@ function partial(Class, schema, mask, name = "partial") {
4768
4822
  if (hasChecks) {
4769
4823
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
4770
4824
  }
4771
- const def = mergeDefs(schema._zod.def, {
4772
- get shape() {
4773
- const oldShape = schema._zod.def.shape;
4774
- const shape = { ...oldShape };
4775
- if (mask) {
4776
- for (const key of Reflect.ownKeys(mask)) {
4777
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
4778
- throw new Error(`Unrecognized key: "${String(key)}"`);
4779
- }
4780
- if (!mask[key])
4781
- continue;
4782
- // if (oldShape[key]!._zod.optin === "optional") continue;
4783
- shape[key] = Class
4784
- ? new Class({
4785
- type: "optional",
4786
- innerType: oldShape[key],
4787
- })
4788
- : oldShape[key];
4789
- }
4790
- }
4791
- else {
4792
- // the spread copies symbol keys; `for...in` would not reach them
4793
- for (const key of Reflect.ownKeys(oldShape)) {
4794
- // if (oldShape[key]!._zod.optin === "optional") continue;
4795
- shape[key] = Class
4796
- ? new Class({
4797
- type: "optional",
4798
- innerType: oldShape[key],
4799
- })
4800
- : oldShape[key];
4801
- }
4802
- }
4803
- assignProp(this, "shape", shape); // self-caching
4804
- return shape;
4805
- },
4806
- checks: [],
4807
- });
4808
- return clone(schema, def);
4825
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
4826
+ const newShape = {};
4827
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class &&
4828
+ ((value, key) => (selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value }))));
4829
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
4809
4830
  }
4810
4831
  function required(Class, schema, mask) {
4811
- const def = mergeDefs(schema._zod.def, {
4812
- get shape() {
4813
- const oldShape = schema._zod.def.shape;
4814
- const shape = { ...oldShape };
4815
- if (mask) {
4816
- for (const key of Reflect.ownKeys(mask)) {
4817
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
4818
- throw new Error(`Unrecognized key: "${String(key)}"`);
4819
- }
4820
- if (!mask[key])
4821
- continue;
4822
- // overwrite with non-optional
4823
- shape[key] = new Class({
4824
- type: "nonoptional",
4825
- innerType: oldShape[key],
4826
- });
4827
- }
4828
- }
4829
- else {
4830
- for (const key of Reflect.ownKeys(oldShape)) {
4831
- // overwrite with non-optional
4832
- shape[key] = new Class({
4833
- type: "nonoptional",
4834
- innerType: oldShape[key],
4835
- });
4836
- }
4837
- }
4838
- assignProp(this, "shape", shape); // self-caching
4839
- return shape;
4840
- },
4841
- });
4842
- return clone(schema, def);
4832
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
4833
+ const newShape = {};
4834
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) =>
4835
+ // overwrite with non-optional
4836
+ selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
4837
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
4843
4838
  }
4844
4839
  // invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
4845
4840
  function aborted(x, startIndex = 0) {
@@ -4901,13 +4896,19 @@ function finalizeIssue(iss, ctx, config) {
4901
4896
  unwrapMessage(config.customError?.(iss)) ??
4902
4897
  unwrapMessage(config.localeError?.(iss)) ??
4903
4898
  "Invalid input");
4904
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
4905
- rest.path ?? (rest.path = []);
4906
- rest.message = message;
4899
+ // an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter
4900
+ const full = {};
4901
+ for (const k of Object.keys(iss)) {
4902
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
4903
+ continue;
4904
+ full[k] = iss[k];
4905
+ }
4906
+ full.path ?? (full.path = []);
4907
+ full.message = message;
4907
4908
  if (ctx?.reportInput) {
4908
- rest.input = _input;
4909
+ full.input = iss.input;
4909
4910
  }
4910
- return rest;
4911
+ return full;
4911
4912
  }
4912
4913
  const highSurrogate = /[\uD800-\uDBFF]/;
4913
4914
  // Code points in `str`: a surrogate pair counts once, a lone surrogate as itself. Hand-rolled because the string iterator allocates and runs ~250x slower on this path; the regex probe exits ~50x quicker for a string with no astral characters.
@@ -4992,6 +4993,24 @@ function own(inst, key, value, enumerable = true) {
4992
4993
  function hide(inst, key, value) {
4993
4994
  return own(inst, key, value, false);
4994
4995
  }
4996
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
4997
+ function derived(computes, table) {
4998
+ for (const key in computes) {
4999
+ const compute = computes[key];
5000
+ // an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written
5001
+ Object.defineProperty(table, key, {
5002
+ configurable: true,
5003
+ enumerable: true,
5004
+ get() {
5005
+ return own(this, key, compute(this));
5006
+ },
5007
+ set(value) {
5008
+ own(this, key, value);
5009
+ },
5010
+ });
5011
+ }
5012
+ return table;
5013
+ }
4995
5014
  function defineBound(proto, key, fn) {
4996
5015
  Object.defineProperty(proto, key, {
4997
5016
  configurable: true,
@@ -5104,7 +5123,7 @@ const NEVER = /*@__PURE__*/ Object.freeze({
5104
5123
  });
5105
5124
  /* Shared descriptor for installing `_zod`; defineProperty reads it
5106
5125
  * synchronously, so reusing one object avoids a per-instance allocation. */
5107
- const _zodDesc$1 = { value: undefined, enumerable: false };
5126
+ const _zodDesc = { value: undefined, enumerable: false };
5108
5127
  // null where suppressing the capture would be unrecoverable: `parse()` puts the frames back with `captureStackTrace`, so without it the throw would lose its stack. also latched to null once `stackTraceLimit` proves unassignable, which a realm can do at any point by hardening Error
5109
5128
  let _E = "captureStackTrace" in Error ? Error : null;
5110
5129
  // v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot
@@ -5147,16 +5166,16 @@ proto, params) {
5147
5166
  const initialized = protoMembers && new WeakSet();
5148
5167
  function init(inst, def) {
5149
5168
  if (!inst._zod) {
5150
- _zodDesc$1.value = new Internals(def);
5169
+ _zodDesc.value = new Internals(def);
5151
5170
  try {
5152
- Object.defineProperty(inst, "_zod", _zodDesc$1);
5171
+ Object.defineProperty(inst, "_zod", _zodDesc);
5153
5172
  }
5154
5173
  finally {
5155
5174
  // Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.
5156
- _zodDesc$1.value = undefined;
5175
+ _zodDesc.value = undefined;
5157
5176
  }
5158
5177
  }
5159
- if (inst._zod.traits.has(name)) {
5178
+ else if (inst._zod.traits.has(name)) {
5160
5179
  return;
5161
5180
  }
5162
5181
  inst._zod.traits.add(name);
@@ -5256,7 +5275,6 @@ const _messageDesc = {
5256
5275
  enumerable: true,
5257
5276
  configurable: true,
5258
5277
  };
5259
- const _zodDesc = { value: undefined, enumerable: false };
5260
5278
  const _issuesDesc = { value: undefined, enumerable: false };
5261
5279
  /* Prototypes that already carry the lazy `toString`. Seeded with the
5262
5280
  * intrinsics so that `init` on a foreign object — it accepts any object —
@@ -5264,12 +5282,10 @@ const _issuesDesc = { value: undefined, enumerable: false };
5264
5282
  const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
5265
5283
  const initializer$1 = (inst, def) => {
5266
5284
  inst.name = "$ZodError";
5267
- _zodDesc.value = inst._zod;
5268
- Object.defineProperty(inst, "_zod", _zodDesc);
5285
+ // `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor
5269
5286
  _issuesDesc.value = def;
5270
5287
  Object.defineProperty(inst, "issues", _issuesDesc);
5271
- // Clear the shared slots; a retained `value` pins the last error's issues.
5272
- _zodDesc.value = undefined;
5288
+ // Clear the shared slot; a retained `value` pins the last error's issues.
5273
5289
  _issuesDesc.value = undefined;
5274
5290
  Object.defineProperty(inst, "message", _messageDesc);
5275
5291
  /* `toString` lives as a non-enumerable lazy getter on the shared
@@ -5293,9 +5309,6 @@ const initializer$1 = (inst, def) => {
5293
5309
  }
5294
5310
  };
5295
5311
  const $ZodError = $constructor("$ZodError", initializer$1);
5296
- const $ZodRealError = $constructor("$ZodError", initializer$1, undefined, {
5297
- Parent: Error,
5298
- });
5299
5312
  /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
5300
5313
  * ("toString", "constructor") would otherwise read through to the prototype, and assigning
5301
5314
  * "__proto__" would hit the setter instead of creating a key. */
@@ -5424,27 +5437,81 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
5424
5437
  if (result instanceof Promise) {
5425
5438
  throw new $ZodAsyncError();
5426
5439
  }
5427
- return result.issues.length
5428
- ? {
5429
- success: false,
5430
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
5431
- }
5432
- : { success: true, data: result.value };
5440
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
5433
5441
  };
5434
- const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
5442
+ // the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle
5443
+ function failure(Err, issues, ctx) {
5444
+ let error;
5445
+ return {
5446
+ success: false,
5447
+ get error() {
5448
+ if (!error) {
5449
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
5450
+ // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result
5451
+ issues = undefined;
5452
+ ctx = undefined;
5453
+ }
5454
+ return error;
5455
+ },
5456
+ set error(e) {
5457
+ error = e;
5458
+ // a replacement makes the getter's branch unreachable, so the captures have to go here too
5459
+ issues = undefined;
5460
+ ctx = undefined;
5461
+ },
5462
+ };
5463
+ }
5435
5464
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
5436
5465
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
5437
5466
  let result = schema._zod.run({ value, issues: [] }, ctx);
5438
5467
  if (result instanceof Promise)
5439
5468
  result = await result;
5440
- return result.issues.length
5441
- ? {
5442
- success: false,
5443
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
5444
- }
5445
- : { success: true, data: result.value };
5469
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
5470
+ };
5471
+ // registry mirrors of the compiler's sentinels, so this module never imports the compiler
5472
+ const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
5473
+ const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
5474
+ // Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
5475
+ const validate = ((schema, value, _ctx) => {
5476
+ const validator = schema._zod.bag.validator;
5477
+ if (validator !== undefined) {
5478
+ if (validator(value) !== COMPILE_INVALID)
5479
+ return true;
5480
+ // a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer
5481
+ if (validator.definite === true && _ctx === undefined)
5482
+ return false;
5483
+ }
5484
+ return validateFallback(schema, value, _ctx);
5485
+ });
5486
+ function validateFallback(schema, value, _ctx) {
5487
+ const ctx = _ctx
5488
+ ? { ..._ctx, async: false, abortEarly: true }
5489
+ : { async: false, abortEarly: true };
5490
+ const fallbackRun = schema._zod.bag.fallbackRun;
5491
+ let result;
5492
+ if (fallbackRun) {
5493
+ // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
5494
+ ctx[COMPILE_FALLBACK] = true;
5495
+ result = fallbackRun({ value, issues: [] }, ctx);
5496
+ }
5497
+ else {
5498
+ result = schema._zod.run({ value, issues: [] }, ctx);
5499
+ }
5500
+ if (result instanceof Promise) {
5501
+ throw new $ZodAsyncError();
5502
+ }
5503
+ return result.issues.length === 0;
5504
+ }
5505
+ // no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
5506
+ const validateAsync$1 = async (schema, value, _ctx) => {
5507
+ const ctx = _ctx
5508
+ ? { ..._ctx, async: true, abortEarly: true }
5509
+ : { async: true, abortEarly: true };
5510
+ let result = schema._zod.run({ value, issues: [] }, ctx);
5511
+ if (result instanceof Promise)
5512
+ result = await result;
5513
+ return result.issues.length === 0;
5446
5514
  };
5447
- const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
5448
5515
  const _encode = (_Err) => {
5449
5516
  const parse = _parse(_Err);
5450
5517
  const fn = (schema, value, _ctx, _params) => {
@@ -5517,10 +5584,10 @@ const uuid = (version) => {
5517
5584
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
5518
5585
  };
5519
5586
  /** Practical email validation */
5520
- const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
5587
+ const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
5521
5588
  // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
5522
- // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match.
5523
- const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
5589
+ // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.
5590
+ const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
5524
5591
  function emoji() {
5525
5592
  return new RegExp(_emoji$1, "u");
5526
5593
  }
@@ -5530,7 +5597,7 @@ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-
5530
5597
  const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
5531
5598
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
5532
5599
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
5533
- const base64url = /^[A-Za-z0-9_-]*$/;
5600
+ const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
5534
5601
  const httpProtocol = /^https?$/;
5535
5602
  // https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces) E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
5536
5603
  const e164 = /^\+[1-9]\d{6,14}$/;
@@ -5567,10 +5634,8 @@ function datetime(args) {
5567
5634
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
5568
5635
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
5569
5636
  }
5570
- const string$1 = (params) => {
5571
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
5572
- return new RegExp(`^${regex}$`);
5573
- };
5637
+ // the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own
5638
+ const anyString = /^[\s\S]{0,}$/;
5574
5639
  const integer = /^-?\d+$/;
5575
5640
  const number$1 = /^-?\d+(?:\.\d+)?$/;
5576
5641
  const boolean$1 = /^(?:true|false)$/i;
@@ -5599,16 +5664,6 @@ const numericOriginMap = {
5599
5664
  const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
5600
5665
  $ZodCheck.init(inst, def);
5601
5666
  const origin = numericOriginMap[typeof def.value];
5602
- inst._zod.onattach.push((inst) => {
5603
- const bag = inst._zod.bag;
5604
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
5605
- if (def.value < curr) {
5606
- if (def.inclusive)
5607
- bag.maximum = def.value;
5608
- else
5609
- bag.exclusiveMaximum = def.value;
5610
- }
5611
- });
5612
5667
  inst._zod.check = (payload) => {
5613
5668
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
5614
5669
  return;
@@ -5627,16 +5682,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
5627
5682
  const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
5628
5683
  $ZodCheck.init(inst, def);
5629
5684
  const origin = numericOriginMap[typeof def.value];
5630
- inst._zod.onattach.push((inst) => {
5631
- const bag = inst._zod.bag;
5632
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
5633
- if (def.value > curr) {
5634
- if (def.inclusive)
5635
- bag.minimum = def.value;
5636
- else
5637
- bag.exclusiveMinimum = def.value;
5638
- }
5639
- });
5640
5685
  inst._zod.check = (payload) => {
5641
5686
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
5642
5687
  return;
@@ -5655,10 +5700,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
5655
5700
  const $ZodCheckMultipleOf =
5656
5701
  /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
5657
5702
  $ZodCheck.init(inst, def);
5658
- inst._zod.onattach.push((inst) => {
5659
- var _a;
5660
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
5661
- });
5662
5703
  inst._zod.check = (payload) => {
5663
5704
  if (typeof payload.value !== typeof def.value)
5664
5705
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -5684,14 +5725,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
5684
5725
  const isInt = def.format?.includes("int");
5685
5726
  const origin = isInt ? "int" : "number";
5686
5727
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
5687
- inst._zod.onattach.push((inst) => {
5688
- const bag = inst._zod.bag;
5689
- bag.format = def.format;
5690
- bag.minimum = minimum;
5691
- bag.maximum = maximum;
5692
- if (isInt)
5693
- bag.pattern = integer;
5694
- });
5695
5728
  inst._zod.check = (payload) => {
5696
5729
  const input = payload.value;
5697
5730
  if (isInt) {
@@ -5781,11 +5814,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
5781
5814
  var _a;
5782
5815
  $ZodCheck.init(inst, def);
5783
5816
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5784
- inst._zod.onattach.push((inst) => {
5785
- const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
5786
- if (def.maximum < curr)
5787
- inst._zod.bag.maximum = def.maximum;
5788
- });
5789
5817
  inst._zod.check = (payload) => {
5790
5818
  const input = payload.value;
5791
5819
  const units = input.length;
@@ -5809,11 +5837,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
5809
5837
  var _a;
5810
5838
  $ZodCheck.init(inst, def);
5811
5839
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5812
- inst._zod.onattach.push((inst) => {
5813
- const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
5814
- if (def.minimum > curr)
5815
- inst._zod.bag.minimum = def.minimum;
5816
- });
5817
5840
  inst._zod.check = (payload) => {
5818
5841
  const input = payload.value;
5819
5842
  const units = input.length;
@@ -5839,12 +5862,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
5839
5862
  var _a;
5840
5863
  $ZodCheck.init(inst, def);
5841
5864
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5842
- inst._zod.onattach.push((inst) => {
5843
- const bag = inst._zod.bag;
5844
- bag.minimum = def.length;
5845
- bag.maximum = def.length;
5846
- bag.length = def.length;
5847
- });
5848
5865
  inst._zod.check = (payload) => {
5849
5866
  const input = payload.value;
5850
5867
  const units = input.length;
@@ -5870,14 +5887,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
5870
5887
  const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
5871
5888
  var _a, _b;
5872
5889
  $ZodCheck.init(inst, def);
5873
- inst._zod.onattach.push((inst) => {
5874
- const bag = inst._zod.bag;
5875
- bag.format = def.format;
5876
- if (def.pattern) {
5877
- bag.patterns ?? (bag.patterns = new Set());
5878
- bag.patterns.add(def.pattern);
5879
- }
5880
- });
5881
5890
  if (def.pattern)
5882
5891
  (_a = inst._zod).check ?? (_a.check = (payload) => {
5883
5892
  def.pattern.lastIndex = 0;
@@ -5929,11 +5938,6 @@ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst,
5929
5938
  // (`{N,}`), not exactly `position` chars (`{N}`).
5930
5939
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
5931
5940
  def.pattern = pattern;
5932
- inst._zod.onattach.push((inst) => {
5933
- const bag = inst._zod.bag;
5934
- bag.patterns ?? (bag.patterns = new Set());
5935
- bag.patterns.add(pattern);
5936
- });
5937
5941
  inst._zod.check = (payload) => {
5938
5942
  if (payload.value.includes(def.includes, def.position))
5939
5943
  return;
@@ -5952,11 +5956,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
5952
5956
  $ZodCheck.init(inst, def);
5953
5957
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
5954
5958
  def.pattern ?? (def.pattern = pattern);
5955
- inst._zod.onattach.push((inst) => {
5956
- const bag = inst._zod.bag;
5957
- bag.patterns ?? (bag.patterns = new Set());
5958
- bag.patterns.add(pattern);
5959
- });
5960
5959
  inst._zod.check = (payload) => {
5961
5960
  if (payload.value.startsWith(def.prefix))
5962
5961
  return;
@@ -5975,11 +5974,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
5975
5974
  $ZodCheck.init(inst, def);
5976
5975
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
5977
5976
  def.pattern ?? (def.pattern = pattern);
5978
- inst._zod.onattach.push((inst) => {
5979
- const bag = inst._zod.bag;
5980
- bag.patterns ?? (bag.patterns = new Set());
5981
- bag.patterns.add(pattern);
5982
- });
5983
5977
  inst._zod.check = (payload) => {
5984
5978
  if (payload.value.endsWith(def.suffix))
5985
5979
  return;
@@ -5994,6 +5988,45 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
5994
5988
  });
5995
5989
  };
5996
5990
  });
5991
+ ///////////////////////////////////
5992
+ ///// $ZodCheckProperty /////
5993
+ ///////////////////////////////////
5994
+ function handleCheckPropertyResult(result, payload, property) {
5995
+ if (result.issues.length) {
5996
+ payload.issues.push(...prefixIssues(property, result.issues));
5997
+ }
5998
+ }
5999
+ const $ZodCheckProperties = /*@__PURE__*/ $constructor("$ZodCheckProperties", (inst, def) => {
6000
+ $ZodCheck.init(inst, def);
6001
+ hide(inst, Symbol.iterator, function* () {
6002
+ yield inst;
6003
+ });
6004
+ // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
6005
+ let entries;
6006
+ inst._zod.check = (payload) => {
6007
+ // the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length
6008
+ if (payload.value == null) {
6009
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
6010
+ return undefined;
6011
+ }
6012
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
6013
+ const input = payload.value;
6014
+ let proms;
6015
+ for (const [key, schema] of entries) {
6016
+ const result = schema._zod.run({ value: input[key], issues: [] }, {});
6017
+ if (result instanceof Promise) {
6018
+ proms ?? (proms = []);
6019
+ proms.push(result.then((result) => handleCheckPropertyResult(result, payload, key)));
6020
+ }
6021
+ else {
6022
+ handleCheckPropertyResult(result, payload, key);
6023
+ }
6024
+ }
6025
+ if (proms)
6026
+ return Promise.all(proms).then(() => undefined);
6027
+ return undefined;
6028
+ };
6029
+ });
5997
6030
  const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
5998
6031
  $ZodCheck.init(inst, def);
5999
6032
  inst._zod.check = (payload) => {
@@ -6008,10 +6041,15 @@ class Doc {
6008
6041
  this.args = args;
6009
6042
  this.closed = closed;
6010
6043
  }
6044
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
6011
6045
  indented(fn) {
6012
6046
  this.indent += 1;
6013
- fn(this);
6014
- this.indent -= 1;
6047
+ try {
6048
+ fn(this);
6049
+ }
6050
+ finally {
6051
+ this.indent -= 1;
6052
+ }
6015
6053
  }
6016
6054
  write(arg) {
6017
6055
  if (typeof arg === "function") {
@@ -6037,8 +6075,8 @@ class Doc {
6037
6075
 
6038
6076
  const version$3 = {
6039
6077
  major: 4,
6040
- minor: 5,
6041
- patch: 4,
6078
+ minor: 6,
6079
+ patch: 5,
6042
6080
  };
6043
6081
 
6044
6082
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
@@ -6164,16 +6202,24 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
6164
6202
  },
6165
6203
  });
6166
6204
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
6167
- const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
6205
+ // a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
6206
+ const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
6207
+ async function validateAsync(inst, value) {
6208
+ const ctx = { async: true };
6209
+ return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
6210
+ }
6168
6211
  function standardProps(inst) {
6169
6212
  return {
6170
6213
  validate: (value) => {
6214
+ const ctx = { async: false };
6171
6215
  try {
6172
- return toStandardResult(safeParse$1(inst, value));
6173
- }
6174
- catch (_) {
6175
- return safeParseAsync$1(inst, value).then(toStandardResult);
6216
+ const r = inst._zod.run({ value, issues: [] }, ctx);
6217
+ if (!(r instanceof Promise))
6218
+ return toStandardResult(r, ctx);
6176
6219
  }
6220
+ catch (_) { }
6221
+ // async function so a synchronously throwing check rejects instead of escaping validate
6222
+ return validateAsync(inst, value);
6177
6223
  },
6178
6224
  vendor: "zod",
6179
6225
  version: 1,
@@ -6181,7 +6227,8 @@ function standardProps(inst) {
6181
6227
  }
6182
6228
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
6183
6229
  $ZodType.init(inst, def);
6184
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string$1(inst._zod.bag);
6230
+ // a format's own pattern, else unbounded; a template literal derives the check-aware form itself
6231
+ inst._zod.pattern = def.pattern ?? anyString;
6185
6232
  inst._zod.parse = (payload, _) => {
6186
6233
  if (def.coerce)
6187
6234
  try {
@@ -6235,15 +6282,37 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
6235
6282
  });
6236
6283
  /** The `://` guard rejected the input before the URL constructor saw it. */
6237
6284
  const URL_BAD_FORMAT = 1;
6238
- /** The URL constructor rejected the input. */
6285
+ /** The URL parser rejected the input. */
6239
6286
  const URL_UNPARSEABLE = 2;
6240
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
6287
+ function canParseURL(input) {
6288
+ try {
6289
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
6290
+ return URL.canParse(input);
6291
+ new URL(input);
6292
+ return true;
6293
+ }
6294
+ catch {
6295
+ return false;
6296
+ }
6297
+ }
6298
+ function validateURL(trimmed, def) {
6299
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
6300
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
6301
+ }
6302
+ return parseURLObject(trimmed, def);
6303
+ }
6304
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
6241
6305
  function parseURLObject(trimmed, def) {
6242
6306
  // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
6243
6307
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
6244
6308
  return URL_BAD_FORMAT;
6245
6309
  }
6246
6310
  try {
6311
+ if (typeof URL !== "undefined") {
6312
+ const URLStatic = URL;
6313
+ if (typeof URLStatic.parse === "function")
6314
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
6315
+ }
6247
6316
  // @ts-ignore
6248
6317
  return new URL(trimmed);
6249
6318
  }
@@ -6270,7 +6339,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
6270
6339
  try {
6271
6340
  // Trim whitespace from input
6272
6341
  const trimmed = payload.value.trim();
6273
- const url = parseURLObject(trimmed, def);
6342
+ const url = validateURL(trimmed, def);
6274
6343
  if (url === URL_BAD_FORMAT) {
6275
6344
  payload.issues.push({
6276
6345
  code: "invalid_format",
@@ -6292,6 +6361,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
6292
6361
  });
6293
6362
  return;
6294
6363
  }
6364
+ if (url === true) {
6365
+ payload.value = stripTabAndNewline(trimmed);
6366
+ return;
6367
+ }
6295
6368
  if (def.hostname && !urlHostnameOk(url, def.hostname)) {
6296
6369
  payload.issues.push({
6297
6370
  code: "invalid_format",
@@ -6367,13 +6440,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
6367
6440
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
6368
6441
  def.pattern ?? (def.pattern = datetime(def));
6369
6442
  $ZodStringFormat.init(inst, def);
6370
- // these two drop the offset or seconds `date-time` requires — on the bag not the def, since `z.string().check(...)` lands the format on a different schema
6371
- if (def.local || def.precision === -1) {
6372
- inst._zod.bag.laxFormat = true;
6373
- inst._zod.onattach.push((s) => {
6374
- s._zod.bag.laxFormat = true;
6375
- });
6376
- }
6377
6443
  });
6378
6444
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
6379
6445
  def.pattern ?? (def.pattern = date);
@@ -6390,26 +6456,17 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
6390
6456
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
6391
6457
  def.pattern ?? (def.pattern = ipv4);
6392
6458
  $ZodStringFormat.init(inst, def);
6393
- inst._zod.bag.format = `ipv4`;
6394
6459
  });
6395
6460
  /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
6396
6461
  const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
6397
6462
  function isValidIPv6(value) {
6398
6463
  if (!ipv6Alphabet.test(value))
6399
6464
  return false;
6400
- try {
6401
- // @ts-ignore
6402
- new URL(`http://[${value}]`);
6403
- return true;
6404
- }
6405
- catch {
6406
- return false;
6407
- }
6465
+ return canParseURL(`http://[${value}]`);
6408
6466
  }
6409
6467
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
6410
6468
  def.pattern ?? (def.pattern = ipv6);
6411
6469
  $ZodStringFormat.init(inst, def);
6412
- inst._zod.bag.format = `ipv6`;
6413
6470
  inst._zod.check = (payload) => {
6414
6471
  if (!isValidIPv6(payload.value)) {
6415
6472
  payload.issues.push({
@@ -6473,10 +6530,11 @@ function isValidBase64(data) {
6473
6530
  return false;
6474
6531
  }
6475
6532
  }
6533
+ // lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
6534
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
6476
6535
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
6477
- def.pattern ?? (def.pattern = base64);
6536
+ def.pattern ?? (def.pattern = base64Charset);
6478
6537
  $ZodStringFormat.init(inst, def);
6479
- inst._zod.bag.contentEncoding = "base64";
6480
6538
  inst._zod.check = (payload) => {
6481
6539
  if (isValidBase64(payload.value))
6482
6540
  return;
@@ -6489,18 +6547,19 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
6489
6547
  });
6490
6548
  };
6491
6549
  });
6492
- ////////////////////////////// ZodBase64 //////////////////////////////
6550
+ ////////////////////////////// ZodBase64URL //////////////////////////////
6551
+ // lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
6552
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
6493
6553
  function isValidBase64URL(data) {
6494
- if (!base64url.test(data))
6554
+ if (!base64urlCharset.test(data))
6495
6555
  return false;
6496
6556
  const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
6497
6557
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
6498
6558
  return isValidBase64(padded);
6499
6559
  }
6500
6560
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
6501
- def.pattern ?? (def.pattern = base64url);
6561
+ def.pattern ?? (def.pattern = base64urlCharset);
6502
6562
  $ZodStringFormat.init(inst, def);
6503
- inst._zod.bag.contentEncoding = "base64url";
6504
6563
  inst._zod.check = (payload) => {
6505
6564
  if (isValidBase64URL(payload.value))
6506
6565
  return;
@@ -6556,7 +6615,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
6556
6615
  });
6557
6616
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
6558
6617
  $ZodType.init(inst, def);
6559
- inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
6618
+ inst._zod.pattern = number$1;
6560
6619
  inst._zod.parse = (payload, _ctx) => {
6561
6620
  if (def.coerce)
6562
6621
  try {
@@ -6648,6 +6707,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
6648
6707
  }
6649
6708
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
6650
6709
  const proms = [];
6710
+ const abortEarly = ctx?.abortEarly;
6651
6711
  for (let i = 0; i < input.length; i++) {
6652
6712
  const item = input[i];
6653
6713
  const result = def.element._zod.run({
@@ -6659,6 +6719,9 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
6659
6719
  }
6660
6720
  else {
6661
6721
  handleArrayResult(result, payload, i);
6722
+ // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
6723
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
6724
+ break;
6662
6725
  }
6663
6726
  }
6664
6727
  if (proms.length) {
@@ -6693,7 +6756,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
6693
6756
  return;
6694
6757
  }
6695
6758
  if (result.value === undefined) {
6696
- if (isPresent) {
6759
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
6697
6760
  final.value[key] = undefined;
6698
6761
  }
6699
6762
  }
@@ -6725,14 +6788,21 @@ function normalizeDef(def) {
6725
6788
  optionalKeys: new Set(okeys),
6726
6789
  };
6727
6790
  }
6728
- function handleCatchall(proms, input, payload, ctx, def, inst) {
6791
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
6729
6792
  const unrecognized = [];
6730
6793
  const keySet = def.keySet;
6731
6794
  const _catchall = def.catchall._zod;
6732
6795
  const t = _catchall.def.type;
6733
6796
  const optin = _catchall.optin;
6734
6797
  const optout = _catchall.optout;
6798
+ // starts at 0, not the current length: the shape phase already ran and may have aborted
6799
+ let seen = 0;
6735
6800
  for (const key in input) {
6801
+ if (abortEarly && payload.issues.length !== seen) {
6802
+ if (aborted(payload, seen))
6803
+ break;
6804
+ seen = payload.issues.length;
6805
+ }
6736
6806
  // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
6737
6807
  if (keySet.has(key))
6738
6808
  continue;
@@ -6770,26 +6840,22 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
6770
6840
  return payload;
6771
6841
  });
6772
6842
  }
6773
- // Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
6774
- const propShapes = new WeakMap();
6775
6843
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6776
6844
  // requires cast because technically $ZodObject doesn't extend
6777
6845
  $ZodType.init(inst, def);
6778
- // const sh = def.shape;
6779
6846
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
6780
- if (!desc?.get) {
6781
- const sh = def.shape;
6782
- propShapes.set(def, sh);
6783
- Object.defineProperty(def, "shape", {
6784
- get: () => {
6785
- const newSh = { ...sh };
6786
- Object.defineProperty(def, "shape", {
6787
- value: newSh,
6788
- });
6789
- propShapes.set(def, newSh);
6790
- return newSh;
6791
- },
6792
- });
6847
+ // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
6848
+ const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
6849
+ if (sh) {
6850
+ // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
6851
+ const get = () => {
6852
+ const newSh = { ...sh };
6853
+ Object.defineProperty(def, "shape", { value: newSh });
6854
+ get.raw = newSh;
6855
+ return newSh;
6856
+ };
6857
+ get.raw = sh;
6858
+ Object.defineProperty(def, "shape", { get });
6793
6859
  }
6794
6860
  const _normalized = cached(() => normalizeDef(def));
6795
6861
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -6830,7 +6896,14 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6830
6896
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
6831
6897
  const proms = [];
6832
6898
  const shape = value.shape;
6899
+ const abortEarly = ctx?.abortEarly;
6900
+ let seen = payload.issues.length;
6833
6901
  for (const key of value.allKeys) {
6902
+ if (abortEarly && payload.issues.length !== seen) {
6903
+ if (aborted(payload, seen))
6904
+ break;
6905
+ seen = payload.issues.length;
6906
+ }
6834
6907
  if (key === "__proto__")
6835
6908
  continue;
6836
6909
  const el = shape[key];
@@ -6847,7 +6920,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6847
6920
  if (!catchall) {
6848
6921
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
6849
6922
  }
6850
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
6923
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
6851
6924
  };
6852
6925
  });
6853
6926
  const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -6862,12 +6935,18 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6862
6935
  // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
6863
6936
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
6864
6937
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
6865
- // Prefixes in place, like util.prefixIssues does for every interpreted path.
6938
+ // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
6866
6939
  const prefixStr = (id, k) => `
6940
+ let ${id}_ab = false;
6867
6941
  for (let i = 0; i < ${id}.issues.length; i++) {
6868
6942
  const iss = ${id}.issues[i];
6869
6943
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
6870
6944
  payload.issues.push(iss);
6945
+ if (iss.continue !== true) ${id}_ab = true;
6946
+ }
6947
+ if (${id}_ab && ctx && ctx.abortEarly) {
6948
+ payload.value = newResult;
6949
+ return payload;
6871
6950
  }`;
6872
6951
  doc.write(`const input = payload.value;`);
6873
6952
  const ids = Object.create(null);
@@ -6916,6 +6995,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6916
6995
  input: undefined,
6917
6996
  path: [${k}]
6918
6997
  });
6998
+ if (ctx && ctx.abortEarly) {
6999
+ payload.value = newResult;
7000
+ return payload;
7001
+ }
6919
7002
  }
6920
7003
 
6921
7004
  if (${id}_present) {
@@ -6928,16 +7011,17 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6928
7011
  doc.write(`
6929
7012
  if (${id}.issues.length) {${prefixStr(id, k)}
6930
7013
  }
6931
-
6932
- if (${id}.value === undefined) {
6933
- if (${isPresent}) {
6934
- newResult[${k}] = undefined;
6935
- }
6936
- } else {
7014
+ `);
7015
+ if (optin === "defaulted") {
7016
+ doc.write(`newResult[${k}] = ${id}.value;`);
7017
+ }
7018
+ else {
7019
+ doc.write(`
7020
+ if (${id}.value !== undefined || ${isPresent}) {
6937
7021
  newResult[${k}] = ${id}.value;
6938
7022
  }
6939
-
6940
7023
  `);
7024
+ }
6941
7025
  }
6942
7026
  }
6943
7027
  doc.write(`payload.value = newResult;`);
@@ -6971,7 +7055,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6971
7055
  payload = fastpass(payload, ctx);
6972
7056
  if (!catchall)
6973
7057
  return payload;
6974
- return handleCatchall([], input, payload, ctx, value, inst);
7058
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
6975
7059
  }
6976
7060
  return superParse(payload, ctx);
6977
7061
  };
@@ -7181,6 +7265,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
7181
7265
  });
7182
7266
  return payload;
7183
7267
  }
7268
+ // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
7184
7269
  const proms = [];
7185
7270
  const values = def.keyType._zod.values;
7186
7271
  if (values && !def.partial) {
@@ -7340,9 +7425,11 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
7340
7425
  const values = getEnumValues(def.entries);
7341
7426
  const valuesSet = new Set(values);
7342
7427
  inst._zod.values = valuesSet;
7343
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
7344
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7345
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
7428
+ defineLazyInternal(inst, "pattern", (zod) => {
7429
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
7430
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7431
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
7432
+ });
7346
7433
  inst._zod.parse = (payload, _ctx) => {
7347
7434
  const input = payload.value;
7348
7435
  if (valuesSet.has(input)) {
@@ -7361,12 +7448,15 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
7361
7448
  $ZodType.init(inst, def);
7362
7449
  const values = new Set(def.values);
7363
7450
  inst._zod.values = values;
7364
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7365
- inst._zod.pattern = new RegExp(def.values.length
7366
- ? `^(${def.values
7367
- .map((o) => (typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)))
7368
- .join("|")})$`
7369
- : "^[^\\s\\S]$");
7451
+ defineLazyInternal(inst, "pattern", (zod) => {
7452
+ const vals = zod.def.values;
7453
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7454
+ return new RegExp(vals.length
7455
+ ? `^(${vals
7456
+ .map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o))
7457
+ .join("|")})$`
7458
+ : "^[^\\s\\S]$");
7459
+ });
7370
7460
  inst._zod.parse = (payload, _ctx) => {
7371
7461
  const input = payload.value;
7372
7462
  if (values.has(input)) {
@@ -7666,32 +7756,62 @@ class $ZodCyclicError extends Error {
7666
7756
  /** Keyed off the context object every schema in one parse call already shares. */
7667
7757
  const STATE$1 = "~memo";
7668
7758
  const NO_ISSUES = [];
7759
+ // a value a cycle can close through
7760
+ function isRef(value) {
7761
+ return value !== null && typeof value === "object";
7762
+ }
7669
7763
  // Receivers prefix paths in place, so the cache and every hand-out need their own copies.
7670
7764
  function cloneIssues(issues) {
7671
7765
  return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));
7672
7766
  }
7673
7767
  const recursive = /*@__PURE__*/ new WeakMap();
7768
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
7769
+ const NONE = 0;
7770
+ const ASSUMED = 1;
7771
+ const PROVEN = 2;
7674
7772
  /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
7675
- function isRecursive(inst, stack) {
7773
+ function isRecursive(inst, stack, resolve) {
7676
7774
  const cached = recursive.get(inst);
7677
7775
  if (cached !== undefined)
7678
- return cached;
7776
+ return cached ? PROVEN : NONE;
7679
7777
  // Relative to the walk in progress, so not cached.
7680
7778
  if (stack.has(inst))
7681
- return true;
7779
+ return PROVEN;
7682
7780
  stack.add(inst);
7683
- let result = false;
7781
+ let result = NONE;
7684
7782
  const check = (child) => {
7685
- if (!result && child?._zod && isRecursive(child, stack))
7686
- result = true;
7783
+ if (result !== PROVEN && child?._zod) {
7784
+ const answer = isRecursive(child, stack);
7785
+ if (answer > result)
7786
+ result = answer;
7787
+ }
7788
+ };
7789
+ // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
7790
+ const shape = (sh, spread) => {
7791
+ let answer = NONE;
7792
+ for (const key of Reflect.ownKeys(sh)) {
7793
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
7794
+ // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all
7795
+ if (!desc.enumerable)
7796
+ continue;
7797
+ // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle
7798
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack) : NONE;
7799
+ if (child > answer)
7800
+ answer = child;
7801
+ }
7802
+ return answer;
7803
+ };
7804
+ const merge = (answer) => {
7805
+ if (answer > result)
7806
+ result = answer;
7687
7807
  };
7688
7808
  const def = inst._zod.def;
7689
7809
  const kind = def.type;
7690
7810
  switch (kind) {
7691
7811
  case "object": {
7692
- // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
7693
- for (const key of Reflect.ownKeys(def.shape))
7694
- check(def.shape[key]);
7812
+ const raw = rawShape(def);
7813
+ // a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree
7814
+ merge(raw ? shape(raw) : ASSUMED);
7695
7815
  check(def.catchall);
7696
7816
  break;
7697
7817
  }
@@ -7738,10 +7858,13 @@ function isRecursive(inst, stack) {
7738
7858
  check(def.input);
7739
7859
  check(def.output);
7740
7860
  break;
7741
- // reading `_zod.innerType` resolves the getter once and caches it
7742
- case "lazy":
7743
- check(inst._zod.innerType);
7861
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
7862
+ case "lazy": {
7863
+ const inner = def._cachedInner ?? (undefined);
7864
+ // walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there
7865
+ merge(inner ? isRecursive(inner, stack) : ASSUMED);
7744
7866
  break;
7867
+ }
7745
7868
  // a leaf by choice: `parts` are regex fragments, not data positions
7746
7869
  case "template_literal":
7747
7870
  // leaves
@@ -7783,13 +7906,18 @@ function isRecursive(inst, stack) {
7783
7906
  }
7784
7907
  }
7785
7908
  stack.delete(inst);
7786
- recursive.set(inst, result);
7787
- return result;
7909
+ return settle(inst, result);
7910
+ }
7911
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
7912
+ function settle(inst, answer) {
7913
+ if (answer !== ASSUMED)
7914
+ recursive.set(inst, answer === PROVEN);
7915
+ return answer;
7788
7916
  }
7789
7917
  function bucketFor(state, inst) {
7790
7918
  let bucket = state.buckets.get(inst);
7791
7919
  if (!bucket) {
7792
- bucket = new Map();
7920
+ bucket = new WeakMap();
7793
7921
  state.buckets.set(inst, bucket);
7794
7922
  }
7795
7923
  return bucket;
@@ -7828,7 +7956,8 @@ const memo = {
7828
7956
  attach(inst) {
7829
7957
  var _a;
7830
7958
  let isRecursiveInst;
7831
- // `bucket` memoized for one parse; a recursive schema is re-entered many times and its bucket never changes
7959
+ let rechecked = false;
7960
+ // a recursive schema is re-entered many times per parse and its bucket never changes
7832
7961
  let lastCtx;
7833
7962
  let lastBucket;
7834
7963
  // Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.
@@ -7837,21 +7966,26 @@ const memo = {
7837
7966
  const base = inst._zod.parse;
7838
7967
  const wrapped = (payload, ctx) => {
7839
7968
  if (isRecursiveInst === undefined) {
7840
- isRecursiveInst = isRecursive(inst, new Set());
7841
- if (!isRecursiveInst) {
7969
+ const walked = isRecursive(inst, new Set());
7970
+ if (walked === NONE) {
7842
7971
  // Nothing here can ever fire, so take it back out.
7843
7972
  inst._zod.parse = base;
7844
7973
  if (inst._zod.run === wrapped)
7845
7974
  inst._zod.run = base;
7846
7975
  return base(payload, ctx);
7847
7976
  }
7977
+ // this parse resolves the deferred edges on its own path, so ask once more before latching
7978
+ if (walked === PROVEN || rechecked)
7979
+ isRecursiveInst = true;
7980
+ else
7981
+ rechecked = true;
7848
7982
  }
7849
7983
  const input = payload.value;
7850
- if (input === null || typeof input !== "object")
7984
+ if (!isRef(input))
7851
7985
  return base(payload, ctx);
7852
7986
  let state = ctx[STATE$1];
7853
7987
  if (!state) {
7854
- state = { buckets: new Map(), backEdges: undefined };
7988
+ state = { buckets: new WeakMap(), backEdges: undefined };
7855
7989
  ctx[STATE$1] = state;
7856
7990
  }
7857
7991
  let bucket;
@@ -7873,7 +8007,7 @@ const memo = {
7873
8007
  else {
7874
8008
  // Still being parsed: its own checks cover it, so skip them here.
7875
8009
  payload.memo = true;
7876
- state.backEdges ?? (state.backEdges = new Set());
8010
+ state.backEdges ?? (state.backEdges = new WeakSet());
7877
8011
  state.backEdges.add(hit.value);
7878
8012
  }
7879
8013
  return payload;
@@ -7909,7 +8043,7 @@ function memoizer() {
7909
8043
  /** Whether this value is a node a back-edge resolved to before it finished. */
7910
8044
  function isBackEdge(ctx, value) {
7911
8045
  const backEdges = ctx[STATE$1]?.backEdges;
7912
- return backEdges !== undefined && value !== null && typeof value === "object" && backEdges.has(value);
8046
+ return backEdges !== undefined && isRef(value) && backEdges.has(value);
7913
8047
  }
7914
8048
 
7915
8049
  const error = () => {
@@ -7951,7 +8085,9 @@ const error = () => {
7951
8085
  base64url: "base64url-encoded string",
7952
8086
  json_string: "JSON string",
7953
8087
  e164: "E.164 number",
8088
+ currency_code: "currency code",
7954
8089
  credit_card: "credit card number",
8090
+ iban: "IBAN",
7955
8091
  jwt: "JWT",
7956
8092
  template_literal: "input",
7957
8093
  };
@@ -8085,12 +8221,14 @@ function registry() {
8085
8221
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
8086
8222
  const globalRegistry = globalThis.__zod_globalRegistry;
8087
8223
 
8224
+ function snapshotChecks(def) {
8225
+ if (def.checks)
8226
+ def.checks = [...def.checks];
8227
+ return def;
8228
+ }
8088
8229
  // @__NO_SIDE_EFFECTS__
8089
8230
  function _string(Class, params) {
8090
- return new Class({
8091
- type: "string",
8092
- ...normalizeParams(params),
8093
- });
8231
+ return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
8094
8232
  }
8095
8233
  // @__NO_SIDE_EFFECTS__
8096
8234
  function _email(Class, params) {
@@ -8362,11 +8500,7 @@ function _isoDuration(Class, params) {
8362
8500
  }
8363
8501
  // @__NO_SIDE_EFFECTS__
8364
8502
  function _number(Class, params) {
8365
- return new Class({
8366
- type: "number",
8367
- checks: [],
8368
- ...normalizeParams(params),
8369
- });
8503
+ return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
8370
8504
  }
8371
8505
  // @__NO_SIDE_EFFECTS__
8372
8506
  function _int(Class, params) {
@@ -8520,6 +8654,14 @@ function _endsWith(suffix, params) {
8520
8654
  });
8521
8655
  }
8522
8656
  // @__NO_SIDE_EFFECTS__
8657
+ function _properties(shape, params) {
8658
+ return new $ZodCheckProperties({
8659
+ check: "properties",
8660
+ shape,
8661
+ ...normalizeParams(params),
8662
+ });
8663
+ }
8664
+ // @__NO_SIDE_EFFECTS__
8523
8665
  function _overwrite(tx) {
8524
8666
  return new $ZodCheckOverwrite({
8525
8667
  check: "overwrite",
@@ -8678,7 +8820,8 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
8678
8820
  Object.assign(json, result);
8679
8821
  return true;
8680
8822
  }
8681
- function process$1(schema, ctx, _params = { path: [], schemaPath: [] }) {
8823
+ // never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)
8824
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
8682
8825
  var _a;
8683
8826
  const def = schema._zod.def;
8684
8827
  // check for schema in seens
@@ -8724,7 +8867,7 @@ function process$1(schema, ctx, _params = { path: [], schemaPath: [] }) {
8724
8867
  // Also set ref if processor didn't (for inheritance)
8725
8868
  if (!result.ref)
8726
8869
  result.ref = parent;
8727
- process$1(parent, ctx, params);
8870
+ processSchema(parent, ctx, params);
8728
8871
  ctx.seen.get(parent).isParent = true;
8729
8872
  }
8730
8873
  }
@@ -8861,8 +9004,6 @@ function extractDefs(ctx, schema
8861
9004
  if (seen.count > 1) {
8862
9005
  if (ctx.reused === "ref") {
8863
9006
  extractToDef(entry);
8864
- // biome-ignore lint:
8865
- continue;
8866
9007
  }
8867
9008
  }
8868
9009
  }
@@ -9251,18 +9392,111 @@ function isTransforming(_schema, _ctx) {
9251
9392
  */
9252
9393
  const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
9253
9394
  const ctx = initializeContext({ ...params, processors });
9254
- process$1(schema, ctx);
9395
+ processSchema(schema, ctx);
9255
9396
  extractDefs(ctx, schema);
9256
9397
  return finalize(ctx, schema);
9257
9398
  };
9258
9399
  const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
9259
9400
  const { libraryOptions, target } = params ?? {};
9260
9401
  const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
9261
- process$1(schema, ctx);
9402
+ processSchema(schema, ctx);
9262
9403
  extractDefs(ctx, schema);
9263
9404
  return finalize(ctx, schema);
9264
9405
  };
9265
9406
 
9407
+ const narrowMin = (agg, key, value) => {
9408
+ if (agg[key] === undefined || value > agg[key])
9409
+ agg[key] = value;
9410
+ };
9411
+ const narrowMax = (agg, key, value) => {
9412
+ if (agg[key] === undefined || value < agg[key])
9413
+ agg[key] = value;
9414
+ };
9415
+ const narrowBoth = (agg, value) => {
9416
+ narrowMin(agg, "minimum", value);
9417
+ narrowMax(agg, "maximum", value);
9418
+ };
9419
+ const addDivisor = (agg, value) => {
9420
+ agg.multipleOf ?? (agg.multipleOf = []);
9421
+ if (!agg.multipleOf.includes(value))
9422
+ agg.multipleOf.push(value);
9423
+ };
9424
+ const addPattern = (agg, pattern) => {
9425
+ agg.patterns ?? (agg.patterns = new Set());
9426
+ agg.patterns.add(pattern);
9427
+ };
9428
+ const intersectMime = (agg, mime) => {
9429
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
9430
+ };
9431
+ // last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
9432
+ const setFormat = (agg, format) => {
9433
+ agg.format = format;
9434
+ if (format.includes("int"))
9435
+ agg.isInt = true;
9436
+ };
9437
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
9438
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
9439
+ const formatContributor = (ranges) => (agg, def) => {
9440
+ setFormat(agg, def.format);
9441
+ const [minimum, maximum] = ranges[def.format];
9442
+ narrowMin(agg, "minimum", minimum);
9443
+ narrowMax(agg, "maximum", maximum);
9444
+ };
9445
+ const contributors = {
9446
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
9447
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
9448
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
9449
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
9450
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
9451
+ min_length: minContributor,
9452
+ max_length: maxContributor,
9453
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
9454
+ min_size: minContributor,
9455
+ max_size: maxContributor,
9456
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
9457
+ string_format: (agg, def) => {
9458
+ setFormat(agg, def.format);
9459
+ if (def.pattern)
9460
+ addPattern(agg, def.pattern);
9461
+ if (def.format === "base64" || def.format === "base64url")
9462
+ agg.contentEncoding = def.format;
9463
+ if (def.local || def.precision === -1)
9464
+ agg.laxFormat = true;
9465
+ },
9466
+ mime_type: (agg, def) => intersectMime(agg, def.mime),
9467
+ };
9468
+ function aggregateChecks(schema) {
9469
+ const agg = {};
9470
+ const def = schema._zod.def;
9471
+ // a format schema is its own first check, same rule as $ZodType init
9472
+ const list = schema._zod.traits.has("$ZodCheck")
9473
+ ? [schema, ...(def.checks ?? [])]
9474
+ : (def.checks ?? []);
9475
+ for (const ch of list)
9476
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
9477
+ // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
9478
+ const bag = schema._zod.bag;
9479
+ if (bag.minimum !== undefined)
9480
+ narrowMin(agg, "minimum", bag.minimum);
9481
+ if (bag.exclusiveMinimum !== undefined)
9482
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
9483
+ if (bag.maximum !== undefined)
9484
+ narrowMax(agg, "maximum", bag.maximum);
9485
+ if (bag.exclusiveMaximum !== undefined)
9486
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
9487
+ if (bag.multipleOf !== undefined)
9488
+ addDivisor(agg, bag.multipleOf);
9489
+ if (bag.format !== undefined) {
9490
+ agg.format ?? (agg.format = bag.format);
9491
+ if (bag.format.includes("int"))
9492
+ agg.isInt = true;
9493
+ }
9494
+ if (bag.mime)
9495
+ intersectMime(agg, bag.mime);
9496
+ for (const pattern of bag.patterns ?? [])
9497
+ addPattern(agg, pattern);
9498
+ return agg;
9499
+ }
9266
9500
  const formatMap = {
9267
9501
  guid: "uuid",
9268
9502
  url: "uri",
@@ -9271,11 +9505,16 @@ const formatMap = {
9271
9505
  regex: "", // do not set
9272
9506
  };
9273
9507
  // ==================== SIMPLE TYPE PROCESSORS ====================
9508
+ // the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
9509
+ const exactPatterns = new Map([
9510
+ [base64Charset, base64],
9511
+ [base64urlCharset, base64url],
9512
+ ]);
9513
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
9274
9514
  const stringProcessor = (schema, ctx, _json, _params) => {
9275
9515
  const json = _json;
9276
9516
  json.type = "string";
9277
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod
9278
- .bag;
9517
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
9279
9518
  if (typeof minimum === "number")
9280
9519
  json.minLength = minimum;
9281
9520
  if (typeof maximum === "number")
@@ -9293,7 +9532,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
9293
9532
  if (contentEncoding)
9294
9533
  json.contentEncoding = contentEncoding;
9295
9534
  if (patterns && patterns.size > 0) {
9296
- const patternList = [...patterns];
9535
+ const patternList = [...patterns].map(exactPattern);
9297
9536
  if (patternList.length === 1)
9298
9537
  json.pattern = patternList[0].source;
9299
9538
  else if (patternList.length > 1) {
@@ -9310,11 +9549,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
9310
9549
  };
9311
9550
  const numberProcessor = (schema, ctx, _json, params) => {
9312
9551
  const json = _json;
9313
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
9314
- if (typeof format === "string" && format.includes("int"))
9315
- json.type = "integer";
9316
- else
9317
- json.type = "number";
9552
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
9553
+ json.type = isInt ? "integer" : "number";
9318
9554
  // when both minimum and exclusiveMinimum exist, pick the more restrictive one
9319
9555
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
9320
9556
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
@@ -9343,12 +9579,21 @@ const numberProcessor = (schema, ctx, _json, params) => {
9343
9579
  else if (typeof maximum === "number") {
9344
9580
  json.maximum = maximum;
9345
9581
  }
9346
- if (typeof multipleOf === "number") {
9582
+ if (multipleOf) {
9347
9583
  // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
9348
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
9349
- json.multipleOf = Math.abs(multipleOf);
9350
- else
9351
- handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
9584
+ const divisors = new Set();
9585
+ for (const divisor of multipleOf) {
9586
+ if (Number.isFinite(divisor) && divisor !== 0)
9587
+ divisors.add(Math.abs(divisor));
9588
+ else
9589
+ handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
9590
+ }
9591
+ // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
9592
+ const [first, ...rest] = divisors;
9593
+ if (first !== undefined)
9594
+ json.multipleOf = first;
9595
+ if (rest.length)
9596
+ json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
9352
9597
  }
9353
9598
  };
9354
9599
  const booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -9432,13 +9677,13 @@ const transformProcessor = (schema, ctx, json, params) => {
9432
9677
  const arrayProcessor = (schema, ctx, _json, params) => {
9433
9678
  const json = _json;
9434
9679
  const def = schema._zod.def;
9435
- const { minimum, maximum } = schema._zod.bag;
9680
+ const { minimum, maximum } = aggregateChecks(schema);
9436
9681
  if (typeof minimum === "number")
9437
9682
  json.minItems = minimum;
9438
9683
  if (typeof maximum === "number")
9439
9684
  json.maxItems = maximum;
9440
9685
  json.type = "array";
9441
- json.items = process$1(def.element, ctx, {
9686
+ json.items = processSchema(def.element, ctx, {
9442
9687
  ...params,
9443
9688
  path: [...params.path, "items"],
9444
9689
  });
@@ -9472,24 +9717,21 @@ const objectProcessor = (schema, ctx, _json, params) => {
9472
9717
  json.properties = {};
9473
9718
  for (const key in shape) {
9474
9719
  // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
9475
- assignProp(json.properties, key, process$1(shape[key], ctx, {
9720
+ assignProp(json.properties, key, processSchema(shape[key], ctx, {
9476
9721
  ...params,
9477
9722
  path: [...params.path, "properties", key],
9478
9723
  }));
9479
9724
  }
9480
9725
  // required keys
9481
- const allKeys = new Set(Object.keys(shape));
9482
- const requiredKeys = new Set([...allKeys].filter((key) => {
9726
+ const requiredKeys = [];
9727
+ for (const key of Object.keys(shape)) {
9483
9728
  const field = def.shape[key];
9484
- if (ctx.io === "input") {
9485
- return inputOptin(field) === undefined;
9486
- }
9487
- else {
9488
- return field._zod.optout === undefined;
9729
+ if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
9730
+ requiredKeys.push(key);
9489
9731
  }
9490
- }));
9491
- if (requiredKeys.size > 0) {
9492
- json.required = Array.from(requiredKeys);
9732
+ }
9733
+ if (requiredKeys.length > 0) {
9734
+ json.required = requiredKeys;
9493
9735
  }
9494
9736
  // catchall
9495
9737
  if (def.catchall?._zod.def.type === "never") {
@@ -9502,7 +9744,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
9502
9744
  json.additionalProperties = false;
9503
9745
  }
9504
9746
  else if (def.catchall) {
9505
- json.additionalProperties = process$1(def.catchall, ctx, {
9747
+ json.additionalProperties = processSchema(def.catchall, ctx, {
9506
9748
  ...params,
9507
9749
  path: [...params.path, "additionalProperties"],
9508
9750
  });
@@ -9512,7 +9754,7 @@ const unionProcessor = (schema, ctx, json, params) => {
9512
9754
  const def = schema._zod.def;
9513
9755
  // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
9514
9756
  const isExclusive = def.inclusive === false;
9515
- const options = def.options.map((x, i) => process$1(x, ctx, {
9757
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
9516
9758
  ...params,
9517
9759
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
9518
9760
  }));
@@ -9525,11 +9767,11 @@ const unionProcessor = (schema, ctx, json, params) => {
9525
9767
  };
9526
9768
  const intersectionProcessor = (schema, ctx, json, params) => {
9527
9769
  const def = schema._zod.def;
9528
- const a = process$1(def.left, ctx, {
9770
+ const a = processSchema(def.left, ctx, {
9529
9771
  ...params,
9530
9772
  path: [...params.path, "allOf", 0],
9531
9773
  });
9532
- const b = process$1(def.right, ctx, {
9774
+ const b = processSchema(def.right, ctx, {
9533
9775
  ...params,
9534
9776
  path: [...params.path, "allOf", 1],
9535
9777
  });
@@ -9629,23 +9871,22 @@ const recordProcessor = (schema, ctx, _json, params) => {
9629
9871
  json.type = "object";
9630
9872
  // For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
9631
9873
  const keyType = def.keyType;
9632
- const keyBag = keyType._zod.bag;
9633
- const patterns = keyBag?.patterns;
9874
+ const patterns = aggregateChecks(keyType).patterns;
9634
9875
  if (def.mode === "loose" && patterns && patterns.size > 0) {
9635
9876
  // Use patternProperties for looseRecord with regex patterns
9636
- const valueSchema = process$1(def.valueType, ctx, {
9877
+ const valueSchema = processSchema(def.valueType, ctx, {
9637
9878
  ...params,
9638
9879
  path: [...params.path, "patternProperties", "*"],
9639
9880
  });
9640
9881
  json.patternProperties = {};
9641
9882
  for (const pattern of patterns) {
9642
- assignProp(json.patternProperties, pattern.source, valueSchema);
9883
+ assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
9643
9884
  }
9644
9885
  }
9645
9886
  else {
9646
9887
  // Default behavior: use propertyNames + additionalProperties
9647
9888
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
9648
- json.propertyNames = process$1(def.keyType, ctx, {
9889
+ json.propertyNames = processSchema(def.keyType, ctx, {
9649
9890
  ...params,
9650
9891
  path: [...params.path, "propertyNames"],
9651
9892
  });
@@ -9657,7 +9898,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
9657
9898
  }
9658
9899
  pending.push(schema);
9659
9900
  }
9660
- json.additionalProperties = process$1(def.valueType, ctx, {
9901
+ json.additionalProperties = processSchema(def.valueType, ctx, {
9661
9902
  ...params,
9662
9903
  path: [...params.path, "additionalProperties"],
9663
9904
  });
@@ -9675,7 +9916,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
9675
9916
  };
9676
9917
  const nullableProcessor = (schema, ctx, json, params) => {
9677
9918
  const def = schema._zod.def;
9678
- const inner = process$1(def.innerType, ctx, params);
9919
+ const inner = processSchema(def.innerType, ctx, params);
9679
9920
  const seen = ctx.seen.get(schema);
9680
9921
  if (ctx.target === "openapi-3.0") {
9681
9922
  seen.ref = def.innerType;
@@ -9687,7 +9928,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
9687
9928
  };
9688
9929
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
9689
9930
  const def = schema._zod.def;
9690
- process$1(def.innerType, ctx, params);
9931
+ processSchema(def.innerType, ctx, params);
9691
9932
  const seen = ctx.seen.get(schema);
9692
9933
  seen.ref = def.innerType;
9693
9934
  };
@@ -9710,7 +9951,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
9710
9951
  }
9711
9952
  const defaultProcessor = (schema, ctx, json, params) => {
9712
9953
  const def = schema._zod.def;
9713
- process$1(def.innerType, ctx, params);
9954
+ processSchema(def.innerType, ctx, params);
9714
9955
  const seen = ctx.seen.get(schema);
9715
9956
  seen.ref = def.innerType;
9716
9957
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -9719,7 +9960,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
9719
9960
  };
9720
9961
  const prefaultProcessor = (schema, ctx, json, params) => {
9721
9962
  const def = schema._zod.def;
9722
- process$1(def.innerType, ctx, params);
9963
+ processSchema(def.innerType, ctx, params);
9723
9964
  const seen = ctx.seen.get(schema);
9724
9965
  seen.ref = def.innerType;
9725
9966
  if (ctx.io !== "input")
@@ -9730,7 +9971,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
9730
9971
  };
9731
9972
  const catchProcessor = (schema, ctx, json, params) => {
9732
9973
  const def = schema._zod.def;
9733
- process$1(def.innerType, ctx, params);
9974
+ processSchema(def.innerType, ctx, params);
9734
9975
  const seen = ctx.seen.get(schema);
9735
9976
  seen.ref = def.innerType;
9736
9977
  let catchValue;
@@ -9747,20 +9988,20 @@ const pipeProcessor = (schema, ctx, _json, params) => {
9747
9988
  const def = schema._zod.def;
9748
9989
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
9749
9990
  const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
9750
- process$1(innerType, ctx, params);
9991
+ processSchema(innerType, ctx, params);
9751
9992
  const seen = ctx.seen.get(schema);
9752
9993
  seen.ref = innerType;
9753
9994
  };
9754
9995
  const readonlyProcessor = (schema, ctx, json, params) => {
9755
9996
  const def = schema._zod.def;
9756
- process$1(def.innerType, ctx, params);
9997
+ processSchema(def.innerType, ctx, params);
9757
9998
  const seen = ctx.seen.get(schema);
9758
9999
  seen.ref = def.innerType;
9759
10000
  json.readOnly = true;
9760
10001
  };
9761
10002
  const optionalProcessor = (schema, ctx, _json, params) => {
9762
10003
  const def = schema._zod.def;
9763
- process$1(def.innerType, ctx, params);
10004
+ processSchema(def.innerType, ctx, params);
9764
10005
  const seen = ctx.seen.get(schema);
9765
10006
  seen.ref = def.innerType;
9766
10007
  };
@@ -9977,6 +10218,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
9977
10218
  set spa(value) {
9978
10219
  own(this, "spa", value);
9979
10220
  },
10221
+ validate(data, params) {
10222
+ return validate(this, data, params);
10223
+ },
10224
+ validateAsync(data, params) {
10225
+ return validateAsync$1(this, data, params);
10226
+ },
9980
10227
  encode: function _encode(data, params) {
9981
10228
  return encode(this, data, params, { callee: _encode });
9982
10229
  },
@@ -10018,10 +10265,11 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
10018
10265
  $ZodString.init(inst, def);
10019
10266
  ZodType.init(inst, def);
10020
10267
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json);
10021
- const bag = inst._zod.bag;
10022
- inst.format = bag.format ?? null;
10023
- inst.minLength = bag.minimum ?? null;
10024
- inst.maxLength = bag.maximum ?? null;
10268
+ },
10269
+ /*@__PURE__*/ derived({
10270
+ format: (inst) => aggregateChecks(inst).format ?? null,
10271
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
10272
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null,
10025
10273
  }, {
10026
10274
  regex(...args) {
10027
10275
  return this.check(_regex(...args));
@@ -10068,7 +10316,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
10068
10316
  slugify() {
10069
10317
  return this.check(_slugify());
10070
10318
  },
10071
- });
10319
+ }));
10072
10320
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
10073
10321
  $ZodString.init(inst, def);
10074
10322
  _ZodString.init(inst, def);
@@ -10277,14 +10525,22 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
10277
10525
  $ZodNumber.init(inst, def);
10278
10526
  ZodType.init(inst, def);
10279
10527
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
10280
- const bag = inst._zod.bag;
10281
- inst.minValue =
10282
- Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
10283
- inst.maxValue =
10284
- Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
10285
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
10286
10528
  inst.isFinite = true;
10287
- inst.format = bag.format ?? null;
10529
+ },
10530
+ /*@__PURE__*/ derived({
10531
+ minValue: (inst) => {
10532
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
10533
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
10534
+ },
10535
+ maxValue: (inst) => {
10536
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
10537
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
10538
+ },
10539
+ isInt: (inst) => {
10540
+ const { isInt, multipleOf } = aggregateChecks(inst);
10541
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
10542
+ },
10543
+ format: (inst) => aggregateChecks(inst).format ?? null,
10288
10544
  }, {
10289
10545
  gt(value, params) {
10290
10546
  return this.check(_gt(value, params));
@@ -10331,7 +10587,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
10331
10587
  finite() {
10332
10588
  return this;
10333
10589
  },
10334
- });
10590
+ }));
10335
10591
  function number(params) {
10336
10592
  return _number(ZodNumber, params);
10337
10593
  }
@@ -10403,19 +10659,20 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
10403
10659
  return _enum(Object.keys(this._zod.def.shape));
10404
10660
  },
10405
10661
  catchall(catchall) {
10406
- return this.clone({ ...this._zod.def, catchall: catchall });
10662
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
10663
+ return this.clone(mergeDefs(this._zod.def, { catchall: catchall }));
10407
10664
  },
10408
10665
  passthrough() {
10409
- return this.clone({ ...this._zod.def, catchall: unknown() });
10666
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
10410
10667
  },
10411
10668
  loose() {
10412
- return this.clone({ ...this._zod.def, catchall: unknown() });
10669
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
10413
10670
  },
10414
10671
  strict() {
10415
- return this.clone({ ...this._zod.def, catchall: never() });
10672
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
10416
10673
  },
10417
10674
  strip() {
10418
- return this.clone({ ...this._zod.def, catchall: undefined });
10675
+ return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
10419
10676
  },
10420
10677
  extend(incoming) {
10421
10678
  return extend(this, incoming);
@@ -10505,7 +10762,8 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
10505
10762
  ZodType.init(inst, def);
10506
10763
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json);
10507
10764
  inst.enum = def.entries;
10508
- inst.options = Object.values(def.entries);
10765
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
10766
+ inst.options = [...inst._zod.values];
10509
10767
  const keys = new Set(Object.keys(def.entries));
10510
10768
  inst.extract = (values, params) => {
10511
10769
  const newEntries = {};
@@ -10762,8 +11020,16 @@ function refine(fn, _params = {}) {
10762
11020
  function superRefine(fn, params) {
10763
11021
  return _superRefine(fn, params);
10764
11022
  }
11023
+ const ZodInstanceOf = /*@__PURE__*/ $constructor("ZodInstanceOf", (inst, def) => {
11024
+ ZodCustom.init(inst, def);
11025
+ }, {
11026
+ properties(shape, params) {
11027
+ // asserts in place, so the narrowed output type is truthful without a wrapper
11028
+ return this.check(_properties(shape, params));
11029
+ },
11030
+ });
10765
11031
  function _instanceof(cls, params = {}) {
10766
- const inst = new ZodCustom({
11032
+ const inst = new ZodInstanceOf({
10767
11033
  type: "custom",
10768
11034
  check: "custom",
10769
11035
  fn: (data) => data instanceof cls,
@@ -11075,7 +11341,7 @@ const TelemetryCustomEventSchema = TelemetryEventSchema.extend({
11075
11341
  type: literal(TelemetryType.Custom),
11076
11342
  }).passthrough();
11077
11343
 
11078
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11344
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11079
11345
  /*
11080
11346
  * Copyright (c) Microsoft Corporation. All rights reserved.
11081
11347
  * Licensed under the MIT License.
@@ -11129,7 +11395,7 @@ const RESOURCE = "resource";
11129
11395
  const CLI_DATA = "clidata";
11130
11396
  const ATTRIBUTE_TOKENS = "attribute_tokens";
11131
11397
 
11132
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11398
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11133
11399
  /*
11134
11400
  * Copyright (c) Microsoft Corporation. All rights reserved.
11135
11401
  * Licensed under the MIT License.
@@ -11363,7 +11629,7 @@ const JsonWebTokenTypes = {
11363
11629
  // Token renewal offset default in seconds
11364
11630
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
11365
11631
 
11366
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11632
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11367
11633
  /*
11368
11634
  * Copyright (c) Microsoft Corporation. All rights reserved.
11369
11635
  * Licensed under the MIT License.
@@ -11392,7 +11658,7 @@ function createAuthError(code, correlationId, additionalMessage) {
11392
11658
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
11393
11659
  }
11394
11660
 
11395
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11661
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11396
11662
 
11397
11663
  /*
11398
11664
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11415,7 +11681,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
11415
11681
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
11416
11682
  }
11417
11683
 
11418
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11684
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11419
11685
  /*
11420
11686
  * Copyright (c) Microsoft Corporation. All rights reserved.
11421
11687
  * Licensed under the MIT License.
@@ -11453,7 +11719,7 @@ const methodNotImplemented = "method_not_implemented";
11453
11719
  const resourceParameterRequired = "resource_parameter_required";
11454
11720
  const misplacedResourceParam = "misplaced_resource_parameter";
11455
11721
 
11456
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11722
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11457
11723
 
11458
11724
  /*
11459
11725
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11491,7 +11757,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
11491
11757
  };
11492
11758
  }
11493
11759
 
11494
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11760
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11495
11761
 
11496
11762
  /*
11497
11763
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11557,7 +11823,7 @@ function getJWSPayload(authToken, correlationId) {
11557
11823
  return matches[2];
11558
11824
  }
11559
11825
 
11560
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11826
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11561
11827
 
11562
11828
  /*
11563
11829
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11645,7 +11911,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
11645
11911
  return updatedAccountInfo;
11646
11912
  }
11647
11913
 
11648
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11914
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11649
11915
  /*
11650
11916
  * Copyright (c) Microsoft Corporation. All rights reserved.
11651
11917
  * Licensed under the MIT License.
@@ -11659,7 +11925,7 @@ const AuthorityType = {
11659
11925
  Ciam: 3,
11660
11926
  };
11661
11927
 
11662
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11928
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11663
11929
  /*
11664
11930
  * Copyright (c) Microsoft Corporation. All rights reserved.
11665
11931
  * Licensed under the MIT License.
@@ -11681,7 +11947,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
11681
11947
  return null;
11682
11948
  }
11683
11949
 
11684
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11950
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11685
11951
  /*
11686
11952
  * Copyright (c) Microsoft Corporation. All rights reserved.
11687
11953
  * Licensed under the MIT License.
@@ -11705,7 +11971,7 @@ const ProtocolMode = {
11705
11971
  EAR: "EAR",
11706
11972
  };
11707
11973
 
11708
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11974
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11709
11975
  /**
11710
11976
  * Returns the AccountInfo interface for this account.
11711
11977
  * @internal
@@ -11894,7 +12160,7 @@ function isAccountEntity(entity) {
11894
12160
  entity.hasOwnProperty("authorityType"));
11895
12161
  }
11896
12162
 
11897
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12163
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11898
12164
  /*
11899
12165
  * Copyright (c) Microsoft Corporation. All rights reserved.
11900
12166
  * Licensed under the MIT License.
@@ -11904,7 +12170,7 @@ function isAccountEntity(entity) {
11904
12170
  */
11905
12171
  const unexpectedError = "unexpected_error";
11906
12172
 
11907
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12173
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11908
12174
 
11909
12175
  /*
11910
12176
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11924,7 +12190,7 @@ function createClientConfigurationError(errorCode, correlationId) {
11924
12190
  return new ClientConfigurationError(errorCode, correlationId);
11925
12191
  }
11926
12192
 
11927
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12193
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11928
12194
  /*
11929
12195
  * Copyright (c) Microsoft Corporation. All rights reserved.
11930
12196
  * Licensed under the MIT License.
@@ -11955,7 +12221,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
11955
12221
  const invalidDpopNonce = "invalid_dpop_nonce";
11956
12222
  const dpopMissingResourceContext = "dpop_missing_resource_context";
11957
12223
 
11958
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12224
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11959
12225
  /*
11960
12226
  * Copyright (c) Microsoft Corporation. All rights reserved.
11961
12227
  * Licensed under the MIT License.
@@ -11967,7 +12233,7 @@ function isOpenIdConfigResponse(response) {
11967
12233
  response.hasOwnProperty("jwks_uri"));
11968
12234
  }
11969
12235
 
11970
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12236
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11971
12237
  /*
11972
12238
  * Copyright (c) Microsoft Corporation. All rights reserved.
11973
12239
  * Licensed under the MIT License.
@@ -12047,7 +12313,7 @@ class StringUtils {
12047
12313
  }
12048
12314
  }
12049
12315
 
12050
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12316
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12051
12317
 
12052
12318
  /*
12053
12319
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12205,7 +12471,7 @@ class UrlString {
12205
12471
  }
12206
12472
  }
12207
12473
 
12208
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12474
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12209
12475
 
12210
12476
  /*
12211
12477
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12359,7 +12625,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
12359
12625
  return null;
12360
12626
  }
12361
12627
 
12362
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12628
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12363
12629
  /*
12364
12630
  * Copyright (c) Microsoft Corporation. All rights reserved.
12365
12631
  * Licensed under the MIT License.
@@ -12368,7 +12634,7 @@ const AzureCloudInstance = {
12368
12634
  // AzureCloudInstance is not specified.
12369
12635
  None: "none"};
12370
12636
 
12371
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12637
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12372
12638
  /*
12373
12639
  * Copyright (c) Microsoft Corporation. All rights reserved.
12374
12640
  * Licensed under the MIT License.
@@ -12378,7 +12644,7 @@ function isCloudInstanceDiscoveryResponse(response) {
12378
12644
  response.hasOwnProperty("metadata"));
12379
12645
  }
12380
12646
 
12381
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12647
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12382
12648
  /*
12383
12649
  * Copyright (c) Microsoft Corporation. All rights reserved.
12384
12650
  * Licensed under the MIT License.
@@ -12388,7 +12654,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
12388
12654
  response.hasOwnProperty("error_description"));
12389
12655
  }
12390
12656
 
12391
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12657
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12392
12658
  /*
12393
12659
  * Copyright (c) Microsoft Corporation. All rights reserved.
12394
12660
  * Licensed under the MIT License.
@@ -12459,7 +12725,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
12459
12725
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
12460
12726
  const SetUserData = "setUserData";
12461
12727
 
12462
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12728
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12463
12729
  /*
12464
12730
  * Copyright (c) Microsoft Corporation. All rights reserved.
12465
12731
  * Licensed under the MIT License.
@@ -12552,7 +12818,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
12552
12818
  };
12553
12819
  };
12554
12820
 
12555
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12821
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12556
12822
 
12557
12823
  /*
12558
12824
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12663,7 +12929,7 @@ RegionDiscovery.IMDS_OPTIONS = {
12663
12929
  },
12664
12930
  };
12665
12931
 
12666
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12932
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12667
12933
  /*
12668
12934
  * Copyright (c) Microsoft Corporation. All rights reserved.
12669
12935
  * Licensed under the MIT License.
@@ -12728,7 +12994,7 @@ function wasClockTurnedBack(cachedAt) {
12728
12994
  return cachedAtSec > nowSeconds();
12729
12995
  }
12730
12996
 
12731
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12997
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12732
12998
 
12733
12999
  /*
12734
13000
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -13015,7 +13281,7 @@ function serializeAttributeTokens(attributeTokens) {
13015
13281
  return [...attributeTokens].sort().join(" ");
13016
13282
  }
13017
13283
 
13018
- /*! @azure/msal-common v16.14.0 2026-08-28 */
13284
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
13019
13285
 
13020
13286
  /*
13021
13287
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -13983,7 +14249,7 @@ function buildStaticAuthorityOptions(authOptions) {
13983
14249
  };
13984
14250
  }
13985
14251
 
13986
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14252
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
13987
14253
 
13988
14254
  /*
13989
14255
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14017,7 +14283,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
14017
14283
  }
14018
14284
  }
14019
14285
 
14020
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14286
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14021
14287
 
14022
14288
  /*
14023
14289
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14213,7 +14479,7 @@ class ScopeSet {
14213
14479
  }
14214
14480
  }
14215
14481
 
14216
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14482
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14217
14483
 
14218
14484
  /*
14219
14485
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14699,7 +14965,7 @@ function addAttributeTokens(parameters, attributeTokens) {
14699
14965
  }
14700
14966
  }
14701
14967
 
14702
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14968
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14703
14969
 
14704
14970
  /*
14705
14971
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14821,7 +15087,7 @@ function validateUrl(url, logger, correlationId) {
14821
15087
  }
14822
15088
  }
14823
15089
 
14824
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15090
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14825
15091
 
14826
15092
  /*
14827
15093
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14869,7 +15135,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
14869
15135
  },
14870
15136
  };
14871
15137
 
14872
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15138
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14873
15139
 
14874
15140
  /*
14875
15141
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14892,7 +15158,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
14892
15158
  },
14893
15159
  };
14894
15160
 
14895
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15161
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14896
15162
  /*
14897
15163
  * Copyright (c) Microsoft Corporation. All rights reserved.
14898
15164
  * Licensed under the MIT License.
@@ -15167,12 +15433,12 @@ class Logger {
15167
15433
  }
15168
15434
  }
15169
15435
 
15170
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15436
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15171
15437
  /* eslint-disable header/header */
15172
15438
  const name$1 = "@azure/msal-common";
15173
- const version$2 = "16.14.0";
15439
+ const version$2 = "16.14.1";
15174
15440
 
15175
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15441
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15176
15442
  /*
15177
15443
  * Copyright (c) Microsoft Corporation. All rights reserved.
15178
15444
  * Licensed under the MIT License.
@@ -15180,7 +15446,7 @@ const version$2 = "16.14.0";
15180
15446
  const cacheQuotaExceeded = "cache_quota_exceeded";
15181
15447
  const cacheErrorUnknown = "cache_error_unknown";
15182
15448
 
15183
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15449
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15184
15450
 
15185
15451
  /*
15186
15452
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15218,7 +15484,7 @@ function createCacheError(e) {
15218
15484
  }
15219
15485
  }
15220
15486
 
15221
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15487
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15222
15488
 
15223
15489
  /*
15224
15490
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16405,7 +16671,7 @@ class DefaultStorageClass extends CacheManager {
16405
16671
  }
16406
16672
  }
16407
16673
 
16408
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16674
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16409
16675
  /*
16410
16676
  * Copyright (c) Microsoft Corporation. All rights reserved.
16411
16677
  * Licensed under the MIT License.
@@ -16419,7 +16685,7 @@ class DefaultStorageClass extends CacheManager {
16419
16685
  const PerformanceEventStatus = {
16420
16686
  InProgress: 1};
16421
16687
 
16422
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16688
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16423
16689
 
16424
16690
  /*
16425
16691
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16477,7 +16743,7 @@ class StubPerformanceClient {
16477
16743
  }
16478
16744
  }
16479
16745
 
16480
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16746
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16481
16747
 
16482
16748
  /*
16483
16749
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16575,7 +16841,7 @@ function isOidcProtocolMode(config) {
16575
16841
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
16576
16842
  }
16577
16843
 
16578
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16844
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16579
16845
  /*
16580
16846
  * Copyright (c) Microsoft Corporation. All rights reserved.
16581
16847
  * Licensed under the MIT License.
@@ -16602,7 +16868,7 @@ function isOidcProtocolMode(config) {
16602
16868
  }
16603
16869
  }
16604
16870
 
16605
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16871
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16606
16872
 
16607
16873
  /*
16608
16874
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16623,7 +16889,7 @@ function createJoseHeaderError(code, correlationId) {
16623
16889
  return new JoseHeaderError(code, correlationId);
16624
16890
  }
16625
16891
 
16626
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16892
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16627
16893
  /*
16628
16894
  * Copyright (c) Microsoft Corporation. All rights reserved.
16629
16895
  * Licensed under the MIT License.
@@ -16648,7 +16914,7 @@ function isPlainObject(value) {
16648
16914
  return Object.getPrototypeOf(value) === proto;
16649
16915
  }
16650
16916
 
16651
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16917
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16652
16918
  /*
16653
16919
  * Copyright (c) Microsoft Corporation. All rights reserved.
16654
16920
  * Licensed under the MIT License.
@@ -16658,7 +16924,7 @@ const missingAlgError = "missing_alg_error";
16658
16924
  const missingJwkError = "missing_jwk_error";
16659
16925
  const invalidJwkError = "invalid_jwk_error";
16660
16926
 
16661
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16927
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16662
16928
 
16663
16929
  /*
16664
16930
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16724,7 +16990,7 @@ class JoseHeader {
16724
16990
  }
16725
16991
  }
16726
16992
 
16727
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16993
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16728
16994
 
16729
16995
  /*
16730
16996
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16825,7 +17091,7 @@ class PopTokenGenerator {
16825
17091
  }
16826
17092
  }
16827
17093
 
16828
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17094
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16829
17095
 
16830
17096
  /*
16831
17097
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16970,7 +17236,7 @@ class DpopProofGenerator {
16970
17236
  }
16971
17237
  }
16972
17238
 
16973
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17239
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16974
17240
  /*
16975
17241
  * Copyright (c) Microsoft Corporation. All rights reserved.
16976
17242
  * Licensed under the MIT License.
@@ -17021,7 +17287,7 @@ const badToken = "bad_token";
17021
17287
  */
17022
17288
  const interruptedUser = "interrupted_user";
17023
17289
 
17024
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17290
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17025
17291
 
17026
17292
  /*
17027
17293
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17088,7 +17354,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
17088
17354
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
17089
17355
  }
17090
17356
 
17091
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17357
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17092
17358
 
17093
17359
  /*
17094
17360
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17107,7 +17373,7 @@ class ServerError extends AuthError {
17107
17373
  }
17108
17374
  }
17109
17375
 
17110
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17376
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17111
17377
 
17112
17378
  /*
17113
17379
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17178,7 +17444,7 @@ function parseRequestState(base64Decode, state, correlationId) {
17178
17444
  }
17179
17445
  }
17180
17446
 
17181
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17447
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17182
17448
 
17183
17449
  /*
17184
17450
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17251,11 +17517,26 @@ class ResponseHandler {
17251
17517
  let idTokenClaims;
17252
17518
  if (serverTokenResponse.id_token) {
17253
17519
  idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode, request.correlationId);
17254
- // token nonce check (TODO: Add a warning if no nonce is given?)
17255
- if (authCodePayload && authCodePayload.nonce) {
17256
- if (idTokenClaims.nonce !== authCodePayload.nonce) {
17257
- throw createClientAuthError(nonceMismatch, request.correlationId);
17258
- }
17520
+ }
17521
+ /*
17522
+ * Callers opt in to strict nonce-presence validation by including
17523
+ * the nonce property, even when its value is undefined.
17524
+ */
17525
+ if (authCodePayload &&
17526
+ Object.prototype.hasOwnProperty.call(authCodePayload, "nonce")) {
17527
+ const expectedNonce = authCodePayload.nonce;
17528
+ const tokenNonce = idTokenClaims?.nonce;
17529
+ // Warn when the ID Token nonce cannot be bound to the request.
17530
+ if (tokenNonce !== undefined && expectedNonce === undefined) {
17531
+ this.logger.warning("0thba9", request.correlationId);
17532
+ throw createClientAuthError(nonceMismatch, request.correlationId);
17533
+ }
17534
+ // If the request supplies a nonce, the ID Token value must be a matching string.
17535
+ if (expectedNonce !== undefined &&
17536
+ (typeof expectedNonce !== "string" ||
17537
+ typeof tokenNonce !== "string" ||
17538
+ expectedNonce !== tokenNonce)) {
17539
+ throw createClientAuthError(nonceMismatch, request.correlationId);
17259
17540
  }
17260
17541
  }
17261
17542
  // generate homeAccountId
@@ -17591,7 +17872,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
17591
17872
  return baseAccount;
17592
17873
  }
17593
17874
 
17594
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17875
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17595
17876
  /*
17596
17877
  * Copyright (c) Microsoft Corporation. All rights reserved.
17597
17878
  * Licensed under the MIT License.
@@ -17601,7 +17882,7 @@ const CcsCredentialType = {
17601
17882
  UPN: "UPN",
17602
17883
  };
17603
17884
 
17604
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17885
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17605
17886
  /*
17606
17887
  * Copyright (c) Microsoft Corporation. All rights reserved.
17607
17888
  * Licensed under the MIT License.
@@ -17620,7 +17901,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
17620
17901
  }
17621
17902
  }
17622
17903
 
17623
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17904
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17624
17905
 
17625
17906
  /*
17626
17907
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17644,7 +17925,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
17644
17925
  };
17645
17926
  }
17646
17927
 
17647
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17928
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17648
17929
 
17649
17930
  /*
17650
17931
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17730,7 +18011,7 @@ class ThrottlingUtils {
17730
18011
  }
17731
18012
  }
17732
18013
 
17733
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18014
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17734
18015
 
17735
18016
  /*
17736
18017
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17761,7 +18042,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
17761
18042
  return new NetworkError(error, httpStatus, responseHeaders);
17762
18043
  }
17763
18044
 
17764
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18045
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17765
18046
 
17766
18047
  /*
17767
18048
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17894,7 +18175,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
17894
18175
  return response;
17895
18176
  }
17896
18177
 
17897
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18178
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17898
18179
 
17899
18180
  /*
17900
18181
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18158,7 +18439,7 @@ class AuthorizationCodeClient {
18158
18439
  }
18159
18440
  }
18160
18441
 
18161
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18442
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18162
18443
 
18163
18444
  /*
18164
18445
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18385,7 +18666,7 @@ function extractLoginHint(account) {
18385
18666
  return account.loginHint || account.idTokenClaims?.login_hint || null;
18386
18667
  }
18387
18668
 
18388
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18669
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18389
18670
 
18390
18671
  /*
18391
18672
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18619,7 +18900,7 @@ class RefreshTokenClient {
18619
18900
  }
18620
18901
  }
18621
18902
 
18622
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18903
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18623
18904
 
18624
18905
  /*
18625
18906
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18912,7 +19193,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
18912
19193
  clearNativeBrokerErrorCode() { }
18913
19194
  }
18914
19195
 
18915
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19196
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18916
19197
 
18917
19198
  /*
18918
19199
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19039,7 +19320,7 @@ class SilentFlowClient {
19039
19320
  }
19040
19321
  }
19041
19322
 
19042
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19323
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
19043
19324
 
19044
19325
  /*
19045
19326
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19055,7 +19336,7 @@ const StubbedNetworkModule = {
19055
19336
  },
19056
19337
  };
19057
19338
 
19058
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19339
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
19059
19340
 
19060
19341
  /*
19061
19342
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19088,7 +19369,7 @@ function containsResourceParam(params) {
19088
19369
  return Object.prototype.hasOwnProperty.call(params, "resource");
19089
19370
  }
19090
19371
 
19091
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19372
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19092
19373
  /*
19093
19374
  * Copyright (c) Microsoft Corporation. All rights reserved.
19094
19375
  * Licensed under the MIT License.
@@ -19215,7 +19496,7 @@ const DecryptEarResponse = "decryptEarResponse";
19215
19496
  */
19216
19497
  const WaitForBridgeLateResponse = "waitForBridgeLateResponse";
19217
19498
 
19218
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19499
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19219
19500
 
19220
19501
  /*
19221
19502
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19238,7 +19519,7 @@ function createBrowserAuthError(errorCode, correlationId, subError) {
19238
19519
  return new BrowserAuthError(errorCode, correlationId, subError);
19239
19520
  }
19240
19521
 
19241
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19522
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19242
19523
  /*
19243
19524
  * Copyright (c) Microsoft Corporation. All rights reserved.
19244
19525
  * Licensed under the MIT License.
@@ -19296,7 +19577,7 @@ const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
19296
19577
  const timedOut = "timed_out";
19297
19578
  const emptyResponse = "empty_response";
19298
19579
 
19299
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19580
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19300
19581
 
19301
19582
  /*
19302
19583
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19335,7 +19616,7 @@ function base64DecToArr(base64String) {
19335
19616
  return Uint8Array.from(binString, (m) => m.codePointAt(0) || 0);
19336
19617
  }
19337
19618
 
19338
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19619
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19339
19620
 
19340
19621
  /*
19341
19622
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19521,7 +19802,7 @@ const iFrameRenewalPolicies = [
19521
19802
  CacheLookupPolicy.RefreshTokenAndNetwork,
19522
19803
  ];
19523
19804
 
19524
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19805
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19525
19806
  /*
19526
19807
  * Copyright (c) Microsoft Corporation. All rights reserved.
19527
19808
  * Licensed under the MIT License.
@@ -19566,7 +19847,7 @@ function base64EncArr(aBytes) {
19566
19847
  return btoa(binString);
19567
19848
  }
19568
19849
 
19569
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19850
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19570
19851
 
19571
19852
  /*
19572
19853
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19913,7 +20194,7 @@ async function computeJwkThumbprint(publicJwk, correlationId) {
19913
20194
  return hashString(thumbprintJson);
19914
20195
  }
19915
20196
 
19916
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20197
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19917
20198
 
19918
20199
  /*
19919
20200
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19933,7 +20214,7 @@ function createBrowserConfigurationAuthError(errorCode, correlationId) {
19933
20214
  return new BrowserConfigurationAuthError(errorCode, correlationId, getDefaultErrorMessage(errorCode));
19934
20215
  }
19935
20216
 
19936
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20217
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19937
20218
  /*
19938
20219
  * Copyright (c) Microsoft Corporation. All rights reserved.
19939
20220
  * Licensed under the MIT License.
@@ -19941,7 +20222,7 @@ function createBrowserConfigurationAuthError(errorCode, correlationId) {
19941
20222
  const storageNotSupported = "storage_not_supported";
19942
20223
  const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
19943
20224
 
19944
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20225
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19945
20226
 
19946
20227
  /*
19947
20228
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20282,7 +20563,7 @@ function createGuid() {
20282
20563
  return createNewGuid();
20283
20564
  }
20284
20565
 
20285
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20566
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20286
20567
 
20287
20568
  /*
20288
20569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20485,7 +20766,7 @@ class DatabaseStorage {
20485
20766
  }
20486
20767
  }
20487
20768
 
20488
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20769
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20489
20770
  /*
20490
20771
  * Copyright (c) Microsoft Corporation. All rights reserved.
20491
20772
  * Licensed under the MIT License.
@@ -20531,7 +20812,7 @@ class MemoryStorage {
20531
20812
  }
20532
20813
  }
20533
20814
 
20534
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20815
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20535
20816
 
20536
20817
  /*
20537
20818
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20669,7 +20950,7 @@ class AsyncMemoryStorage {
20669
20950
  }
20670
20951
  }
20671
20952
 
20672
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20953
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20673
20954
 
20674
20955
  /*
20675
20956
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20817,7 +21098,7 @@ TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
20817
21098
  "verify",
20818
21099
  ];
20819
21100
 
20820
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21101
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20821
21102
 
20822
21103
  /*
20823
21104
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20953,7 +21234,7 @@ class CryptoOps {
20953
21234
  }
20954
21235
  }
20955
21236
 
20956
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21237
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20957
21238
  /*
20958
21239
  * Copyright (c) Microsoft Corporation. All rights reserved.
20959
21240
  * Licensed under the MIT License.
@@ -21000,7 +21281,7 @@ const LocalStorageUpdated = "localStorageUpdated";
21000
21281
  */
21001
21282
  const SsoCapable = "ssoCapable";
21002
21283
 
21003
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21284
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21004
21285
  /*
21005
21286
  * Copyright (c) Microsoft Corporation. All rights reserved.
21006
21287
  * Licensed under the MIT License.
@@ -21029,7 +21310,7 @@ function getTokenKeysCacheKey(clientId, schema = CREDENTIAL_SCHEMA_VERSION) {
21029
21310
  return `${PREFIX}.${schema}.${TOKEN_KEYS}.${clientId}`;
21030
21311
  }
21031
21312
 
21032
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21313
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21033
21314
 
21034
21315
  /*
21035
21316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21120,7 +21401,7 @@ function getCookieExpirationTime(cookieLifeDays) {
21120
21401
  return expr.toUTCString();
21121
21402
  }
21122
21403
 
21123
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21404
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21124
21405
 
21125
21406
  /*
21126
21407
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21162,7 +21443,7 @@ function getTokenKeys(clientId, storage, schemaVersion) {
21162
21443
  };
21163
21444
  }
21164
21445
 
21165
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21446
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21166
21447
  /*
21167
21448
  * Copyright (c) Microsoft Corporation. All rights reserved.
21168
21449
  * Licensed under the MIT License.
@@ -21173,7 +21454,7 @@ function isEncrypted(data) {
21173
21454
  data.hasOwnProperty("data"));
21174
21455
  }
21175
21456
 
21176
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21457
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21177
21458
 
21178
21459
  /*
21179
21460
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21475,7 +21756,7 @@ class LocalStorage {
21475
21756
  }
21476
21757
  }
21477
21758
 
21478
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21759
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21479
21760
 
21480
21761
  /*
21481
21762
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21517,7 +21798,7 @@ class SessionStorage {
21517
21798
  }
21518
21799
  }
21519
21800
 
21520
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21801
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21521
21802
  /*
21522
21803
  * Copyright (c) Microsoft Corporation. All rights reserved.
21523
21804
  * Licensed under the MIT License.
@@ -21545,12 +21826,12 @@ const EventType = {
21545
21826
  BROKER_CONNECTION_ESTABLISHED: "msal:brokerConnectionEstablished",
21546
21827
  };
21547
21828
 
21548
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21829
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21549
21830
  /* eslint-disable header/header */
21550
21831
  const name = "@azure/msal-browser";
21551
- const version$1 = "5.20.0";
21832
+ const version$1 = "5.23.0";
21552
21833
 
21553
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21834
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21554
21835
  /*
21555
21836
  * Copyright (c) Microsoft Corporation. All rights reserved.
21556
21837
  * Licensed under the MIT License.
@@ -21567,7 +21848,7 @@ function removeElementFromArray(array, element) {
21567
21848
  }
21568
21849
  }
21569
21850
 
21570
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21851
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21571
21852
 
21572
21853
  /*
21573
21854
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23013,7 +23294,7 @@ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, even
23013
23294
  return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager);
23014
23295
  };
23015
23296
 
23016
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23297
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23017
23298
  /*
23018
23299
  * Copyright (c) Microsoft Corporation. All rights reserved.
23019
23300
  * Licensed under the MIT License.
@@ -23060,7 +23341,7 @@ function getActiveAccount(browserStorage, correlationId) {
23060
23341
  return browserStorage.getActiveAccount(correlationId);
23061
23342
  }
23062
23343
 
23063
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23344
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23064
23345
 
23065
23346
  /*
23066
23347
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23164,7 +23445,7 @@ class EventHandler {
23164
23445
  }
23165
23446
  }
23166
23447
 
23167
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23448
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23168
23449
 
23169
23450
  /*
23170
23451
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23307,7 +23588,7 @@ async function clearCacheOnLogout(browserStorage, browserCrypto, logger, correla
23307
23588
  }
23308
23589
  }
23309
23590
 
23310
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23591
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23311
23592
 
23312
23593
  /*
23313
23594
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23445,7 +23726,7 @@ function validateRequestMethod(interactionRequest, protocolMode) {
23445
23726
  return httpMethod;
23446
23727
  }
23447
23728
 
23448
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23729
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23449
23730
 
23450
23731
  /*
23451
23732
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23652,7 +23933,7 @@ async function initializeAuthorizationRequest(request, interactionType, config,
23652
23933
  return validatedRequest;
23653
23934
  }
23654
23935
 
23655
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23936
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23656
23937
  /*
23657
23938
  * Copyright (c) Microsoft Corporation. All rights reserved.
23658
23939
  * Licensed under the MIT License.
@@ -23670,7 +23951,7 @@ async function initializeAuthorizationRequest(request, interactionType, config,
23670
23951
  */
23671
23952
  const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
23672
23953
 
23673
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23954
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23674
23955
 
23675
23956
  /*
23676
23957
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23776,7 +24057,7 @@ async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow
23776
24057
  });
23777
24058
  }
23778
24059
 
23779
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24060
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23780
24061
 
23781
24062
  /*
23782
24063
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23800,7 +24081,7 @@ function extractBrowserRequestState(browserCrypto, state, correlationId) {
23800
24081
  }
23801
24082
  }
23802
24083
 
23803
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24084
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23804
24085
 
23805
24086
  /*
23806
24087
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23839,7 +24120,7 @@ function validateInteractionType(response, browserCrypto, interactionType, corre
23839
24120
  }
23840
24121
  }
23841
24122
 
23842
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24123
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23843
24124
 
23844
24125
  /*
23845
24126
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23928,7 +24209,52 @@ class InteractionHandler {
23928
24209
  }
23929
24210
  }
23930
24211
 
23931
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24212
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24213
+
24214
+ /*
24215
+ * Copyright (c) Microsoft Corporation. All rights reserved.
24216
+ * Licensed under the MIT License.
24217
+ */
24218
+ /**
24219
+ * Token types supported by the platform broker request contract.
24220
+ */
24221
+ const PlatformAuthTokenType = {
24222
+ DPOP_WITH_PROOF: "dpop+proof",
24223
+ };
24224
+ const PROOF_OF_POSSESSION_TOKEN_TYPES = [
24225
+ AuthenticationScheme.POP,
24226
+ AuthenticationScheme.DPOP,
24227
+ PlatformAuthTokenType.DPOP_WITH_PROOF,
24228
+ ];
24229
+ /**
24230
+ * Returns whether a platform broker token type requires proof request metadata.
24231
+ */
24232
+ function isProofOfPossessionTokenType(tokenType) {
24233
+ return (tokenType !== undefined &&
24234
+ PROOF_OF_POSSESSION_TOKEN_TYPES.includes(tokenType));
24235
+ }
24236
+ /**
24237
+ * Adds canonical proof request fields to the broker no-cache property bag.
24238
+ */
24239
+ function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
24240
+ if (!isProofOfPossessionRequest) {
24241
+ return extraParametersNoCache;
24242
+ }
24243
+ return {
24244
+ ...extraParametersNoCache,
24245
+ ...(resourceRequestMethod && {
24246
+ pop_method: resourceRequestMethod,
24247
+ }),
24248
+ ...(resourceRequestUri && {
24249
+ pop_url: resourceRequestUri,
24250
+ }),
24251
+ ...(dpopNonce && {
24252
+ pop_nonce: dpopNonce,
24253
+ }),
24254
+ };
24255
+ }
24256
+
24257
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23932
24258
  /*
23933
24259
  * Copyright (c) Microsoft Corporation. All rights reserved.
23934
24260
  * Licensed under the MIT License.
@@ -23937,7 +24263,7 @@ const contentError = "ContentError";
23937
24263
  const pageException = "PageException";
23938
24264
  const userSwitch = "user_switch";
23939
24265
 
23940
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24266
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23941
24267
  /*
23942
24268
  * Copyright (c) Microsoft Corporation. All rights reserved.
23943
24269
  * Licensed under the MIT License.
@@ -23950,7 +24276,7 @@ const DISABLED = "DISABLED";
23950
24276
  const ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE";
23951
24277
  const UI_NOT_ALLOWED = "UI_NOT_ALLOWED";
23952
24278
 
23953
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24279
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23954
24280
 
23955
24281
  /*
23956
24282
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24022,7 +24348,7 @@ function createNativeAuthError(code, correlationId, description, ext) {
24022
24348
  return error;
24023
24349
  }
24024
24350
 
24025
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24351
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24026
24352
 
24027
24353
  /*
24028
24354
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24071,7 +24397,7 @@ class SilentCacheClient extends StandardInteractionClient {
24071
24397
  }
24072
24398
  }
24073
24399
 
24074
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24400
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24075
24401
 
24076
24402
  /*
24077
24403
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24214,6 +24540,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24214
24540
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
24215
24541
  account: cachedAccount,
24216
24542
  forceRefresh: false,
24543
+ resource: request.extraParameters?.resource,
24217
24544
  };
24218
24545
  // Preserve FMI partition semantics for silent cache filtering.
24219
24546
  if (request.attributeTokens) {
@@ -24551,6 +24878,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24551
24878
  }
24552
24879
  : undefined;
24553
24880
  const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
24881
+ if (request.extraParameters?.resource) {
24882
+ cachedAccessToken.resource = request.extraParameters.resource;
24883
+ }
24554
24884
  // save idtoken credential in configured browser storage
24555
24885
  if (!!cachedIdToken && storeInCache?.idToken !== false) {
24556
24886
  await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
@@ -24635,7 +24965,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24635
24965
  * scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
24636
24966
  * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
24637
24967
  */
24638
- const { scopes, claims } = request;
24968
+ const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
24639
24969
  const scopeSet = new ScopeSet(scopes || [], this.correlationId);
24640
24970
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
24641
24971
  const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
@@ -24668,6 +24998,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24668
24998
  resourceRequestUri: request.resourceRequestUri,
24669
24999
  shrClaims: request.shrClaims,
24670
25000
  shrNonce: request.shrNonce,
25001
+ extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
24671
25002
  };
24672
25003
  if (hasAttributeTokens) {
24673
25004
  validatedRequest.attributeTokens =
@@ -24791,7 +25122,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24791
25122
  }
24792
25123
  }
24793
25124
 
24794
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25125
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24795
25126
 
24796
25127
  /*
24797
25128
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25104,7 +25435,7 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
25104
25435
  return (await invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, logger, performanceClient, request.correlationId)(decryptedData, authority, nowSeconds(), request, apiId, additionalData, undefined, undefined, undefined, undefined));
25105
25436
  }
25106
25437
 
25107
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25438
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25108
25439
 
25109
25440
  /*
25110
25441
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25159,7 +25490,7 @@ async function generateCodeChallengeFromVerifier(pkceCodeVerifier, performanceCl
25159
25490
  }
25160
25491
  }
25161
25492
 
25162
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25493
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25163
25494
 
25164
25495
  /*
25165
25496
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25202,7 +25533,7 @@ class NavigationClient {
25202
25533
  }
25203
25534
  }
25204
25535
 
25205
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25536
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25206
25537
 
25207
25538
  /*
25208
25539
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25349,7 +25680,7 @@ function getHeaderDict(headers) {
25349
25680
  }
25350
25681
  }
25351
25682
 
25352
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25683
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25353
25684
 
25354
25685
  /*
25355
25686
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25480,7 +25811,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
25480
25811
  return overlayedConfig;
25481
25812
  }
25482
25813
 
25483
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25814
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25484
25815
 
25485
25816
  /*
25486
25817
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25507,9 +25838,12 @@ class PlatformAuthExtensionHandler {
25507
25838
  async sendMessage(request) {
25508
25839
  this.logger.trace(`0on4p2 ${this.platformAuthType}`, request.correlationId);
25509
25840
  // fall back to native calls
25841
+ const extensionRequest = { ...request };
25842
+ delete extensionRequest.resourceRequestMethod;
25843
+ delete extensionRequest.resourceRequestUri;
25510
25844
  const messageBody = {
25511
25845
  method: NativeExtensionMethod.GetToken,
25512
- request: request,
25846
+ request: extensionRequest,
25513
25847
  };
25514
25848
  const req = {
25515
25849
  channel: PlatformAuthConstants.CHANNEL_ID,
@@ -25741,7 +26075,7 @@ class PlatformAuthExtensionHandler {
25741
26075
  }
25742
26076
  }
25743
26077
 
25744
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26078
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25745
26079
 
25746
26080
  /*
25747
26081
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25802,7 +26136,9 @@ class PlatformAuthDOMHandler {
25802
26136
  }
25803
26137
  initializePlatformDOMRequest(request) {
25804
26138
  this.logger.trace(`15d6yv ${this.platformAuthType}`, request.correlationId);
25805
- const { accountId, clientId, authority, scope, redirectUri, correlationId, state, extraParameters, ...remainingProperties } = request;
26139
+ const { accountId, clientId, authority, scope, redirectUri, correlationId, state, preferBinding, enclave, reqCnf, extraParametersNoCache, extraParameters, ...remainingProperties } = request;
26140
+ delete remainingProperties.resourceRequestMethod;
26141
+ delete remainingProperties.resourceRequestUri;
25806
26142
  const validExtraParameters = this.getDOMExtraParams(remainingProperties, correlationId);
25807
26143
  const platformDOMRequest = {
25808
26144
  accountId: accountId,
@@ -25818,6 +26154,10 @@ class PlatformAuthDOMHandler {
25818
26154
  redirectUri: redirectUri,
25819
26155
  scope: scope,
25820
26156
  state: state,
26157
+ preferBinding: preferBinding,
26158
+ enclave: enclave,
26159
+ requestConfirmation: reqCnf,
26160
+ extraParametersNoCache,
25821
26161
  };
25822
26162
  return platformDOMRequest;
25823
26163
  }
@@ -25851,6 +26191,8 @@ class PlatformAuthDOMHandler {
25851
26191
  }
25852
26192
  convertToPlatformBrokerResponse(response, correlationId) {
25853
26193
  this.logger.trace(`14913t ${this.platformAuthType}`, correlationId);
26194
+ const responseProperties = response.properties || {};
26195
+ const bindingAttested = this.parseDOMBoolean(responseProperties.binding_attested, "binding_attested", correlationId);
25854
26196
  const nativeResponse = {
25855
26197
  access_token: response.accessToken,
25856
26198
  id_token: response.idToken,
@@ -25859,12 +26201,24 @@ class PlatformAuthDOMHandler {
25859
26201
  expires_in: response.expiresIn,
25860
26202
  scope: response.scopes,
25861
26203
  state: response.state || "",
25862
- properties: response.properties || {},
26204
+ properties: responseProperties,
25863
26205
  extendedLifetimeToken: response.extendedLifetimeToken ?? false,
25864
26206
  shr: response.proofOfPossessionPayload,
26207
+ token_type: responseProperties.token_type,
26208
+ DPoP: responseProperties.dpop_proof,
26209
+ binding_attested: bindingAttested,
25865
26210
  };
25866
26211
  return nativeResponse;
25867
26212
  }
26213
+ parseDOMBoolean(value, propertyName, correlationId) {
26214
+ if (value === undefined) {
26215
+ return undefined;
26216
+ }
26217
+ if (value === "true" || value === "false") {
26218
+ return value === "true";
26219
+ }
26220
+ throw createAuthError(unexpectedError, correlationId, `Platform broker returned invalid ${propertyName} value.`);
26221
+ }
25868
26222
  getDOMExtraParams(extraParameters, correlationId) {
25869
26223
  try {
25870
26224
  const stringifiedProperties = {};
@@ -25889,7 +26243,7 @@ class PlatformAuthDOMHandler {
25889
26243
  }
25890
26244
  }
25891
26245
 
25892
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26246
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25893
26247
  async function getPlatformAuthProvider(logger, performanceClient, correlationId, nativeBrokerHandshakeTimeout, enablePlatformBrokerDOMSupport) {
25894
26248
  logger.trace("134j0v", correlationId);
25895
26249
  logger.trace(`04c81g ${enablePlatformBrokerDOMSupport}`, correlationId);
@@ -25954,7 +26308,7 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
25954
26308
  return true;
25955
26309
  }
25956
26310
 
25957
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26311
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25958
26312
 
25959
26313
  /*
25960
26314
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26463,7 +26817,7 @@ class PopupClient extends StandardInteractionClient {
26463
26817
  }
26464
26818
  }
26465
26819
 
26466
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26820
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26467
26821
 
26468
26822
  /*
26469
26823
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26493,12 +26847,17 @@ class RedirectClient extends StandardInteractionClient {
26493
26847
  async acquireToken(request) {
26494
26848
  const validRequest = await invokeAsync(initializeAuthorizationRequest, StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Redirect, this.config, this.browserCrypto, this.browserStorage, this.logger, this.performanceClient, this.correlationId);
26495
26849
  validRequest.platformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, request.authenticationScheme);
26850
+ let rejectBackButtonCancellation;
26851
+ const backButtonCancellation = new Promise((_, reject) => {
26852
+ rejectBackButtonCancellation = reject;
26853
+ });
26496
26854
  const handleBackButton = (event) => {
26497
26855
  // Clear temporary cache if the back button is clicked during the redirect flow.
26498
26856
  if (event.persisted) {
26499
26857
  this.logger.verbose("0udvtt", this.correlationId);
26500
26858
  this.browserStorage.resetRequestCache(this.correlationId);
26501
26859
  this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, this.correlationId, InteractionType.Redirect);
26860
+ rejectBackButtonCancellation(createBrowserAuthError(userCancelled, this.correlationId));
26502
26861
  }
26503
26862
  };
26504
26863
  const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
@@ -26508,12 +26867,10 @@ class RedirectClient extends StandardInteractionClient {
26508
26867
  // Clear temporary cache if the back button is clicked during the redirect flow.
26509
26868
  window.addEventListener("pageshow", handleBackButton);
26510
26869
  try {
26511
- if (this.config.system.protocolMode === ProtocolMode.EAR) {
26512
- await this.executeEarFlow(validRequest);
26513
- }
26514
- else {
26515
- await this.executeCodeFlow(validRequest);
26516
- }
26870
+ const redirectOperation = this.config.system.protocolMode === ProtocolMode.EAR
26871
+ ? this.executeEarFlow(validRequest)
26872
+ : this.executeCodeFlow(validRequest);
26873
+ await Promise.race([redirectOperation, backButtonCancellation]);
26517
26874
  }
26518
26875
  catch (e) {
26519
26876
  if (e instanceof AuthError) {
@@ -26910,7 +27267,7 @@ class RedirectClient extends StandardInteractionClient {
26910
27267
  }
26911
27268
  }
26912
27269
 
26913
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27270
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26914
27271
 
26915
27272
  /*
26916
27273
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26976,7 +27333,7 @@ function removeHiddenIframe(iframe) {
26976
27333
  }
26977
27334
  }
26978
27335
 
26979
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27336
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26980
27337
 
26981
27338
  /*
26982
27339
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27214,7 +27571,7 @@ class SilentIframeClient extends StandardInteractionClient {
27214
27571
  }
27215
27572
  }
27216
27573
 
27217
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27574
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27218
27575
 
27219
27576
  /*
27220
27577
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27281,7 +27638,7 @@ class SilentRefreshClient extends StandardInteractionClient {
27281
27638
  }
27282
27639
  }
27283
27640
 
27284
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27641
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27285
27642
 
27286
27643
  /*
27287
27644
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27294,7 +27651,7 @@ class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
27294
27651
  }
27295
27652
  }
27296
27653
 
27297
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27654
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27298
27655
 
27299
27656
  /*
27300
27657
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27367,7 +27724,7 @@ class SilentAuthCodeClient extends StandardInteractionClient {
27367
27724
  }
27368
27725
  }
27369
27726
 
27370
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27727
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27371
27728
  function collectInstanceStats(currentClientId, performanceEvent, logger, correlationId) {
27372
27729
  const frameInstances =
27373
27730
  // @ts-ignore
@@ -27383,7 +27740,7 @@ function collectInstanceStats(currentClientId, performanceEvent, logger, correla
27383
27740
  });
27384
27741
  }
27385
27742
 
27386
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27743
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27387
27744
 
27388
27745
  /*
27389
27746
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -28883,7 +29240,7 @@ function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheL
28883
29240
  return isSilentlyResolvable && tryIframeRenewal;
28884
29241
  }
28885
29242
 
28886
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29243
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
28887
29244
 
28888
29245
  /*
28889
29246
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -28988,7 +29345,7 @@ class BaseOperatingContext {
28988
29345
  }
28989
29346
  }
28990
29347
 
28991
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29348
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
28992
29349
 
28993
29350
  /*
28994
29351
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -29035,7 +29392,7 @@ StandardOperatingContext.MODULE_NAME = "";
29035
29392
  */
29036
29393
  StandardOperatingContext.ID = "StandardOperatingContext";
29037
29394
 
29038
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29395
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
29039
29396
 
29040
29397
  /*
29041
29398
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -31658,4 +32015,4 @@ const configureMsal = (configure) => ({
31658
32015
  });
31659
32016
 
31660
32017
  export { TelemetryEventSchema as $, reduce as A, lastValueFrom as B, filter as C, BaseModuleProvider as D, EMPTY_SUBSCRIPTION as E, catchError as F, of as G, object as H, _instanceof as I, _enum as J, string as K, boolean as L, ModuleEventLevel as M, record as N, Observable as O, union as P, __rest as Q, __assign as R, Subscription as S, switchMap as T, observeOn as U, deepmerge as V, BaseConfigBuilder as W, TelemetryExceptionSchema as X, TelemetryItemNames as Y, TelemetryType as Z, __extends as _, arrRemove as a, TelemetryMetricSchema as a0, TelemetryCustomEventSchema as a1, array as a2, TelemetryLevel as a3, enableMSAL as a4, MsalConfigurator as a5, module$1 as a6, __values as b, createErrorClass as c, __spreadArray as d, errorContext as e, __read as f, SafeSubscriber as g, EmptyError as h, isFunction as i, executeSchedule as j, innerFrom as k, createOperatorSubscriber as l, map as m, mergeMap as n, operate as o, identity as p, isArrayLike as q, isScheduler as r, popScheduler as s, popNumber as t, EMPTY as u, from as v, mergeInternals as w, scanInternals as x, noop as y, popResultSelector as z };
31661
- //# sourceMappingURL=module-DMrP0Kg2.js.map
32018
+ //# sourceMappingURL=module-DzjJ4gjy.js.map