@pactflow/openapi-pact-comparator 1.13.1 → 1.15.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.
package/dist/index.cjs CHANGED
@@ -3101,7 +3101,7 @@ function setCacheAdd(value) {
3101
3101
  * @name has
3102
3102
  * @memberOf SetCache
3103
3103
  * @param {*} value The value to search for.
3104
- * @returns {number} Returns `true` if `value` is found, else `false`.
3104
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
3105
3105
  */
3106
3106
  function setCacheHas(value) {
3107
3107
  return this.__data__.has(value);
@@ -3599,7 +3599,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
3599
3599
  function baseUnset(object, path) {
3600
3600
  path = castPath(path, object);
3601
3601
 
3602
- // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
3602
+ // Prevent prototype pollution:
3603
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
3604
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
3603
3605
  var index = -1,
3604
3606
  length = path.length;
3605
3607
 
@@ -3607,32 +3609,17 @@ function baseUnset(object, path) {
3607
3609
  return true;
3608
3610
  }
3609
3611
 
3610
- var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
3611
-
3612
3612
  while (++index < length) {
3613
- var key = path[index];
3614
-
3615
- // skip non-string keys (e.g., Symbols, numbers)
3616
- if (typeof key !== 'string') {
3617
- continue;
3618
- }
3613
+ var key = toKey(path[index]);
3619
3614
 
3620
3615
  // Always block "__proto__" anywhere in the path if it's not expected
3621
3616
  if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
3622
3617
  return false;
3623
3618
  }
3624
3619
 
3625
- // Block "constructor.prototype" chains
3626
- if (key === 'constructor' &&
3627
- (index + 1) < length &&
3628
- typeof path[index + 1] === 'string' &&
3629
- path[index + 1] === 'prototype') {
3630
-
3631
- // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
3632
- if (isRootPrimitive && index === 0) {
3633
- continue;
3634
- }
3635
-
3620
+ // Block constructor/prototype as non-terminal traversal keys to prevent
3621
+ // escaping the object graph into built-in constructors and prototypes.
3622
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
3636
3623
  return false;
3637
3624
  }
3638
3625
  }
@@ -3969,6 +3956,25 @@ const transformResponseSchema = (schema, noTransformNonNullableResponseSchema) =
3969
3956
  return schema;
3970
3957
  };
3971
3958
 
3959
+ function _inlinePropertyRefs(s, root) {
3960
+ if (!s.properties)
3961
+ return s;
3962
+ const properties = {};
3963
+ let changed = false;
3964
+ for (const key in s.properties) {
3965
+ const prop = s.properties[key];
3966
+ if (prop.$ref && Object.keys(prop).length === 1) {
3967
+ const deref = get$1(root, splitPath(prop.$ref));
3968
+ if (deref) {
3969
+ properties[key] = _flat(deref, root);
3970
+ changed = true;
3971
+ continue;
3972
+ }
3973
+ }
3974
+ properties[key] = prop;
3975
+ }
3976
+ return changed ? { ...s, properties } : s;
3977
+ }
3972
3978
  function _flat(s, root) {
3973
3979
  if (s.allOf) {
3974
3980
  const { allOf, ...others } = s;
@@ -3981,7 +3987,10 @@ function _flat(s, root) {
3981
3987
  ...get$1(root, splitPath($ref)),
3982
3988
  };
3983
3989
  }
3984
- return _flat(dereferenced || ss, root);
3990
+ // Inline pure $ref property schemas before merging so that lodash merge
3991
+ // doesn't produce broken { $ref, properties } hybrids when two allOf
3992
+ // branches define the same property key differently.
3993
+ return _inlinePropertyRefs(_flat(dereferenced || ss, root), root);
3985
3994
  }));
3986
3995
  }
3987
3996
  if (s.properties) {
@@ -4784,9 +4793,8 @@ function requireSideChannelList () {
4784
4793
  }
4785
4794
  },
4786
4795
  'delete': function (key) {
4787
- var root = $o && $o.next;
4788
4796
  var deletedNode = listDelete($o, key);
4789
- if (deletedNode && root && root === deletedNode) {
4797
+ if (deletedNode && $o && !$o.next) {
4790
4798
  $o = void undefined;
4791
4799
  }
4792
4800
  return !!deletedNode;
@@ -4808,7 +4816,6 @@ function requireSideChannelList () {
4808
4816
  listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
4809
4817
  }
4810
4818
  };
4811
- // @ts-expect-error TODO: figure out why this is erroring
4812
4819
  return channel;
4813
4820
  };
4814
4821
  return sideChannelList;
@@ -6883,10 +6890,10 @@ function requireParse$1 () {
6883
6890
  var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
6884
6891
  var parts = cleanStr.split(
6885
6892
  options.delimiter,
6886
- options.throwOnLimitExceeded ? limit + 1 : limit
6893
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
6887
6894
  );
6888
6895
 
6889
- if (options.throwOnLimitExceeded && parts.length > limit) {
6896
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
6890
6897
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
6891
6898
  }
6892
6899
 
@@ -7868,7 +7875,7 @@ function* compareReqBody(ajv, route, interaction, index, config) {
7868
7875
  pathName: path,
7869
7876
  value: get$1(operation, "requestBody.content"),
7870
7877
  },
7871
- type: "error",
7878
+ type: "warning",
7872
7879
  };
7873
7880
  }
7874
7881
  }
@@ -12366,18 +12373,18 @@ var hasRequiredCode$1;
12366
12373
  function requireCode$1 () {
12367
12374
  if (hasRequiredCode$1) return code$1;
12368
12375
  hasRequiredCode$1 = 1;
12369
- (function (exports$1) {
12370
- Object.defineProperty(exports$1, "__esModule", { value: true });
12371
- exports$1.regexpCode = exports$1.getEsmExportName = exports$1.getProperty = exports$1.safeStringify = exports$1.stringify = exports$1.strConcat = exports$1.addCodeArg = exports$1.str = exports$1._ = exports$1.nil = exports$1._Code = exports$1.Name = exports$1.IDENTIFIER = exports$1._CodeOrName = void 0;
12376
+ (function (exports) {
12377
+ Object.defineProperty(exports, "__esModule", { value: true });
12378
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
12372
12379
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
12373
12380
  class _CodeOrName {
12374
12381
  }
12375
- exports$1._CodeOrName = _CodeOrName;
12376
- exports$1.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
12382
+ exports._CodeOrName = _CodeOrName;
12383
+ exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
12377
12384
  class Name extends _CodeOrName {
12378
12385
  constructor(s) {
12379
12386
  super();
12380
- if (!exports$1.IDENTIFIER.test(s))
12387
+ if (!exports.IDENTIFIER.test(s))
12381
12388
  throw new Error("CodeGen: name must be a valid identifier");
12382
12389
  this.str = s;
12383
12390
  }
@@ -12391,7 +12398,7 @@ function requireCode$1 () {
12391
12398
  return { [this.str]: 1 };
12392
12399
  }
12393
12400
  }
12394
- exports$1.Name = Name;
12401
+ exports.Name = Name;
12395
12402
  class _Code extends _CodeOrName {
12396
12403
  constructor(code) {
12397
12404
  super();
@@ -12419,8 +12426,8 @@ function requireCode$1 () {
12419
12426
  }, {})));
12420
12427
  }
12421
12428
  }
12422
- exports$1._Code = _Code;
12423
- exports$1.nil = new _Code("");
12429
+ exports._Code = _Code;
12430
+ exports.nil = new _Code("");
12424
12431
  function _(strs, ...args) {
12425
12432
  const code = [strs[0]];
12426
12433
  let i = 0;
@@ -12430,7 +12437,7 @@ function requireCode$1 () {
12430
12437
  }
12431
12438
  return new _Code(code);
12432
12439
  }
12433
- exports$1._ = _;
12440
+ exports._ = _;
12434
12441
  const plus = new _Code("+");
12435
12442
  function str(strs, ...args) {
12436
12443
  const expr = [safeStringify(strs[0])];
@@ -12443,7 +12450,7 @@ function requireCode$1 () {
12443
12450
  optimize(expr);
12444
12451
  return new _Code(expr);
12445
12452
  }
12446
- exports$1.str = str;
12453
+ exports.str = str;
12447
12454
  function addCodeArg(code, arg) {
12448
12455
  if (arg instanceof _Code)
12449
12456
  code.push(...arg._items);
@@ -12452,7 +12459,7 @@ function requireCode$1 () {
12452
12459
  else
12453
12460
  code.push(interpolate(arg));
12454
12461
  }
12455
- exports$1.addCodeArg = addCodeArg;
12462
+ exports.addCodeArg = addCodeArg;
12456
12463
  function optimize(expr) {
12457
12464
  let i = 1;
12458
12465
  while (i < expr.length - 1) {
@@ -12488,7 +12495,7 @@ function requireCode$1 () {
12488
12495
  function strConcat(c1, c2) {
12489
12496
  return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
12490
12497
  }
12491
- exports$1.strConcat = strConcat;
12498
+ exports.strConcat = strConcat;
12492
12499
  // TODO do not allow arrays here
12493
12500
  function interpolate(x) {
12494
12501
  return typeof x == "number" || typeof x == "boolean" || x === null
@@ -12498,29 +12505,29 @@ function requireCode$1 () {
12498
12505
  function stringify(x) {
12499
12506
  return new _Code(safeStringify(x));
12500
12507
  }
12501
- exports$1.stringify = stringify;
12508
+ exports.stringify = stringify;
12502
12509
  function safeStringify(x) {
12503
12510
  return JSON.stringify(x)
12504
12511
  .replace(/\u2028/g, "\\u2028")
12505
12512
  .replace(/\u2029/g, "\\u2029");
12506
12513
  }
12507
- exports$1.safeStringify = safeStringify;
12514
+ exports.safeStringify = safeStringify;
12508
12515
  function getProperty(key) {
12509
- return typeof key == "string" && exports$1.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
12516
+ return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
12510
12517
  }
12511
- exports$1.getProperty = getProperty;
12518
+ exports.getProperty = getProperty;
12512
12519
  //Does best effort to format the name properly
12513
12520
  function getEsmExportName(key) {
12514
- if (typeof key == "string" && exports$1.IDENTIFIER.test(key)) {
12521
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
12515
12522
  return new _Code(`${key}`);
12516
12523
  }
12517
12524
  throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
12518
12525
  }
12519
- exports$1.getEsmExportName = getEsmExportName;
12526
+ exports.getEsmExportName = getEsmExportName;
12520
12527
  function regexpCode(rx) {
12521
12528
  return new _Code(rx.toString());
12522
12529
  }
12523
- exports$1.regexpCode = regexpCode;
12530
+ exports.regexpCode = regexpCode;
12524
12531
 
12525
12532
  } (code$1));
12526
12533
  return code$1;
@@ -12533,9 +12540,9 @@ var hasRequiredScope;
12533
12540
  function requireScope () {
12534
12541
  if (hasRequiredScope) return scope;
12535
12542
  hasRequiredScope = 1;
12536
- (function (exports$1) {
12537
- Object.defineProperty(exports$1, "__esModule", { value: true });
12538
- exports$1.ValueScope = exports$1.ValueScopeName = exports$1.Scope = exports$1.varKinds = exports$1.UsedValueState = void 0;
12543
+ (function (exports) {
12544
+ Object.defineProperty(exports, "__esModule", { value: true });
12545
+ exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
12539
12546
  const code_1 = /*@__PURE__*/ requireCode$1();
12540
12547
  class ValueError extends Error {
12541
12548
  constructor(name) {
@@ -12547,8 +12554,8 @@ function requireScope () {
12547
12554
  (function (UsedValueState) {
12548
12555
  UsedValueState[UsedValueState["Started"] = 0] = "Started";
12549
12556
  UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
12550
- })(UsedValueState || (exports$1.UsedValueState = UsedValueState = {}));
12551
- exports$1.varKinds = {
12557
+ })(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
12558
+ exports.varKinds = {
12552
12559
  const: new code_1.Name("const"),
12553
12560
  let: new code_1.Name("let"),
12554
12561
  var: new code_1.Name("var"),
@@ -12577,7 +12584,7 @@ function requireScope () {
12577
12584
  return (this._names[prefix] = { prefix, index: 0 });
12578
12585
  }
12579
12586
  }
12580
- exports$1.Scope = Scope;
12587
+ exports.Scope = Scope;
12581
12588
  class ValueScopeName extends code_1.Name {
12582
12589
  constructor(prefix, nameStr) {
12583
12590
  super(nameStr);
@@ -12588,7 +12595,7 @@ function requireScope () {
12588
12595
  this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
12589
12596
  }
12590
12597
  }
12591
- exports$1.ValueScopeName = ValueScopeName;
12598
+ exports.ValueScopeName = ValueScopeName;
12592
12599
  const line = (0, code_1._) `\n`;
12593
12600
  class ValueScope extends Scope {
12594
12601
  constructor(opts) {
@@ -12659,7 +12666,7 @@ function requireScope () {
12659
12666
  nameSet.set(name, UsedValueState.Started);
12660
12667
  let c = valueCode(name);
12661
12668
  if (c) {
12662
- const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
12669
+ const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
12663
12670
  code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
12664
12671
  }
12665
12672
  else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
@@ -12674,7 +12681,7 @@ function requireScope () {
12674
12681
  return code;
12675
12682
  }
12676
12683
  }
12677
- exports$1.ValueScope = ValueScope;
12684
+ exports.ValueScope = ValueScope;
12678
12685
 
12679
12686
  } (scope));
12680
12687
  return scope;
@@ -12685,26 +12692,26 @@ var hasRequiredCodegen;
12685
12692
  function requireCodegen () {
12686
12693
  if (hasRequiredCodegen) return codegen;
12687
12694
  hasRequiredCodegen = 1;
12688
- (function (exports$1) {
12689
- Object.defineProperty(exports$1, "__esModule", { value: true });
12690
- exports$1.or = exports$1.and = exports$1.not = exports$1.CodeGen = exports$1.operators = exports$1.varKinds = exports$1.ValueScopeName = exports$1.ValueScope = exports$1.Scope = exports$1.Name = exports$1.regexpCode = exports$1.stringify = exports$1.getProperty = exports$1.nil = exports$1.strConcat = exports$1.str = exports$1._ = void 0;
12695
+ (function (exports) {
12696
+ Object.defineProperty(exports, "__esModule", { value: true });
12697
+ exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
12691
12698
  const code_1 = /*@__PURE__*/ requireCode$1();
12692
12699
  const scope_1 = /*@__PURE__*/ requireScope();
12693
12700
  var code_2 = /*@__PURE__*/ requireCode$1();
12694
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return code_2._; } });
12695
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return code_2.str; } });
12696
- Object.defineProperty(exports$1, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
12697
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return code_2.nil; } });
12698
- Object.defineProperty(exports$1, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
12699
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
12700
- Object.defineProperty(exports$1, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
12701
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return code_2.Name; } });
12701
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
12702
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
12703
+ Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
12704
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
12705
+ Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
12706
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
12707
+ Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
12708
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
12702
12709
  var scope_2 = /*@__PURE__*/ requireScope();
12703
- Object.defineProperty(exports$1, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
12704
- Object.defineProperty(exports$1, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
12705
- Object.defineProperty(exports$1, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
12706
- Object.defineProperty(exports$1, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
12707
- exports$1.operators = {
12710
+ Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
12711
+ Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
12712
+ Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
12713
+ Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
12714
+ exports.operators = {
12708
12715
  GT: new code_1._Code(">"),
12709
12716
  GTE: new code_1._Code(">="),
12710
12717
  LT: new code_1._Code("<"),
@@ -13118,7 +13125,7 @@ function requireCodegen () {
13118
13125
  }
13119
13126
  // `+=` code
13120
13127
  add(lhs, rhs) {
13121
- return this._leafNode(new AssignOp(lhs, exports$1.operators.ADD, rhs));
13128
+ return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
13122
13129
  }
13123
13130
  // appends passed SafeExpr to code or executes Block
13124
13131
  code(c) {
@@ -13320,7 +13327,7 @@ function requireCodegen () {
13320
13327
  ns[ns.length - 1] = node;
13321
13328
  }
13322
13329
  }
13323
- exports$1.CodeGen = CodeGen;
13330
+ exports.CodeGen = CodeGen;
13324
13331
  function addNames(names, from) {
13325
13332
  for (const n in from)
13326
13333
  names[n] = (names[n] || 0) + (from[n] || 0);
@@ -13362,19 +13369,19 @@ function requireCodegen () {
13362
13369
  function not(x) {
13363
13370
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
13364
13371
  }
13365
- exports$1.not = not;
13366
- const andCode = mappend(exports$1.operators.AND);
13372
+ exports.not = not;
13373
+ const andCode = mappend(exports.operators.AND);
13367
13374
  // boolean AND (&&) expression with the passed arguments
13368
13375
  function and(...args) {
13369
13376
  return args.reduce(andCode);
13370
13377
  }
13371
- exports$1.and = and;
13372
- const orCode = mappend(exports$1.operators.OR);
13378
+ exports.and = and;
13379
+ const orCode = mappend(exports.operators.OR);
13373
13380
  // boolean OR (||) expression with the passed arguments
13374
13381
  function or(...args) {
13375
13382
  return args.reduce(orCode);
13376
13383
  }
13377
- exports$1.or = or;
13384
+ exports.or = or;
13378
13385
  function mappend(op) {
13379
13386
  return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
13380
13387
  }
@@ -13615,21 +13622,21 @@ var hasRequiredErrors;
13615
13622
  function requireErrors () {
13616
13623
  if (hasRequiredErrors) return errors;
13617
13624
  hasRequiredErrors = 1;
13618
- (function (exports$1) {
13619
- Object.defineProperty(exports$1, "__esModule", { value: true });
13620
- exports$1.extendErrors = exports$1.resetErrorsCount = exports$1.reportExtraError = exports$1.reportError = exports$1.keyword$DataError = exports$1.keywordError = void 0;
13625
+ (function (exports) {
13626
+ Object.defineProperty(exports, "__esModule", { value: true });
13627
+ exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
13621
13628
  const codegen_1 = /*@__PURE__*/ requireCodegen();
13622
13629
  const util_1 = /*@__PURE__*/ requireUtil$1();
13623
13630
  const names_1 = /*@__PURE__*/ requireNames();
13624
- exports$1.keywordError = {
13631
+ exports.keywordError = {
13625
13632
  message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`,
13626
13633
  };
13627
- exports$1.keyword$DataError = {
13634
+ exports.keyword$DataError = {
13628
13635
  message: ({ keyword, schemaType }) => schemaType
13629
13636
  ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)`
13630
13637
  : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`,
13631
13638
  };
13632
- function reportError(cxt, error = exports$1.keywordError, errorPaths, overrideAllErrors) {
13639
+ function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
13633
13640
  const { it } = cxt;
13634
13641
  const { gen, compositeRule, allErrors } = it;
13635
13642
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -13640,8 +13647,8 @@ function requireErrors () {
13640
13647
  returnErrors(it, (0, codegen_1._) `[${errObj}]`);
13641
13648
  }
13642
13649
  }
13643
- exports$1.reportError = reportError;
13644
- function reportExtraError(cxt, error = exports$1.keywordError, errorPaths) {
13650
+ exports.reportError = reportError;
13651
+ function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
13645
13652
  const { it } = cxt;
13646
13653
  const { gen, compositeRule, allErrors } = it;
13647
13654
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -13650,12 +13657,12 @@ function requireErrors () {
13650
13657
  returnErrors(it, names_1.default.vErrors);
13651
13658
  }
13652
13659
  }
13653
- exports$1.reportExtraError = reportExtraError;
13660
+ exports.reportExtraError = reportExtraError;
13654
13661
  function resetErrorsCount(gen, errsCount) {
13655
13662
  gen.assign(names_1.default.errors, errsCount);
13656
13663
  gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
13657
13664
  }
13658
- exports$1.resetErrorsCount = resetErrorsCount;
13665
+ exports.resetErrorsCount = resetErrorsCount;
13659
13666
  function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
13660
13667
  /* istanbul ignore if */
13661
13668
  if (errsCount === undefined)
@@ -13671,7 +13678,7 @@ function requireErrors () {
13671
13678
  }
13672
13679
  });
13673
13680
  }
13674
- exports$1.extendErrors = extendErrors;
13681
+ exports.extendErrors = extendErrors;
13675
13682
  function addError(gen, errObj) {
13676
13683
  const err = gen.const("err", errObj);
13677
13684
  gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);
@@ -15665,6 +15672,15 @@ function requireUtils () {
15665
15672
  /** @type {(value: string) => boolean} */
15666
15673
  const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
15667
15674
 
15675
+ /** @type {(value: string) => boolean} */
15676
+ const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
15677
+
15678
+ /** @type {(value: string) => boolean} */
15679
+ const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
15680
+
15681
+ /** @type {(value: string) => boolean} */
15682
+ const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
15683
+
15668
15684
  /**
15669
15685
  * @param {Array<string>} input
15670
15686
  * @returns {string}
@@ -15923,31 +15939,126 @@ function requireUtils () {
15923
15939
  }
15924
15940
 
15925
15941
  /**
15926
- * @param {import('../types/index').URIComponent} component
15927
- * @param {boolean} esc
15928
- * @returns {import('../types/index').URIComponent}
15942
+ * Re-escape RFC 3986 gen-delims that must not appear literally in the host.
15943
+ * After the URI regex parses, these characters cannot be literal in the host
15944
+ * field, so any that appear after decoding came from percent-encoding and
15945
+ * must be restored to prevent authority structure changes.
15946
+ *
15947
+ * @param {string} host
15948
+ * @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
15949
+ * @returns {string}
15929
15950
  */
15930
- function normalizeComponentEncoding (component, esc) {
15931
- const func = esc !== true ? escape : unescape;
15932
- if (component.scheme !== undefined) {
15933
- component.scheme = func(component.scheme);
15934
- }
15935
- if (component.userinfo !== undefined) {
15936
- component.userinfo = func(component.userinfo);
15937
- }
15938
- if (component.host !== undefined) {
15939
- component.host = func(component.host);
15951
+ const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' };
15952
+ const HOST_DELIM_RE = /[@/?#:]/g;
15953
+ const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
15954
+
15955
+ function reescapeHostDelimiters (host, isIP) {
15956
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
15957
+ re.lastIndex = 0;
15958
+ return host.replace(re, (ch) => HOST_DELIMS[ch])
15959
+ }
15960
+
15961
+ /**
15962
+ * Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
15963
+ * Reserved delimiters such as `%2F` and `%2E` stay escaped.
15964
+ *
15965
+ * @param {string} input
15966
+ * @param {boolean} [decodeUnreserved=false]
15967
+ * @returns {string}
15968
+ */
15969
+ function normalizePercentEncoding (input, decodeUnreserved = false) {
15970
+ if (input.indexOf('%') === -1) {
15971
+ return input
15940
15972
  }
15941
- if (component.path !== undefined) {
15942
- component.path = func(component.path);
15973
+
15974
+ let output = '';
15975
+
15976
+ for (let i = 0; i < input.length; i++) {
15977
+ if (input[i] === '%' && i + 2 < input.length) {
15978
+ const hex = input.slice(i + 1, i + 3);
15979
+ if (isHexPair(hex)) {
15980
+ const normalizedHex = hex.toUpperCase();
15981
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
15982
+
15983
+ if (decodeUnreserved && isUnreserved(decoded)) {
15984
+ output += decoded;
15985
+ } else {
15986
+ output += '%' + normalizedHex;
15987
+ }
15988
+
15989
+ i += 2;
15990
+ continue
15991
+ }
15992
+ }
15993
+
15994
+ output += input[i];
15943
15995
  }
15944
- if (component.query !== undefined) {
15945
- component.query = func(component.query);
15996
+
15997
+ return output
15998
+ }
15999
+
16000
+ /**
16001
+ * Normalizes path data without turning reserved escapes into live path syntax.
16002
+ * Valid escapes are uppercased, raw unsafe characters are escaped, and only
16003
+ * unreserved bytes that are not `.` are decoded.
16004
+ *
16005
+ * @param {string} input
16006
+ * @returns {string}
16007
+ */
16008
+ function normalizePathEncoding (input) {
16009
+ let output = '';
16010
+
16011
+ for (let i = 0; i < input.length; i++) {
16012
+ if (input[i] === '%' && i + 2 < input.length) {
16013
+ const hex = input.slice(i + 1, i + 3);
16014
+ if (isHexPair(hex)) {
16015
+ const normalizedHex = hex.toUpperCase();
16016
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
16017
+
16018
+ if (decoded !== '.' && isUnreserved(decoded)) {
16019
+ output += decoded;
16020
+ } else {
16021
+ output += '%' + normalizedHex;
16022
+ }
16023
+
16024
+ i += 2;
16025
+ continue
16026
+ }
16027
+ }
16028
+
16029
+ if (isPathCharacter(input[i])) {
16030
+ output += input[i];
16031
+ } else {
16032
+ output += escape(input[i]);
16033
+ }
15946
16034
  }
15947
- if (component.fragment !== undefined) {
15948
- component.fragment = func(component.fragment);
16035
+
16036
+ return output
16037
+ }
16038
+
16039
+ /**
16040
+ * Escapes a component while preserving existing valid percent escapes.
16041
+ *
16042
+ * @param {string} input
16043
+ * @returns {string}
16044
+ */
16045
+ function escapePreservingEscapes (input) {
16046
+ let output = '';
16047
+
16048
+ for (let i = 0; i < input.length; i++) {
16049
+ if (input[i] === '%' && i + 2 < input.length) {
16050
+ const hex = input.slice(i + 1, i + 3);
16051
+ if (isHexPair(hex)) {
16052
+ output += '%' + hex.toUpperCase();
16053
+ i += 2;
16054
+ continue
16055
+ }
16056
+ }
16057
+
16058
+ output += escape(input[i]);
15949
16059
  }
15950
- return component
16060
+
16061
+ return output
15951
16062
  }
15952
16063
 
15953
16064
  /**
@@ -15969,7 +16080,7 @@ function requireUtils () {
15969
16080
  if (ipV6res.isIPV6 === true) {
15970
16081
  host = `[${ipV6res.escapedHost}]`;
15971
16082
  } else {
15972
- host = component.host;
16083
+ host = reescapeHostDelimiters(host, false);
15973
16084
  }
15974
16085
  }
15975
16086
  uriTokens.push(host);
@@ -15985,7 +16096,10 @@ function requireUtils () {
15985
16096
  utils = {
15986
16097
  nonSimpleDomain,
15987
16098
  recomposeAuthority,
15988
- normalizeComponentEncoding,
16099
+ reescapeHostDelimiters,
16100
+ normalizePercentEncoding,
16101
+ normalizePathEncoding,
16102
+ escapePreservingEscapes,
15989
16103
  removeDotSegments,
15990
16104
  isIPv4,
15991
16105
  isUUID,
@@ -16276,7 +16390,7 @@ function requireFastUri () {
16276
16390
  if (hasRequiredFastUri) return fastUri.exports;
16277
16391
  hasRequiredFastUri = 1;
16278
16392
 
16279
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = requireUtils();
16393
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
16280
16394
  const { SCHEMES, getSchemeHandler } = requireSchemes();
16281
16395
 
16282
16396
  /**
@@ -16287,7 +16401,7 @@ function requireFastUri () {
16287
16401
  */
16288
16402
  function normalize (uri, options) {
16289
16403
  if (typeof uri === 'string') {
16290
- uri = /** @type {T} */ (serialize(parse(uri, options), options));
16404
+ uri = /** @type {T} */ (normalizeString(uri, options));
16291
16405
  } else if (typeof uri === 'object') {
16292
16406
  uri = /** @type {T} */ (parse(serialize(uri, options), options));
16293
16407
  }
@@ -16382,21 +16496,10 @@ function requireFastUri () {
16382
16496
  * @returns {boolean}
16383
16497
  */
16384
16498
  function equal (uriA, uriB, options) {
16385
- if (typeof uriA === 'string') {
16386
- uriA = unescape(uriA);
16387
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
16388
- } else if (typeof uriA === 'object') {
16389
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
16390
- }
16391
-
16392
- if (typeof uriB === 'string') {
16393
- uriB = unescape(uriB);
16394
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
16395
- } else if (typeof uriB === 'object') {
16396
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
16397
- }
16499
+ const normalizedA = normalizeComparableURI(uriA, options);
16500
+ const normalizedB = normalizeComparableURI(uriB, options);
16398
16501
 
16399
- return uriA.toLowerCase() === uriB.toLowerCase()
16502
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
16400
16503
  }
16401
16504
 
16402
16505
  /**
@@ -16432,13 +16535,13 @@ function requireFastUri () {
16432
16535
 
16433
16536
  if (component.path !== undefined) {
16434
16537
  if (!options.skipEscape) {
16435
- component.path = escape(component.path);
16538
+ component.path = escapePreservingEscapes(component.path);
16436
16539
 
16437
16540
  if (component.scheme !== undefined) {
16438
16541
  component.path = component.path.split('%3A').join(':');
16439
16542
  }
16440
16543
  } else {
16441
- component.path = unescape(component.path);
16544
+ component.path = normalizePercentEncoding(component.path);
16442
16545
  }
16443
16546
  }
16444
16547
 
@@ -16489,12 +16592,29 @@ function requireFastUri () {
16489
16592
 
16490
16593
  const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
16491
16594
 
16595
+ /**
16596
+ * @param {import('./types/index').URIComponent} parsed
16597
+ * @param {RegExpMatchArray} matches
16598
+ * @returns {string|undefined}
16599
+ */
16600
+ function getParseError (parsed, matches) {
16601
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== '/') {
16602
+ return 'URI path must start with "/" when authority is present.'
16603
+ }
16604
+
16605
+ if (typeof parsed.port === 'number' && (parsed.port < 0 || parsed.port > 65535)) {
16606
+ return 'URI port is malformed.'
16607
+ }
16608
+
16609
+ return undefined
16610
+ }
16611
+
16492
16612
  /**
16493
16613
  * @param {string} uri
16494
16614
  * @param {import('./types/index').Options} [opts]
16495
- * @returns
16615
+ * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
16496
16616
  */
16497
- function parse (uri, opts) {
16617
+ function parseWithStatus (uri, opts) {
16498
16618
  const options = Object.assign({}, opts);
16499
16619
  /** @type {import('./types/index').URIComponent} */
16500
16620
  const parsed = {
@@ -16507,6 +16627,8 @@ function requireFastUri () {
16507
16627
  fragment: undefined
16508
16628
  };
16509
16629
 
16630
+ let malformedAuthorityOrPort = false;
16631
+
16510
16632
  let isIP = false;
16511
16633
  if (options.reference === 'suffix') {
16512
16634
  if (options.scheme) {
@@ -16532,6 +16654,13 @@ function requireFastUri () {
16532
16654
  if (isNaN(parsed.port)) {
16533
16655
  parsed.port = matches[5];
16534
16656
  }
16657
+
16658
+ const parseError = getParseError(parsed, matches);
16659
+ if (parseError !== undefined) {
16660
+ parsed.error = parsed.error || parseError;
16661
+ malformedAuthorityOrPort = true;
16662
+ }
16663
+
16535
16664
  if (parsed.host) {
16536
16665
  const ipv4result = isIPv4(parsed.host);
16537
16666
  if (ipv4result === false) {
@@ -16580,14 +16709,18 @@ function requireFastUri () {
16580
16709
  parsed.scheme = unescape(parsed.scheme);
16581
16710
  }
16582
16711
  if (parsed.host !== undefined) {
16583
- parsed.host = unescape(parsed.host);
16712
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
16584
16713
  }
16585
16714
  }
16586
16715
  if (parsed.path) {
16587
- parsed.path = escape(unescape(parsed.path));
16716
+ parsed.path = normalizePathEncoding(parsed.path);
16588
16717
  }
16589
16718
  if (parsed.fragment) {
16590
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
16719
+ try {
16720
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
16721
+ } catch {
16722
+ parsed.error = parsed.error || 'URI malformed';
16723
+ }
16591
16724
  }
16592
16725
  }
16593
16726
 
@@ -16598,7 +16731,54 @@ function requireFastUri () {
16598
16731
  } else {
16599
16732
  parsed.error = parsed.error || 'URI can not be parsed.';
16600
16733
  }
16601
- return parsed
16734
+ return { parsed, malformedAuthorityOrPort }
16735
+ }
16736
+
16737
+ /**
16738
+ * @param {string} uri
16739
+ * @param {import('./types/index').Options} [opts]
16740
+ * @returns
16741
+ */
16742
+ function parse (uri, opts) {
16743
+ return parseWithStatus(uri, opts).parsed
16744
+ }
16745
+
16746
+ /**
16747
+ * @param {string} uri
16748
+ * @param {import('./types/index').Options} [opts]
16749
+ * @returns {string}
16750
+ */
16751
+ function normalizeString (uri, opts) {
16752
+ return normalizeStringWithStatus(uri, opts).normalized
16753
+ }
16754
+
16755
+ /**
16756
+ * @param {string} uri
16757
+ * @param {import('./types/index').Options} [opts]
16758
+ * @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
16759
+ */
16760
+ function normalizeStringWithStatus (uri, opts) {
16761
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
16762
+ return {
16763
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
16764
+ malformedAuthorityOrPort
16765
+ }
16766
+ }
16767
+
16768
+ /**
16769
+ * @param {import ('./types/index').URIComponent|string} uri
16770
+ * @param {import('./types/index').Options} [opts]
16771
+ * @returns {string|undefined}
16772
+ */
16773
+ function normalizeComparableURI (uri, opts) {
16774
+ if (typeof uri === 'string') {
16775
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
16776
+ return malformedAuthorityOrPort ? undefined : normalized
16777
+ }
16778
+
16779
+ if (typeof uri === 'object') {
16780
+ return serialize(uri, opts)
16781
+ }
16602
16782
  }
16603
16783
 
16604
16784
  const fastUri$1 = {
@@ -16635,18 +16815,18 @@ var hasRequiredCore$1;
16635
16815
  function requireCore$1 () {
16636
16816
  if (hasRequiredCore$1) return core$1;
16637
16817
  hasRequiredCore$1 = 1;
16638
- (function (exports$1) {
16639
- Object.defineProperty(exports$1, "__esModule", { value: true });
16640
- exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
16818
+ (function (exports) {
16819
+ Object.defineProperty(exports, "__esModule", { value: true });
16820
+ exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
16641
16821
  var validate_1 = /*@__PURE__*/ requireValidate();
16642
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
16822
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
16643
16823
  var codegen_1 = /*@__PURE__*/ requireCodegen();
16644
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
16645
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
16646
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
16647
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
16648
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
16649
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
16824
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
16825
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
16826
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
16827
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
16828
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
16829
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
16650
16830
  const validation_error_1 = /*@__PURE__*/ requireValidation_error();
16651
16831
  const ref_error_1 = /*@__PURE__*/ requireRef_error();
16652
16832
  const rules_1 = /*@__PURE__*/ requireRules();
@@ -16731,7 +16911,7 @@ function requireCore$1 () {
16731
16911
  constructor(opts = {}) {
16732
16912
  this.schemas = {};
16733
16913
  this.refs = {};
16734
- this.formats = {};
16914
+ this.formats = Object.create(null);
16735
16915
  this._compilations = new Set();
16736
16916
  this._loading = {};
16737
16917
  this._cache = new Map();
@@ -17126,7 +17306,7 @@ function requireCore$1 () {
17126
17306
  }
17127
17307
  Ajv.ValidationError = validation_error_1.default;
17128
17308
  Ajv.MissingRefError = ref_error_1.default;
17129
- exports$1.default = Ajv;
17309
+ exports.default = Ajv;
17130
17310
  function checkOptions(checkOpts, options, msg, log = "error") {
17131
17311
  for (const key in checkOpts) {
17132
17312
  const opt = key;
@@ -18284,13 +18464,13 @@ var hasRequiredDependencies;
18284
18464
  function requireDependencies () {
18285
18465
  if (hasRequiredDependencies) return dependencies;
18286
18466
  hasRequiredDependencies = 1;
18287
- (function (exports$1) {
18288
- Object.defineProperty(exports$1, "__esModule", { value: true });
18289
- exports$1.validateSchemaDeps = exports$1.validatePropertyDeps = exports$1.error = void 0;
18467
+ (function (exports) {
18468
+ Object.defineProperty(exports, "__esModule", { value: true });
18469
+ exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
18290
18470
  const codegen_1 = /*@__PURE__*/ requireCodegen();
18291
18471
  const util_1 = /*@__PURE__*/ requireUtil$1();
18292
18472
  const code_1 = /*@__PURE__*/ requireCode();
18293
- exports$1.error = {
18473
+ exports.error = {
18294
18474
  message: ({ params: { property, depsCount, deps } }) => {
18295
18475
  const property_ies = depsCount === 1 ? "property" : "properties";
18296
18476
  return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`;
@@ -18304,7 +18484,7 @@ function requireDependencies () {
18304
18484
  keyword: "dependencies",
18305
18485
  type: "object",
18306
18486
  schemaType: "object",
18307
- error: exports$1.error,
18487
+ error: exports.error,
18308
18488
  code(cxt) {
18309
18489
  const [propDeps, schDeps] = splitDependencies(cxt);
18310
18490
  validatePropertyDeps(cxt, propDeps);
@@ -18351,7 +18531,7 @@ function requireDependencies () {
18351
18531
  }
18352
18532
  }
18353
18533
  }
18354
- exports$1.validatePropertyDeps = validatePropertyDeps;
18534
+ exports.validatePropertyDeps = validatePropertyDeps;
18355
18535
  function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
18356
18536
  const { gen, data, keyword, it } = cxt;
18357
18537
  const valid = gen.name("valid");
@@ -18366,8 +18546,8 @@ function requireDependencies () {
18366
18546
  cxt.ok(valid);
18367
18547
  }
18368
18548
  }
18369
- exports$1.validateSchemaDeps = validateSchemaDeps;
18370
- exports$1.default = def;
18549
+ exports.validateSchemaDeps = validateSchemaDeps;
18550
+ exports.default = def;
18371
18551
 
18372
18552
  } (dependencies));
18373
18553
  return dependencies;
@@ -19542,9 +19722,9 @@ var hasRequiredAjv;
19542
19722
  function requireAjv () {
19543
19723
  if (hasRequiredAjv) return ajv$1.exports;
19544
19724
  hasRequiredAjv = 1;
19545
- (function (module, exports$1) {
19546
- Object.defineProperty(exports$1, "__esModule", { value: true });
19547
- exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv = void 0;
19725
+ (function (module, exports) {
19726
+ Object.defineProperty(exports, "__esModule", { value: true });
19727
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
19548
19728
  const core_1 = /*@__PURE__*/ requireCore$1();
19549
19729
  const draft7_1 = /*@__PURE__*/ requireDraft7();
19550
19730
  const discriminator_1 = /*@__PURE__*/ requireDiscriminator();
@@ -19573,24 +19753,24 @@ function requireAjv () {
19573
19753
  super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
19574
19754
  }
19575
19755
  }
19576
- exports$1.Ajv = Ajv;
19577
- module.exports = exports$1 = Ajv;
19756
+ exports.Ajv = Ajv;
19757
+ module.exports = exports = Ajv;
19578
19758
  module.exports.Ajv = Ajv;
19579
- Object.defineProperty(exports$1, "__esModule", { value: true });
19580
- exports$1.default = Ajv;
19759
+ Object.defineProperty(exports, "__esModule", { value: true });
19760
+ exports.default = Ajv;
19581
19761
  var validate_1 = /*@__PURE__*/ requireValidate();
19582
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
19762
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
19583
19763
  var codegen_1 = /*@__PURE__*/ requireCodegen();
19584
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
19585
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
19586
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
19587
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
19588
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
19589
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
19764
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
19765
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
19766
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
19767
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
19768
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
19769
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
19590
19770
  var validation_error_1 = /*@__PURE__*/ requireValidation_error();
19591
- Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
19771
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
19592
19772
  var ref_error_1 = /*@__PURE__*/ requireRef_error();
19593
- Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
19773
+ Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
19594
19774
 
19595
19775
  } (ajv$1, ajv$1.exports));
19596
19776
  return ajv$1.exports;
@@ -20688,9 +20868,9 @@ var hasRequired_2019;
20688
20868
  function require_2019 () {
20689
20869
  if (hasRequired_2019) return _2019.exports;
20690
20870
  hasRequired_2019 = 1;
20691
- (function (module, exports$1) {
20692
- Object.defineProperty(exports$1, "__esModule", { value: true });
20693
- exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv2019 = void 0;
20871
+ (function (module, exports) {
20872
+ Object.defineProperty(exports, "__esModule", { value: true });
20873
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0;
20694
20874
  const core_1 = /*@__PURE__*/ requireCore$1();
20695
20875
  const draft7_1 = /*@__PURE__*/ requireDraft7();
20696
20876
  const dynamic_1 = /*@__PURE__*/ requireDynamic();
@@ -20730,24 +20910,24 @@ function require_2019 () {
20730
20910
  super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
20731
20911
  }
20732
20912
  }
20733
- exports$1.Ajv2019 = Ajv2019;
20734
- module.exports = exports$1 = Ajv2019;
20913
+ exports.Ajv2019 = Ajv2019;
20914
+ module.exports = exports = Ajv2019;
20735
20915
  module.exports.Ajv2019 = Ajv2019;
20736
- Object.defineProperty(exports$1, "__esModule", { value: true });
20737
- exports$1.default = Ajv2019;
20916
+ Object.defineProperty(exports, "__esModule", { value: true });
20917
+ exports.default = Ajv2019;
20738
20918
  var validate_1 = /*@__PURE__*/ requireValidate();
20739
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
20919
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
20740
20920
  var codegen_1 = /*@__PURE__*/ requireCodegen();
20741
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
20742
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
20743
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
20744
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
20745
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
20746
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
20921
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
20922
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
20923
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
20924
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
20925
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
20926
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
20747
20927
  var validation_error_1 = /*@__PURE__*/ requireValidation_error();
20748
- Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
20928
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
20749
20929
  var ref_error_1 = /*@__PURE__*/ requireRef_error();
20750
- Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
20930
+ Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
20751
20931
 
20752
20932
  } (_2019, _2019.exports));
20753
20933
  return _2019.exports;
@@ -20765,13 +20945,13 @@ var hasRequiredFormats;
20765
20945
  function requireFormats () {
20766
20946
  if (hasRequiredFormats) return formats;
20767
20947
  hasRequiredFormats = 1;
20768
- (function (exports$1) {
20769
- Object.defineProperty(exports$1, "__esModule", { value: true });
20770
- exports$1.formatNames = exports$1.fastFormats = exports$1.fullFormats = void 0;
20948
+ (function (exports) {
20949
+ Object.defineProperty(exports, "__esModule", { value: true });
20950
+ exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
20771
20951
  function fmtDef(validate, compare) {
20772
20952
  return { validate, compare };
20773
20953
  }
20774
- exports$1.fullFormats = {
20954
+ exports.fullFormats = {
20775
20955
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
20776
20956
  date: fmtDef(date, compareDate),
20777
20957
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -20818,8 +20998,8 @@ function requireFormats () {
20818
20998
  // unchecked string payload
20819
20999
  binary: true,
20820
21000
  };
20821
- exports$1.fastFormats = {
20822
- ...exports$1.fullFormats,
21001
+ exports.fastFormats = {
21002
+ ...exports.fullFormats,
20823
21003
  date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
20824
21004
  time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
20825
21005
  "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
@@ -20833,7 +21013,7 @@ function requireFormats () {
20833
21013
  // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
20834
21014
  email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
20835
21015
  };
20836
- exports$1.formatNames = Object.keys(exports$1.fullFormats);
21016
+ exports.formatNames = Object.keys(exports.fullFormats);
20837
21017
  function isLeapYear(year) {
20838
21018
  // https://tools.ietf.org/html/rfc3339#appendix-C
20839
21019
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
@@ -20984,9 +21164,9 @@ var hasRequiredLimit;
20984
21164
  function requireLimit () {
20985
21165
  if (hasRequiredLimit) return limit;
20986
21166
  hasRequiredLimit = 1;
20987
- (function (exports$1) {
20988
- Object.defineProperty(exports$1, "__esModule", { value: true });
20989
- exports$1.formatLimitDefinition = void 0;
21167
+ (function (exports) {
21168
+ Object.defineProperty(exports, "__esModule", { value: true });
21169
+ exports.formatLimitDefinition = void 0;
20990
21170
  const ajv_1 = /*@__PURE__*/ requireAjv();
20991
21171
  const codegen_1 = /*@__PURE__*/ requireCodegen();
20992
21172
  const ops = codegen_1.operators;
@@ -21000,7 +21180,7 @@ function requireLimit () {
21000
21180
  message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,
21001
21181
  params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
21002
21182
  };
21003
- exports$1.formatLimitDefinition = {
21183
+ exports.formatLimitDefinition = {
21004
21184
  keyword: Object.keys(KWDs),
21005
21185
  type: "string",
21006
21186
  schemaType: "string",
@@ -21048,10 +21228,10 @@ function requireLimit () {
21048
21228
  dependencies: ["format"],
21049
21229
  };
21050
21230
  const formatLimitPlugin = (ajv) => {
21051
- ajv.addKeyword(exports$1.formatLimitDefinition);
21231
+ ajv.addKeyword(exports.formatLimitDefinition);
21052
21232
  return ajv;
21053
21233
  };
21054
- exports$1.default = formatLimitPlugin;
21234
+ exports.default = formatLimitPlugin;
21055
21235
 
21056
21236
  } (limit));
21057
21237
  return limit;
@@ -21062,8 +21242,8 @@ var hasRequiredDist$1;
21062
21242
  function requireDist$1 () {
21063
21243
  if (hasRequiredDist$1) return dist$2.exports;
21064
21244
  hasRequiredDist$1 = 1;
21065
- (function (module, exports$1) {
21066
- Object.defineProperty(exports$1, "__esModule", { value: true });
21245
+ (function (module, exports) {
21246
+ Object.defineProperty(exports, "__esModule", { value: true });
21067
21247
  const formats_1 = requireFormats();
21068
21248
  const limit_1 = requireLimit();
21069
21249
  const codegen_1 = /*@__PURE__*/ requireCodegen();
@@ -21095,9 +21275,9 @@ function requireDist$1 () {
21095
21275
  for (const f of list)
21096
21276
  ajv.addFormat(f, fs[f]);
21097
21277
  }
21098
- module.exports = exports$1 = formatsPlugin;
21099
- Object.defineProperty(exports$1, "__esModule", { value: true });
21100
- exports$1.default = formatsPlugin;
21278
+ module.exports = exports = formatsPlugin;
21279
+ Object.defineProperty(exports, "__esModule", { value: true });
21280
+ exports.default = formatsPlugin;
21101
21281
 
21102
21282
  } (dist$2, dist$2.exports));
21103
21283
  return dist$2.exports;
@@ -21599,9 +21779,9 @@ var hasRequiredTypes$1;
21599
21779
  function requireTypes$1 () {
21600
21780
  if (hasRequiredTypes$1) return types;
21601
21781
  hasRequiredTypes$1 = 1;
21602
- (function (exports$1) {
21603
- Object.defineProperty(exports$1, "__esModule", { value: true });
21604
- exports$1.types = void 0;
21782
+ (function (exports) {
21783
+ Object.defineProperty(exports, "__esModule", { value: true });
21784
+ exports.types = void 0;
21605
21785
  (function (types) {
21606
21786
  types[types["ROOT"] = 0] = "ROOT";
21607
21787
  types[types["GROUP"] = 1] = "GROUP";
@@ -21611,7 +21791,7 @@ function requireTypes$1 () {
21611
21791
  types[types["REPETITION"] = 5] = "REPETITION";
21612
21792
  types[types["REFERENCE"] = 6] = "REFERENCE";
21613
21793
  types[types["CHAR"] = 7] = "CHAR";
21614
- })(exports$1.types || (exports$1.types = {}));
21794
+ })(exports.types || (exports.types = {}));
21615
21795
 
21616
21796
  } (types));
21617
21797
  return types;
@@ -21634,7 +21814,7 @@ var hasRequiredTypes;
21634
21814
  function requireTypes () {
21635
21815
  if (hasRequiredTypes) return types$1;
21636
21816
  hasRequiredTypes = 1;
21637
- (function (exports$1) {
21817
+ (function (exports) {
21638
21818
  var __createBinding = (types$1 && types$1.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21639
21819
  if (k2 === undefined) k2 = k;
21640
21820
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -21642,13 +21822,13 @@ function requireTypes () {
21642
21822
  if (k2 === undefined) k2 = k;
21643
21823
  o[k2] = m[k];
21644
21824
  }));
21645
- var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports$1) {
21646
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
21825
+ var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports) {
21826
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21647
21827
  };
21648
- Object.defineProperty(exports$1, "__esModule", { value: true });
21649
- __exportStar(requireTokens(), exports$1);
21650
- __exportStar(requireTypes$1(), exports$1);
21651
- __exportStar(requireSetLookup(), exports$1);
21828
+ Object.defineProperty(exports, "__esModule", { value: true });
21829
+ __exportStar(requireTokens(), exports);
21830
+ __exportStar(requireTypes$1(), exports);
21831
+ __exportStar(requireSetLookup(), exports);
21652
21832
 
21653
21833
  } (types$1));
21654
21834
  return types$1;
@@ -22351,12 +22531,12 @@ var hasRequiredReconstruct;
22351
22531
  function requireReconstruct () {
22352
22532
  if (hasRequiredReconstruct) return reconstruct;
22353
22533
  hasRequiredReconstruct = 1;
22354
- (function (exports$1) {
22355
- Object.defineProperty(exports$1, "__esModule", { value: true });
22356
- exports$1.reconstruct = void 0;
22534
+ (function (exports) {
22535
+ Object.defineProperty(exports, "__esModule", { value: true });
22536
+ exports.reconstruct = void 0;
22357
22537
  const types_1 = requireTypes();
22358
22538
  const write_set_tokens_1 = requireWriteSetTokens();
22359
- const reduceStack = (stack) => stack.map(exports$1.reconstruct).join('');
22539
+ const reduceStack = (stack) => stack.map(exports.reconstruct).join('');
22360
22540
  const createAlternate = (token) => {
22361
22541
  if ('options' in token) {
22362
22542
  return token.options.map(reduceStack).join('|');
@@ -22368,7 +22548,7 @@ function requireReconstruct () {
22368
22548
  throw new Error(`options or stack must be Root or Group token`);
22369
22549
  }
22370
22550
  };
22371
- exports$1.reconstruct = (token) => {
22551
+ exports.reconstruct = (token) => {
22372
22552
  switch (token.type) {
22373
22553
  case types_1.types.ROOT:
22374
22554
  return createAlternate(token);
@@ -22419,7 +22599,7 @@ function requireReconstruct () {
22419
22599
  else {
22420
22600
  endWith = `{${min},${max}}`;
22421
22601
  }
22422
- return `${exports$1.reconstruct(token.value)}${endWith}`;
22602
+ return `${exports.reconstruct(token.value)}${endWith}`;
22423
22603
  }
22424
22604
  case types_1.types.RANGE:
22425
22605
  return `${write_set_tokens_1.setChar(token.from)}-${write_set_tokens_1.setChar(token.to)}`;
@@ -22439,7 +22619,7 @@ var hasRequiredDist;
22439
22619
  function requireDist () {
22440
22620
  if (hasRequiredDist) return dist$1.exports;
22441
22621
  hasRequiredDist = 1;
22442
- (function (module, exports$1) {
22622
+ (function (module, exports) {
22443
22623
  var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22444
22624
  if (k2 === undefined) k2 = k;
22445
22625
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -22447,20 +22627,20 @@ function requireDist () {
22447
22627
  if (k2 === undefined) k2 = k;
22448
22628
  o[k2] = m[k];
22449
22629
  }));
22450
- var __exportStar = (dist && dist.__exportStar) || function(m, exports$1) {
22451
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
22630
+ var __exportStar = (dist && dist.__exportStar) || function(m, exports) {
22631
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22452
22632
  };
22453
- Object.defineProperty(exports$1, "__esModule", { value: true });
22454
- exports$1.types = void 0;
22633
+ Object.defineProperty(exports, "__esModule", { value: true });
22634
+ exports.types = void 0;
22455
22635
  /* istanbul ignore file */
22456
22636
  const types_1 = requireTypes();
22457
- Object.defineProperty(exports$1, "types", { enumerable: true, get: function () { return types_1.types; } });
22458
- __exportStar(requireTokenizer(), exports$1);
22459
- __exportStar(requireReconstruct(), exports$1);
22637
+ Object.defineProperty(exports, "types", { enumerable: true, get: function () { return types_1.types; } });
22638
+ __exportStar(requireTokenizer(), exports);
22639
+ __exportStar(requireReconstruct(), exports);
22460
22640
  const tokenizer_1 = requireTokenizer();
22461
22641
  const reconstruct_1 = requireReconstruct();
22462
- __exportStar(requireTypes(), exports$1);
22463
- exports$1.default = tokenizer_1.tokenizer;
22642
+ __exportStar(requireTypes(), exports);
22643
+ exports.default = tokenizer_1.tokenizer;
22464
22644
  module.exports = tokenizer_1.tokenizer;
22465
22645
  module.exports.types = types_1.types;
22466
22646
  module.exports.reconstruct = reconstruct_1.reconstruct;
@@ -22476,52 +22656,74 @@ function requireSafeRegex2 () {
22476
22656
  hasRequiredSafeRegex2 = 1;
22477
22657
 
22478
22658
  const parse = requireDist();
22479
- const types = parse.types;
22480
-
22481
- function safeRegex (re, opts) {
22482
- if (!opts) opts = {};
22483
- /* c8 ignore next */
22484
- const replimit = opts.limit === undefined ? 25 : opts.limit;
22659
+ const { types } = requireDist();
22485
22660
 
22486
- /* c8 ignore next 2 */
22487
- if (isRegExp(re)) re = re.source;
22488
- else if (typeof re !== 'string') re = String(re);
22661
+ /**
22662
+ * @param {*} node
22663
+ * @param {object} opts
22664
+ * @param {number} opts.reps - The number of repetitions encountered
22665
+ * @param {number} opts.limit - The maximum number of repetitions allowed
22666
+ * @param {number} starHeight - The current height of the star in the regex tree
22667
+ * @returns {boolean}
22668
+ */
22669
+ function walk (node, opts, starHeight) {
22670
+ let i;
22671
+ let ok;
22672
+ let len;
22673
+
22674
+ if (node.type === types.REPETITION) {
22675
+ starHeight++;
22676
+ opts.reps++;
22677
+ if (starHeight > 1) return false
22678
+ if (opts.reps > opts.limit) return false
22679
+ }
22489
22680
 
22490
- try { re = parse(re); } catch { return false }
22681
+ const options = node.options || node.value?.options;
22682
+ if (options) {
22683
+ for (i = 0, len = options.length; i < len; i++) {
22684
+ ok = walk({ stack: options[i] }, opts, starHeight);
22685
+ if (!ok) return false
22686
+ }
22687
+ }
22688
+ const stack = node.stack || node.value?.stack;
22689
+ if (!stack) return true
22491
22690
 
22492
- let reps = 0;
22493
- return (function walk (node, starHeight) {
22494
- let i;
22495
- let ok;
22496
- let len;
22691
+ for (i = 0, len = stack.length; i < len; i++) {
22692
+ ok = walk(stack[i], opts, starHeight);
22693
+ if (!ok) return false
22694
+ }
22497
22695
 
22498
- if (node.type === types.REPETITION) {
22499
- starHeight++;
22500
- reps++;
22501
- if (starHeight > 1) return false
22502
- if (reps > replimit) return false
22503
- }
22696
+ return true
22697
+ }
22504
22698
 
22505
- if (node.options) {
22506
- for (i = 0, len = node.options.length; i < len; i++) {
22507
- ok = walk({ stack: node.options[i] }, starHeight);
22508
- if (!ok) return false
22509
- }
22510
- }
22511
- const stack = node.stack || node.value?.stack;
22512
- if (!stack) return true
22699
+ /**
22700
+ * @param {string|RegExp} re - The regular expression to check, can be a string or RegExp object
22701
+ * @param {object} [options]
22702
+ * @param {number} [options.limit=25] - The maximum number of repetitions allowed
22703
+ * @returns {boolean} - Returns true if the regex is safe, false if it is unsafe or invalid
22704
+ */
22705
+ function safeRegex (re, options) {
22706
+ const opts = {
22707
+ reps: 0,
22708
+ limit: options?.limit ?? 25
22709
+ };
22513
22710
 
22514
- for (i = 0; i < stack.length; i++) {
22515
- ok = walk(stack[i], starHeight);
22516
- if (!ok) return false
22517
- }
22711
+ if (isRegExp(re)) re = re.source;
22712
+ else if (typeof re !== 'string') re = String(re);
22518
22713
 
22519
- return true
22520
- })(re, 0)
22714
+ try {
22715
+ return walk(parse(re), opts, 0)
22716
+ } catch {
22717
+ return false
22718
+ }
22521
22719
  }
22522
22720
 
22721
+ /**
22722
+ * @param {*} x
22723
+ * @returns {x is RegExp}
22724
+ */
22523
22725
  function isRegExp (x) {
22524
- return {}.toString.call(x) === '[object RegExp]'
22726
+ return Object.prototype.toString.call(x) === '[object RegExp]'
22525
22727
  }
22526
22728
 
22527
22729
  safeRegex2.exports = safeRegex;
@@ -22910,14 +23112,15 @@ function requireHandlerStorage () {
22910
23112
  // An example: a request comes in for version 1.x, and this node has a handler that matches the path, but there's no version constraint. For SemVer, the find-my-way semantics do not match this handler to that request.
22911
23113
  // This function is used by Nodes with handlers to match when they don't have any constrained routes to exclude request that do have must match derived constraints present.
22912
23114
  for (const constraint in constrainer.strategies) {
23115
+ if (!Object.hasOwn(constrainer.strategies, constraint)) continue
22913
23116
  const strategy = constrainer.strategies[constraint];
22914
23117
  if (strategy.mustMatchWhenDerived && !this.constraints.includes(constraint)) {
22915
23118
  lines.push(`if (derivedConstraints.${constraint} !== undefined) return null`);
22916
23119
  }
22917
23120
  }
22918
23121
 
22919
- // Return the first handler who's bit is set in the candidates https://stackoverflow.com/questions/18134985/how-to-find-index-of-first-set-bit
22920
- lines.push('return this.handlers[Math.floor(Math.log2(candidates))]');
23122
+ // Return the highest set bit index in the candidates bitmask.
23123
+ lines.push('return this.handlers[31 - Math.clz32(candidates)]');
22921
23124
 
22922
23125
  this._getHandlerMatchingConstraints = new Function('derivedConstraints', lines.join('\n')); // eslint-disable-line
22923
23126
  }
@@ -23363,6 +23566,7 @@ function requireConstrainer () {
23363
23566
  if (constraints) {
23364
23567
  const beforeSize = this.strategiesInUse.size;
23365
23568
  for (const key in constraints) {
23569
+ if (!Object.hasOwn(constraints, key)) continue
23366
23570
  const strategy = this.strategies[key];
23367
23571
  if (strategy.isAsync) {
23368
23572
  this.asyncStrategiesInUse.add(key);
@@ -23385,6 +23589,7 @@ function requireConstrainer () {
23385
23589
 
23386
23590
  validateConstraints (constraints) {
23387
23591
  for (const key in constraints) {
23592
+ if (!Object.hasOwn(constraints, key)) continue
23388
23593
  const value = constraints[key];
23389
23594
  if (typeof value === 'undefined') {
23390
23595
  throw new Error('Can\'t pass an undefined constraint value, must pass null or no key at all')
@@ -23694,6 +23899,7 @@ function requireFindMyWay () {
23694
23899
  this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false;
23695
23900
  this.ignoreDuplicateSlashes = opts.ignoreDuplicateSlashes || false;
23696
23901
  this.maxParamLength = opts.maxParamLength || 100;
23902
+ this.onMaxParamLength = opts.onMaxParamLength || null;
23697
23903
  this.allowUnsafeRegex = opts.allowUnsafeRegex || false;
23698
23904
  this.constrainer = new Constrainer(opts.constraints);
23699
23905
  this.useSemicolonDelimiter = opts.useSemicolonDelimiter || false;
@@ -24201,6 +24407,7 @@ function requireFindMyWay () {
24201
24407
  const pathLen = path.length;
24202
24408
 
24203
24409
  const brothersNodesStack = [];
24410
+ let maxParamLengthExceeded = false;
24204
24411
 
24205
24412
  while (true) {
24206
24413
  if (pathIndex === pathLen && currentNode.isLeafNode) {
@@ -24219,6 +24426,9 @@ function requireFindMyWay () {
24219
24426
 
24220
24427
  if (node === null) {
24221
24428
  if (brothersNodesStack.length === 0) {
24429
+ if (maxParamLengthExceeded && this.onMaxParamLength) {
24430
+ return this._onMaxParamLength(originPath)
24431
+ }
24222
24432
  return null
24223
24433
  }
24224
24434
 
@@ -24260,18 +24470,34 @@ function requireFindMyWay () {
24260
24470
 
24261
24471
  if (currentNode.isRegex) {
24262
24472
  const matchedParameters = currentNode.regex.exec(param);
24263
- if (matchedParameters === null) continue
24473
+ if (matchedParameters === null) {
24474
+ node = null;
24475
+ continue
24476
+ }
24264
24477
 
24478
+ let regexMaxParamLengthExceeded = false;
24265
24479
  for (let i = 1; i < matchedParameters.length; i++) {
24266
24480
  const matchedParam = matchedParameters[i];
24267
24481
  if (matchedParam.length > maxParamLength) {
24268
- return null
24482
+ regexMaxParamLengthExceeded = true;
24483
+ break
24269
24484
  }
24270
- params.push(matchedParam);
24485
+ }
24486
+
24487
+ if (regexMaxParamLengthExceeded) {
24488
+ maxParamLengthExceeded = true;
24489
+ node = null;
24490
+ continue
24491
+ }
24492
+
24493
+ for (let i = 1; i < matchedParameters.length; i++) {
24494
+ params.push(matchedParameters[i]);
24271
24495
  }
24272
24496
  } else {
24273
24497
  if (param.length > maxParamLength) {
24274
- return null
24498
+ maxParamLengthExceeded = true;
24499
+ node = null;
24500
+ continue
24275
24501
  }
24276
24502
  params.push(param);
24277
24503
  }
@@ -24312,6 +24538,18 @@ function requireFindMyWay () {
24312
24538
  }
24313
24539
  };
24314
24540
 
24541
+ Router.prototype._onMaxParamLength = function (path) {
24542
+ if (this.onMaxParamLength === null) {
24543
+ return null
24544
+ }
24545
+ const onMaxParamLength = this.onMaxParamLength;
24546
+ return {
24547
+ handler: (req, res, ctx) => onMaxParamLength(path, req, res),
24548
+ params: {},
24549
+ store: null
24550
+ }
24551
+ };
24552
+
24315
24553
  Router.prototype.prettyPrint = function (options = {}) {
24316
24554
  const method = options.method;
24317
24555
 
@@ -24363,6 +24601,9 @@ function requireFindMyWay () {
24363
24601
  return decoded.path
24364
24602
  };
24365
24603
 
24604
+ Router.removeDuplicateSlashes = removeDuplicateSlashes;
24605
+ Router.trimLastSlash = trimLastSlash;
24606
+
24366
24607
  findMyWay = Router;
24367
24608
 
24368
24609
  function escapeRegExp (string) {