@simulacrum/auth0-simulator 0.11.0 → 0.11.2

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.js CHANGED
@@ -9,7 +9,8 @@ import cookieSession from "cookie-session";
9
9
  import { assert } from "assert-ts";
10
10
  import { decode, encode } from "base64-url";
11
11
  import jsesc from "jsesc";
12
- import { decode as decode$1, sign } from "jsonwebtoken";
12
+ import * as jwt from "jsonwebtoken";
13
+ import { decode as decode$1 } from "jsonwebtoken";
13
14
  import vm from "vm";
14
15
  import { encode as encode$1 } from "html-entities";
15
16
  import { cosmiconfigSync } from "cosmiconfig";
@@ -65,8 +66,7 @@ const convertToObj = (arrayOfObjects, key$1 = "id") => arrayOfObjects.reduce((fi
65
66
  }, {});
66
67
  const convertInitialStateToStoreState = (initialState) => {
67
68
  if (!initialState) return void 0;
68
- const storeObject = { users: convertToObj(initialState.users, "id") };
69
- return storeObject;
69
+ return { users: convertToObj(initialState.users, "id") };
70
70
  };
71
71
 
72
72
  //#endregion
@@ -74,31 +74,35 @@ const convertInitialStateToStoreState = (initialState) => {
74
74
  const inputSchema = (initialState, extendedSchema) => ({ slice: slice$3 }) => {
75
75
  const storeInitialState = convertInitialStateToStoreState(initialState);
76
76
  const extended = extendedSchema ? extendedSchema({ slice: slice$3 }) : {};
77
- let slices = {
77
+ return {
78
78
  sessions: slice$3.table(),
79
79
  users: slice$3.table({ ...!storeInitialState ? { initialState: { [defaultUser.id]: defaultUser } } : { initialState: storeInitialState.users } }),
80
80
  ...extended
81
81
  };
82
- return slices;
83
82
  };
84
- const inputActions = (args) => {
83
+ const inputActions = (_args) => {
85
84
  return {};
86
85
  };
87
86
  const extendActions = (extendedActions) => (args) => {
88
- return extendedActions ? {
89
- ...inputActions(args),
90
- ...extendedActions(args)
91
- } : inputActions(args);
87
+ const base = inputActions(args);
88
+ if (!extendedActions) return base;
89
+ const extResult = extendedActions(args);
90
+ return {
91
+ ...base,
92
+ ...extResult
93
+ };
92
94
  };
93
- const inputSelectors = (args) => {
94
- const { createSelector, schema } = args;
95
+ const inputSelectors = (_args) => {
95
96
  return {};
96
97
  };
97
98
  const extendSelectors = (extendedSelectors) => (args) => {
98
- return extendedSelectors ? {
99
- ...inputSelectors(args),
100
- ...extendedSelectors(args)
101
- } : inputSelectors(args);
99
+ const base = inputSelectors(args);
100
+ if (!extendedSelectors) return base;
101
+ const extResult = extendedSelectors(args);
102
+ return {
103
+ ...base,
104
+ ...extResult
105
+ };
102
106
  };
103
107
  const extendStore = (initialState, extended) => ({
104
108
  actions: extendActions(extended?.actions),
@@ -177,9 +181,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
177
181
  */
178
182
  function depd(namespace) {
179
183
  if (!namespace) throw new TypeError("argument namespace is required");
180
- var stack = getStack();
181
- var site = callSiteLocation(stack[1]);
182
- var file = site[0];
184
+ var file = callSiteLocation(getStack()[1])[0];
183
185
  function deprecate$3(message) {
184
186
  log$1.call(deprecate$3, message);
185
187
  }
@@ -204,24 +206,21 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
204
206
  * @private
205
207
  */
206
208
  function eehaslisteners(emitter, type) {
207
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
208
- return count > 0;
209
+ return (typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type)) > 0;
209
210
  }
210
211
  /**
211
212
  * Determine if namespace is ignored.
212
213
  */
213
214
  function isignored(namespace) {
214
215
  if (process.noDeprecation) return true;
215
- var str = process.env.NO_DEPRECATION || "";
216
- return containsNamespace(str, namespace);
216
+ return containsNamespace(process.env.NO_DEPRECATION || "", namespace);
217
217
  }
218
218
  /**
219
219
  * Determine if namespace is traced.
220
220
  */
221
221
  function istraced(namespace) {
222
222
  if (process.traceDeprecation) return true;
223
- var str = process.env.TRACE_DEPRECATION || "";
224
- return containsNamespace(str, namespace);
223
+ return containsNamespace(process.env.TRACE_DEPRECATION || "", namespace);
225
224
  }
226
225
  /**
227
226
  * Display deprecation message.
@@ -264,8 +263,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
264
263
  process.emit("deprecation", err);
265
264
  return;
266
265
  }
267
- var format$4 = process.stderr.isTTY ? formatColor : formatPlain;
268
- var output = format$4.call(this, msg, caller, stack.slice(i$6));
266
+ var output = (process.stderr.isTTY ? formatColor : formatPlain).call(this, msg, caller, stack.slice(i$6));
269
267
  process.stderr.write(output + "\n", "utf8");
270
268
  }
271
269
  /**
@@ -302,8 +300,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
302
300
  * Format deprecation message without color.
303
301
  */
304
302
  function formatPlain(msg, caller, stack) {
305
- var timestamp = (/* @__PURE__ */ new Date()).toUTCString();
306
- var formatted = timestamp + " " + this._namespace + " deprecated " + msg;
303
+ var formatted = (/* @__PURE__ */ new Date()).toUTCString() + " " + this._namespace + " deprecated " + msg;
307
304
  if (this._traced) {
308
305
  for (var i$6 = 0; i$6 < stack.length; i$6++) formatted += "\n at " + stack[i$6].toString();
309
306
  return formatted;
@@ -356,11 +353,9 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
356
353
  function wrapfunction(fn, message) {
357
354
  if (typeof fn !== "function") throw new TypeError("argument fn must be a function");
358
355
  var args = createArgumentsString(fn.length);
359
- var stack = getStack();
360
- var site = callSiteLocation(stack[1]);
356
+ var site = callSiteLocation(getStack()[1]);
361
357
  site.name = fn.name;
362
- var deprecatedfn = new Function("fn", "log", "deprecate", "message", "site", "\"use strict\"\nreturn function (" + args + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn, log$1, this, message, site);
363
- return deprecatedfn;
358
+ return new Function("fn", "log", "deprecate", "message", "site", "\"use strict\"\nreturn function (" + args + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn, log$1, this, message, site);
364
359
  }
365
360
  /**
366
361
  * Wrap property in a deprecation message.
@@ -371,8 +366,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
371
366
  if (!descriptor) throw new TypeError("must call property on owner object");
372
367
  if (!descriptor.configurable) throw new TypeError("property must be configurable");
373
368
  var deprecate$3 = this;
374
- var stack = getStack();
375
- var site = callSiteLocation(stack[1]);
369
+ var site = callSiteLocation(getStack()[1]);
376
370
  site.name = prop;
377
371
  if ("value" in descriptor) descriptor = convertDataDescriptorToAccessor(obj, prop, message);
378
372
  var get = descriptor.get;
@@ -904,8 +898,7 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/ms/index.js":
904
898
  var match$1 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
905
899
  if (!match$1) return;
906
900
  var n = parseFloat(match$1[1]);
907
- var type = (match$1[2] || "ms").toLowerCase();
908
- switch (type) {
901
+ switch ((match$1[2] || "ms").toLowerCase()) {
909
902
  case "years":
910
903
  case "year":
911
904
  case "yrs":
@@ -937,7 +930,7 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/ms/index.js":
937
930
  case "msecs":
938
931
  case "msec":
939
932
  case "ms": return n;
940
- default: return void 0;
933
+ default: return;
941
934
  }
942
935
  }
943
936
  /**
@@ -1040,8 +1033,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/debug/src/
1040
1033
  if (!debug$11.enabled) return;
1041
1034
  const self = debug$11;
1042
1035
  const curr = Number(/* @__PURE__ */ new Date());
1043
- const ms$1 = curr - (prevTime || curr);
1044
- self.diff = ms$1;
1036
+ self.diff = curr - (prevTime || curr);
1045
1037
  self.prev = prevTime;
1046
1038
  self.curr = curr;
1047
1039
  prevTime = curr;
@@ -1061,8 +1053,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/debug/src/
1061
1053
  return match$1;
1062
1054
  });
1063
1055
  createDebug.formatArgs.call(self, args);
1064
- const logFn = self.log || createDebug.log;
1065
- logFn.apply(self, args);
1056
+ (self.log || createDebug.log).apply(self, args);
1066
1057
  }
1067
1058
  debug$11.namespace = namespace;
1068
1059
  debug$11.useColors = createDebug.useColors();
@@ -1434,7 +1425,7 @@ var require_supports_color = /* @__PURE__ */ __commonJS({ "../../node_modules/su
1434
1425
  "GITLAB_CI",
1435
1426
  "GITHUB_ACTIONS",
1436
1427
  "BUILDKITE"
1437
- ].some((sign$3) => sign$3 in env) || env.CI_NAME === "codeship") return 1;
1428
+ ].some((sign$2) => sign$2 in env) || env.CI_NAME === "codeship") return 1;
1438
1429
  return min$1;
1439
1430
  }
1440
1431
  if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
@@ -1452,8 +1443,7 @@ var require_supports_color = /* @__PURE__ */ __commonJS({ "../../node_modules/su
1452
1443
  return min$1;
1453
1444
  }
1454
1445
  function getSupportLevel(stream) {
1455
- const level = supportsColor(stream, stream && stream.isTTY);
1456
- return translateLevel(level);
1446
+ return translateLevel(supportsColor(stream, stream && stream.isTTY));
1457
1447
  }
1458
1448
  module.exports = {
1459
1449
  supportsColor: getSupportLevel,
@@ -1797,7 +1787,6 @@ var require_on_finished = /* @__PURE__ */ __commonJS({ "../../node_modules/on-fi
1797
1787
  var socket = msg.socket;
1798
1788
  if (typeof msg.finished === "boolean") return Boolean(msg.finished || socket && !socket.writable);
1799
1789
  if (typeof msg.complete === "boolean") return Boolean(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable);
1800
- return void 0;
1801
1790
  }
1802
1791
  /**
1803
1792
  * Attach a finished listener to the message.
@@ -1988,8 +1977,7 @@ var require_bytes = /* @__PURE__ */ __commonJS({ "../../node_modules/bytes/index
1988
1977
  else if (mag >= map.mb) unit = "MB";
1989
1978
  else if (mag >= map.kb) unit = "KB";
1990
1979
  else unit = "B";
1991
- var val = value / map[unit.toLowerCase()];
1992
- var str = val.toFixed(decimalPlaces);
1980
+ var str = (value / map[unit.toLowerCase()]).toFixed(decimalPlaces);
1993
1981
  if (!fixedDecimals) str = str.replace(formatDecimalsRegExp, "$1");
1994
1982
  if (thousandsSeparator) str = str.split(".").map(function(s$1, i$6) {
1995
1983
  return i$6 === 0 ? s$1.replace(formatThousandsRegExp, thousandsSeparator) : s$1;
@@ -10952,10 +10940,7 @@ var require_raw_body = /* @__PURE__ */ __commonJS({ "../../node_modules/raw-body
10952
10940
  received,
10953
10941
  type: "request.size.invalid"
10954
10942
  }));
10955
- else {
10956
- var string = decoder ? buffer$2 + (decoder.end() || "") : Buffer.concat(buffer$2);
10957
- done(null, string);
10958
- }
10943
+ else done(null, decoder ? buffer$2 + (decoder.end() || "") : Buffer.concat(buffer$2));
10959
10944
  }
10960
10945
  function cleanup() {
10961
10946
  buffer$2 = null;
@@ -27555,8 +27540,7 @@ var require_mimeScore = /* @__PURE__ */ __commonJS({ "../../node_modules/mime-ty
27555
27540
  module.exports = function mimeScore$1(mimeType, source = "default") {
27556
27541
  if (mimeType === "application/octet-stream") return 0;
27557
27542
  const [type, subtype] = mimeType.split("/");
27558
- const facet = subtype.replace(/(\.|x-).*/, "$1");
27559
- const facetScore = FACET_SCORES[facet] || FACET_SCORES.default;
27543
+ const facetScore = FACET_SCORES[subtype.replace(/(\.|x-).*/, "$1")] || FACET_SCORES.default;
27560
27544
  const sourceScore = SOURCE_SCORES[source] || SOURCE_SCORES.default;
27561
27545
  const typeScore = TYPE_SCORES[type] || TYPE_SCORES.default;
27562
27546
  const lengthScore = 1 - mimeType.length / 100;
@@ -27654,8 +27638,7 @@ var require_mime_types = /* @__PURE__ */ __commonJS({ "../../node_modules/mime-t
27654
27638
  */
27655
27639
  function populateMaps(extensions, types) {
27656
27640
  Object.keys(db).forEach(function forEachMimeType(type) {
27657
- var mime$5 = db[type];
27658
- var exts = mime$5.extensions;
27641
+ var exts = db[type].extensions;
27659
27642
  if (!exts || !exts.length) return;
27660
27643
  extensions[type] = exts;
27661
27644
  for (var i$6 = 0; i$6 < exts.length; i$6++) {
@@ -27671,9 +27654,7 @@ var require_mime_types = /* @__PURE__ */ __commonJS({ "../../node_modules/mime-t
27671
27654
  });
27672
27655
  }
27673
27656
  function _preferredType(ext, type0, type1) {
27674
- var score0 = type0 ? mimeScore(type0, db[type0].source) : 0;
27675
- var score1 = type1 ? mimeScore(type1, db[type1].source) : 0;
27676
- return score0 > score1 ? type0 : type1;
27657
+ return (type0 ? mimeScore(type0, db[type0].source) : 0) > (type1 ? mimeScore(type1, db[type1].source) : 0) ? type0 : type1;
27677
27658
  }
27678
27659
  function _preferredTypeLegacy(ext, type0, type1) {
27679
27660
  var SOURCE_RANK = [
@@ -27972,7 +27953,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/body-pars
27972
27953
  try {
27973
27954
  return (contentType$1.parse(req$2).parameters.charset || "").toLowerCase();
27974
27955
  } catch {
27975
- return void 0;
27956
+ return;
27976
27957
  }
27977
27958
  }
27978
27959
  /**
@@ -28000,12 +27981,11 @@ var require_utils$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/body-pars
28000
27981
  var type = options?.type || defaultType;
28001
27982
  var verify = options?.verify || false;
28002
27983
  if (verify !== false && typeof verify !== "function") throw new TypeError("option verify must be function");
28003
- var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
28004
27984
  return {
28005
27985
  inflate,
28006
27986
  limit: limit$1,
28007
27987
  verify,
28008
- shouldParse
27988
+ shouldParse: typeof type !== "function" ? typeChecker(type) : type
28009
27989
  };
28010
27990
  }
28011
27991
  }) });
@@ -28264,9 +28244,8 @@ var require_text = /* @__PURE__ */ __commonJS({ "../../node_modules/body-parser/
28264
28244
  next();
28265
28245
  return;
28266
28246
  }
28267
- var charset$1 = getCharset$1(req$2) || defaultCharset;
28268
28247
  read$1(req$2, res$2, next, parse$12, debug$8, {
28269
- encoding: charset$1,
28248
+ encoding: getCharset$1(req$2) || defaultCharset,
28270
28249
  inflate,
28271
28250
  limit: limit$1,
28272
28251
  verify
@@ -28299,12 +28278,9 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28299
28278
  var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
28300
28279
  var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null;
28301
28280
  var setForEach = hasSet && Set.prototype.forEach;
28302
- var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype;
28303
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
28304
- var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype;
28305
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
28306
- var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype;
28307
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
28281
+ var weakMapHas = typeof WeakMap === "function" && WeakMap.prototype ? WeakMap.prototype.has : null;
28282
+ var weakSetHas = typeof WeakSet === "function" && WeakSet.prototype ? WeakSet.prototype.has : null;
28283
+ var weakRefDeref = typeof WeakRef === "function" && WeakRef.prototype ? WeakRef.prototype.deref : null;
28308
28284
  var booleanValueOf = Boolean.prototype.valueOf;
28309
28285
  var objectToString = Object.prototype.toString;
28310
28286
  var functionToString = Function.prototype.toString;
@@ -28455,8 +28431,7 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28455
28431
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
28456
28432
  var protoTag = obj instanceof Object ? "" : "null prototype";
28457
28433
  var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
28458
- var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
28459
- var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
28434
+ var tag = (isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "") + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
28460
28435
  if (ys.length === 0) return tag + "{}";
28461
28436
  if (indent) return tag + "{" + indentedJoin(ys, indent) + "}";
28462
28437
  return tag + "{ " + $join.call(ys, ", ") + " }";
@@ -28464,8 +28439,7 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28464
28439
  return String(obj);
28465
28440
  };
28466
28441
  function wrapQuotes(s$1, defaultStyle, opts) {
28467
- var style = opts.quoteStyle || defaultStyle;
28468
- var quoteChar = quotes[style];
28442
+ var quoteChar = quotes[opts.quoteStyle || defaultStyle];
28469
28443
  return quoteChar + s$1 + quoteChar;
28470
28444
  }
28471
28445
  function quote(s$1) {
@@ -28606,8 +28580,7 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28606
28580
  }
28607
28581
  var quoteRE = quoteREs[opts.quoteStyle || "single"];
28608
28582
  quoteRE.lastIndex = 0;
28609
- var s$1 = $replace$1.call($replace$1.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
28610
- return wrapQuotes(s$1, "single", opts);
28583
+ return wrapQuotes($replace$1.call($replace$1.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte), "single", opts);
28611
28584
  }
28612
28585
  function lowbyte(c) {
28613
28586
  var n = c.charCodeAt(0);
@@ -28699,7 +28672,7 @@ var require_side_channel_list = /* @__PURE__ */ __commonJS({ "../../node_modules
28699
28672
  };
28700
28673
  /** @type {import('./list.d.ts').listGet} */
28701
28674
  var listGet = function(objects, key$1) {
28702
- if (!objects) return void 0;
28675
+ if (!objects) return;
28703
28676
  var node = listGetNode(objects, key$1);
28704
28677
  return node && node.value;
28705
28678
  };
@@ -28859,7 +28832,7 @@ var require_isNaN = /* @__PURE__ */ __commonJS({ "../../node_modules/math-intrin
28859
28832
  var require_sign = /* @__PURE__ */ __commonJS({ "../../node_modules/math-intrinsics/sign.js": ((exports, module) => {
28860
28833
  var $isNaN = require_isNaN();
28861
28834
  /** @type {import('./sign')} */
28862
- module.exports = function sign$3(number) {
28835
+ module.exports = function sign$2(number) {
28863
28836
  if ($isNaN(number) || number === 0) return number;
28864
28837
  return number < 0 ? -1 : 1;
28865
28838
  };
@@ -29129,7 +29102,7 @@ var require_get_intrinsic = /* @__PURE__ */ __commonJS({ "../../node_modules/get
29129
29102
  var min = require_min();
29130
29103
  var pow = require_pow();
29131
29104
  var round = require_round();
29132
- var sign$2 = require_sign();
29105
+ var sign$1 = require_sign();
29133
29106
  var $Function = Function;
29134
29107
  var getEvalledConstructor = function(expressionSyntax) {
29135
29108
  try {
@@ -29241,14 +29214,13 @@ var require_get_intrinsic = /* @__PURE__ */ __commonJS({ "../../node_modules/get
29241
29214
  "%Math.min%": min,
29242
29215
  "%Math.pow%": pow,
29243
29216
  "%Math.round%": round,
29244
- "%Math.sign%": sign$2,
29217
+ "%Math.sign%": sign$1,
29245
29218
  "%Reflect.getPrototypeOf%": $ReflectGPO
29246
29219
  };
29247
29220
  if (getProto) try {
29248
29221
  null.error;
29249
29222
  } catch (e) {
29250
- var errorProto = getProto(getProto(e));
29251
- INTRINSICS["%Error.prototype%"] = errorProto;
29223
+ INTRINSICS["%Error.prototype%"] = getProto(getProto(e));
29252
29224
  }
29253
29225
  var doEval = function doEval$1(name) {
29254
29226
  var value;
@@ -29421,7 +29393,7 @@ var require_get_intrinsic = /* @__PURE__ */ __commonJS({ "../../node_modules/get
29421
29393
  else if (value != null) {
29422
29394
  if (!(part in value)) {
29423
29395
  if (!allowMissing) throw new $TypeError$3("base intrinsic for " + name + " exists, but the property is not available.");
29424
- return void 0;
29396
+ return;
29425
29397
  }
29426
29398
  if ($gOPD && i$6 + 1 >= parts.length) {
29427
29399
  var desc$1 = $gOPD(value, part);
@@ -29525,7 +29497,7 @@ var require_side_channel_weakmap = /* @__PURE__ */ __commonJS({ "../../node_modu
29525
29497
  /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
29526
29498
  var $weakMapDelete = callBound("WeakMap.prototype.delete", true);
29527
29499
  /** @type {import('.')} */
29528
- module.exports = $WeakMap ? function getSideChannelWeakMap$1() {
29500
+ module.exports = $WeakMap ? function getSideChannelWeakMap() {
29529
29501
  /** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
29530
29502
  /** @typedef {Parameters<Channel['get']>[0]} K */
29531
29503
  /** @typedef {Parameters<Channel['set']>[1]} V */
@@ -29577,8 +29549,7 @@ var require_side_channel = /* @__PURE__ */ __commonJS({ "../../node_modules/side
29577
29549
  var inspect = require_object_inspect();
29578
29550
  var getSideChannelList = require_side_channel_list();
29579
29551
  var getSideChannelMap = require_side_channel_map();
29580
- var getSideChannelWeakMap = require_side_channel_weakmap();
29581
- var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
29552
+ var makeChannel = require_side_channel_weakmap() || getSideChannelMap || getSideChannelList;
29582
29553
  /** @type {import('.')} */
29583
29554
  module.exports = function getSideChannel$1() {
29584
29555
  /** @typedef {ReturnType<typeof getSideChannel>} Channel */
@@ -29873,10 +29844,7 @@ var require_stringify = /* @__PURE__ */ __commonJS({ "../../node_modules/qs/lib/
29873
29844
  obj = "";
29874
29845
  }
29875
29846
  if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
29876
- if (encoder) {
29877
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset$1, "key", format$4);
29878
- return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults$1.encoder, charset$1, "value", format$4))];
29879
- }
29847
+ if (encoder) return [formatter(encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset$1, "key", format$4)) + "=" + formatter(encoder(obj, defaults$1.encoder, charset$1, "value", format$4))];
29880
29848
  return [formatter(prefix) + "=" + formatter(String(obj))];
29881
29849
  }
29882
29850
  var values = [];
@@ -30129,9 +30097,8 @@ var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/qs/lib/pars
30129
30097
  var charset$1 = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
30130
30098
  var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
30131
30099
  if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") throw new TypeError("The duplicates option must be either combine, first, or last");
30132
- var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
30133
30100
  return {
30134
- allowDots,
30101
+ allowDots: typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots,
30135
30102
  allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
30136
30103
  allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
30137
30104
  allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
@@ -30510,7 +30477,7 @@ var require_parseurl = /* @__PURE__ */ __commonJS({ "../../node_modules/parseurl
30510
30477
  */
30511
30478
  function parseurl(req$2) {
30512
30479
  var url$2 = req$2.url;
30513
- if (url$2 === void 0) return void 0;
30480
+ if (url$2 === void 0) return;
30514
30481
  var parsed = req$2._parsedUrl;
30515
30482
  if (fresh$3(url$2, parsed)) return parsed;
30516
30483
  parsed = fastparse(url$2);
@@ -30776,8 +30743,7 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30776
30743
  * @private
30777
30744
  */
30778
30745
  function createHtmlDocument$2(message) {
30779
- var body = escapeHtml$3(message).replaceAll("\n", "<br>").replaceAll(" ", " &nbsp;");
30780
- return "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>" + body + "</pre>\n</body>\n</html>\n";
30746
+ return "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>" + escapeHtml$3(message).replaceAll("\n", "<br>").replaceAll(" ", " &nbsp;") + "</pre>\n</body>\n</html>\n";
30781
30747
  }
30782
30748
  /**
30783
30749
  * Module exports.
@@ -30832,7 +30798,7 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30832
30798
  * @private
30833
30799
  */
30834
30800
  function getErrorHeaders(err) {
30835
- if (!err.headers || typeof err.headers !== "object") return void 0;
30801
+ if (!err.headers || typeof err.headers !== "object") return;
30836
30802
  return { ...err.headers };
30837
30803
  }
30838
30804
  /**
@@ -30862,7 +30828,6 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30862
30828
  function getErrorStatusCode(err) {
30863
30829
  if (typeof err.status === "number" && err.status >= 400 && err.status < 600) return err.status;
30864
30830
  if (typeof err.statusCode === "number" && err.statusCode >= 400 && err.statusCode < 600) return err.statusCode;
30865
- return void 0;
30866
30831
  }
30867
30832
  /**
30868
30833
  * Get resource name for the request.
@@ -31059,7 +31024,7 @@ var require_view = /* @__PURE__ */ __commonJS({ "../../node_modules/express/lib/
31059
31024
  try {
31060
31025
  return fs$2.statSync(path$4);
31061
31026
  } catch (e) {
31062
- return void 0;
31027
+ return;
31063
31028
  }
31064
31029
  }
31065
31030
  }) });
@@ -31093,8 +31058,7 @@ var require_etag = /* @__PURE__ */ __commonJS({ "../../node_modules/etag/index.j
31093
31058
  function entitytag(entity) {
31094
31059
  if (entity.length === 0) return "\"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk\"";
31095
31060
  var hash = crypto$1.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
31096
- var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
31097
- return "\"" + len.toString(16) + "-" + hash + "\"";
31061
+ return "\"" + (typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length).toString(16) + "-" + hash + "\"";
31098
31062
  }
31099
31063
  /**
31100
31064
  * Create a simple ETag.
@@ -31133,8 +31097,7 @@ var require_etag = /* @__PURE__ */ __commonJS({ "../../node_modules/etag/index.j
31133
31097
  */
31134
31098
  function stattag(stat) {
31135
31099
  var mtime = stat.mtime.getTime().toString(16);
31136
- var size = stat.size.toString(16);
31137
- return "\"" + size + "-" + mtime + "\"";
31100
+ return "\"" + stat.size.toString(16) + "-" + mtime + "\"";
31138
31101
  }
31139
31102
  }) });
31140
31103
 
@@ -31156,9 +31119,7 @@ var require_forwarded = /* @__PURE__ */ __commonJS({ "../../node_modules/forward
31156
31119
  function forwarded$1(req$2) {
31157
31120
  if (!req$2) throw new TypeError("argument req is required");
31158
31121
  var proxyAddrs = parse$5(req$2.headers["x-forwarded-for"] || "");
31159
- var socketAddr = getSocketAddr(req$2);
31160
- var addrs = [socketAddr].concat(proxyAddrs);
31161
- return addrs;
31122
+ return [getSocketAddr(req$2)].concat(proxyAddrs);
31162
31123
  }
31163
31124
  /**
31164
31125
  * Get the socket address for a request.
@@ -31201,9 +31162,7 @@ var require_forwarded = /* @__PURE__ */ __commonJS({ "../../node_modules/forward
31201
31162
  //#region ../../node_modules/ipaddr.js/lib/ipaddr.js
31202
31163
  var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/lib/ipaddr.js": ((exports, module) => {
31203
31164
  (function() {
31204
- var expandIPv6, ipaddr$1, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root, zoneIndex;
31205
- ipaddr$1 = {};
31206
- root = this;
31165
+ var expandIPv6, ipaddr$1 = {}, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root = this, zoneIndex;
31207
31166
  if (typeof module !== "undefined" && module !== null && module.exports) module.exports = ipaddr$1;
31208
31167
  else root["ipaddr"] = ipaddr$1;
31209
31168
  matchCIDR = function(first$2, second, partSize, cidrBits) {
@@ -31365,8 +31324,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31365
31324
  return ipaddr$1.IPv6.parse("::ffff:" + this.toString());
31366
31325
  };
31367
31326
  IPv4.prototype.prefixLengthFromSubnetMask = function() {
31368
- var cidr, i$6, k, octet, stop, zeros, zerotable;
31369
- zerotable = {
31327
+ var cidr, i$6, k, octet, stop, zeros, zerotable = {
31370
31328
  0: 8,
31371
31329
  128: 7,
31372
31330
  192: 6,
@@ -31398,15 +31356,12 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31398
31356
  longValue: new RegExp("^" + ipv4Part + "$", "i")
31399
31357
  };
31400
31358
  ipaddr$1.IPv4.parser = function(string) {
31401
- var match$1, parseIntAuto, part, shift, value;
31402
- parseIntAuto = function(string$1) {
31359
+ var match$1, parseIntAuto = function(string$1) {
31403
31360
  if (string$1[0] === "0" && string$1[1] !== "x") return parseInt(string$1, 8);
31404
31361
  else return parseInt(string$1);
31405
- };
31362
+ }, part, shift, value;
31406
31363
  if (match$1 = string.match(ipv4Regexes.fourOctet)) return (function() {
31407
- var k, len, ref, results;
31408
- ref = match$1.slice(1, 6);
31409
- results = [];
31364
+ var k, len, ref = match$1.slice(1, 6), results = [];
31410
31365
  for (k = 0, len = ref.length; k < len; k++) {
31411
31366
  part = ref[k];
31412
31367
  results.push(parseIntAuto(part));
@@ -31417,8 +31372,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31417
31372
  value = parseIntAuto(match$1[1]);
31418
31373
  if (value > 4294967295 || value < 0) throw new Error("ipaddr: address outside defined range");
31419
31374
  return (function() {
31420
- var k, results;
31421
- results = [];
31375
+ var k, results = [];
31422
31376
  for (shift = k = 0; k <= 24; shift = k += 8) results.push(value >> shift & 255);
31423
31377
  return results;
31424
31378
  })().reverse();
@@ -31446,9 +31400,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31446
31400
  return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
31447
31401
  };
31448
31402
  IPv6.prototype.toRFC5952String = function() {
31449
- var bestMatchIndex, bestMatchLength, match$1, regex, string;
31450
- regex = /((^|:)(0(:|$)){2,})/g;
31451
- string = this.toNormalizedString();
31403
+ var bestMatchIndex, bestMatchLength, match$1, regex = /((^|:)(0(:|$)){2,})/g, string = this.toNormalizedString();
31452
31404
  bestMatchIndex = 0;
31453
31405
  bestMatchLength = -1;
31454
31406
  while (match$1 = regex.exec(string)) if (match$1[0].length > bestMatchLength) {
@@ -31459,9 +31411,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31459
31411
  return string.substring(0, bestMatchIndex) + "::" + string.substring(bestMatchIndex + bestMatchLength);
31460
31412
  };
31461
31413
  IPv6.prototype.toByteArray = function() {
31462
- var bytes$3, k, len, part, ref;
31463
- bytes$3 = [];
31464
- ref = this.parts;
31414
+ var bytes$3 = [], k, len, part, ref = this.parts;
31465
31415
  for (k = 0, len = ref.length; k < len; k++) {
31466
31416
  part = ref[k];
31467
31417
  bytes$3.push(part >> 8);
@@ -31470,34 +31420,26 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31470
31420
  return bytes$3;
31471
31421
  };
31472
31422
  IPv6.prototype.toNormalizedString = function() {
31473
- var addr, part, suffix;
31474
- addr = (function() {
31475
- var k, len, ref, results;
31476
- ref = this.parts;
31477
- results = [];
31423
+ var addr = (function() {
31424
+ var k, len, ref = this.parts, results = [];
31478
31425
  for (k = 0, len = ref.length; k < len; k++) {
31479
31426
  part = ref[k];
31480
31427
  results.push(part.toString(16));
31481
31428
  }
31482
31429
  return results;
31483
- }).call(this).join(":");
31484
- suffix = "";
31430
+ }).call(this).join(":"), part, suffix = "";
31485
31431
  if (this.zoneId) suffix = "%" + this.zoneId;
31486
31432
  return addr + suffix;
31487
31433
  };
31488
31434
  IPv6.prototype.toFixedLengthString = function() {
31489
- var addr, part, suffix;
31490
- addr = (function() {
31491
- var k, len, ref, results;
31492
- ref = this.parts;
31493
- results = [];
31435
+ var addr = (function() {
31436
+ var k, len, ref = this.parts, results = [];
31494
31437
  for (k = 0, len = ref.length; k < len; k++) {
31495
31438
  part = ref[k];
31496
31439
  results.push(part.toString(16).padStart(4, "0"));
31497
31440
  }
31498
31441
  return results;
31499
- }).call(this).join(":");
31500
- suffix = "";
31442
+ }).call(this).join(":"), part, suffix = "";
31501
31443
  if (this.zoneId) suffix = "%" + this.zoneId;
31502
31444
  return addr + suffix;
31503
31445
  };
@@ -31637,8 +31579,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31637
31579
  ]);
31638
31580
  };
31639
31581
  IPv6.prototype.prefixLengthFromSubnetMask = function() {
31640
- var cidr, i$6, k, part, stop, zeros, zerotable;
31641
- zerotable = {
31582
+ var cidr, i$6, k, part, stop, zeros, zerotable = {
31642
31583
  0: 16,
31643
31584
  32768: 15,
31644
31585
  49152: 14,
@@ -31700,9 +31641,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31700
31641
  if (string[0] === ":") string = string.slice(1);
31701
31642
  if (string[string.length - 1] === ":") string = string.slice(0, -1);
31702
31643
  parts = (function() {
31703
- var k, len, ref, results;
31704
- ref = string.split(":");
31705
- results = [];
31644
+ var k, len, ref = string.split(":"), results = [];
31706
31645
  for (k = 0, len = ref.length; k < len; k++) {
31707
31646
  part = ref[k];
31708
31647
  results.push(parseInt(part, 16));
@@ -31745,12 +31684,10 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31745
31684
  return this.parser(string) !== null;
31746
31685
  };
31747
31686
  ipaddr$1.IPv4.isValid = function(string) {
31748
- var e;
31749
31687
  try {
31750
31688
  new this(this.parser(string));
31751
31689
  return true;
31752
31690
  } catch (error1) {
31753
- e = error1;
31754
31691
  return false;
31755
31692
  }
31756
31693
  };
@@ -31759,26 +31696,23 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31759
31696
  else return false;
31760
31697
  };
31761
31698
  ipaddr$1.IPv6.isValid = function(string) {
31762
- var addr, e;
31699
+ var addr;
31763
31700
  if (typeof string === "string" && string.indexOf(":") === -1) return false;
31764
31701
  try {
31765
31702
  addr = this.parser(string);
31766
31703
  new this(addr.parts, addr.zoneId);
31767
31704
  return true;
31768
31705
  } catch (error1) {
31769
- e = error1;
31770
31706
  return false;
31771
31707
  }
31772
31708
  };
31773
31709
  ipaddr$1.IPv4.parse = function(string) {
31774
- var parts;
31775
- parts = this.parser(string);
31710
+ var parts = this.parser(string);
31776
31711
  if (parts === null) throw new Error("ipaddr: string is not formatted like ip address");
31777
31712
  return new this(parts);
31778
31713
  };
31779
31714
  ipaddr$1.IPv6.parse = function(string) {
31780
- var addr;
31781
- addr = this.parser(string);
31715
+ var addr = this.parser(string);
31782
31716
  if (addr.parts === null) throw new Error("ipaddr: string is not formatted like ip address");
31783
31717
  return new this(addr.parts, addr.zoneId);
31784
31718
  };
@@ -31816,7 +31750,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31816
31750
  return new this(octets);
31817
31751
  };
31818
31752
  ipaddr$1.IPv4.broadcastAddressFromCIDR = function(string) {
31819
- var cidr, error, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31753
+ var cidr, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31820
31754
  try {
31821
31755
  cidr = this.parseCIDR(string);
31822
31756
  ipInterfaceOctets = cidr[0].toByteArray();
@@ -31829,12 +31763,11 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31829
31763
  }
31830
31764
  return new this(octets);
31831
31765
  } catch (error1) {
31832
- error = error1;
31833
31766
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
31834
31767
  }
31835
31768
  };
31836
31769
  ipaddr$1.IPv4.networkAddressFromCIDR = function(string) {
31837
- var cidr, error, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31770
+ var cidr, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31838
31771
  try {
31839
31772
  cidr = this.parseCIDR(string);
31840
31773
  ipInterfaceOctets = cidr[0].toByteArray();
@@ -31847,7 +31780,6 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31847
31780
  }
31848
31781
  return new this(octets);
31849
31782
  } catch (error1) {
31850
- error = error1;
31851
31783
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
31852
31784
  }
31853
31785
  };
@@ -31874,29 +31806,24 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31874
31806
  else throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
31875
31807
  };
31876
31808
  ipaddr$1.parseCIDR = function(string) {
31877
- var e;
31878
31809
  try {
31879
31810
  return ipaddr$1.IPv6.parseCIDR(string);
31880
31811
  } catch (error1) {
31881
- e = error1;
31882
31812
  try {
31883
31813
  return ipaddr$1.IPv4.parseCIDR(string);
31884
31814
  } catch (error1$1) {
31885
- e = error1$1;
31886
31815
  throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
31887
31816
  }
31888
31817
  }
31889
31818
  };
31890
31819
  ipaddr$1.fromByteArray = function(bytes$3) {
31891
- var length;
31892
- length = bytes$3.length;
31820
+ var length = bytes$3.length;
31893
31821
  if (length === 4) return new ipaddr$1.IPv4(bytes$3);
31894
31822
  else if (length === 16) return new ipaddr$1.IPv6(bytes$3);
31895
31823
  else throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
31896
31824
  };
31897
31825
  ipaddr$1.process = function(string) {
31898
- var addr;
31899
- addr = this.parse(string);
31826
+ var addr = this.parse(string);
31900
31827
  if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) return addr.toIPv4Address();
31901
31828
  else return addr;
31902
31829
  };
@@ -32029,8 +31956,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32029
31956
  */
32030
31957
  function parseNetmask(netmask) {
32031
31958
  var ip = parseip(netmask);
32032
- var kind = ip.kind();
32033
- return kind === "ipv4" ? ip.prefixLengthFromSubnetMask() : null;
31959
+ return ip.kind() === "ipv4" ? ip.prefixLengthFromSubnetMask() : null;
32034
31960
  }
32035
31961
  /**
32036
31962
  * Determine address of proxied request.
@@ -32043,8 +31969,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32043
31969
  if (!req$2) throw new TypeError("req argument is required");
32044
31970
  if (!trust) throw new TypeError("trust argument is required");
32045
31971
  var addrs = alladdrs(req$2, trust);
32046
- var addr = addrs[addrs.length - 1];
32047
- return addr;
31972
+ return addrs[addrs.length - 1];
32048
31973
  }
32049
31974
  /**
32050
31975
  * Static trust function to trust nothing.
@@ -32096,8 +32021,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32096
32021
  return function trust(addr) {
32097
32022
  if (!isip(addr)) return false;
32098
32023
  var ip = parseip(addr);
32099
- var kind = ip.kind();
32100
- if (kind !== subnetkind) {
32024
+ if (ip.kind() !== subnetkind) {
32101
32025
  if (subnetisipv4 && !ip.isIPv4MappedAddress()) return false;
32102
32026
  ip = subnetisipv4 ? ip.toIPv4Address() : ip.toIPv4MappedAddress();
32103
32027
  }
@@ -32290,8 +32214,7 @@ var require_utils = /* @__PURE__ */ __commonJS({ "../../node_modules/express/lib
32290
32214
  */
32291
32215
  function createETagGenerator(options) {
32292
32216
  return function generateETag(body, encoding) {
32293
- var buf = !Buffer.isBuffer(body) ? Buffer.from(body, encoding) : body;
32294
- return etag$1(buf, options);
32217
+ return etag$1(!Buffer.isBuffer(body) ? Buffer.from(body, encoding) : body, options);
32295
32218
  };
32296
32219
  }
32297
32220
  /**
@@ -32365,8 +32288,7 @@ var require_once = /* @__PURE__ */ __commonJS({ "../../node_modules/once/once.js
32365
32288
  f.called = true;
32366
32289
  return f.value = fn.apply(this, arguments);
32367
32290
  };
32368
- var name = fn.name || "Function wrapped with `once`";
32369
- f.onceError = name + " shouldn't be called more than once";
32291
+ f.onceError = (fn.name || "Function wrapped with `once`") + " shouldn't be called more than once";
32370
32292
  f.called = false;
32371
32293
  return f;
32372
32294
  }
@@ -32386,7 +32308,6 @@ var require_is_promise = /* @__PURE__ */ __commonJS({ "../../node_modules/is-pro
32386
32308
  //#region ../../node_modules/path-to-regexp/dist/index.js
32387
32309
  var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-regexp/dist/index.js": ((exports) => {
32388
32310
  Object.defineProperty(exports, "__esModule", { value: true });
32389
- exports.PathError = exports.TokenData = void 0;
32390
32311
  exports.parse = parse$4;
32391
32312
  exports.compile = compile;
32392
32313
  exports.match = match;
@@ -32549,8 +32470,7 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-rege
32549
32470
  */
32550
32471
  function compile(path$4, options = {}) {
32551
32472
  const { encode: encode$3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
32552
- const data = typeof path$4 === "object" ? path$4 : parse$4(path$4, options);
32553
- const fn = tokensToFunction(data.tokens, delimiter, encode$3);
32473
+ const fn = tokensToFunction((typeof path$4 === "object" ? path$4 : parse$4(path$4, options)).tokens, delimiter, encode$3);
32554
32474
  return function path$5(params = {}) {
32555
32475
  const [path$6, ...missing] = fn(params);
32556
32476
  if (missing.length) throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
@@ -32639,9 +32559,8 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-rege
32639
32559
  let pattern = `^(?:${sources.join("|")})`;
32640
32560
  if (trailing) pattern += `(?:${escape$1(delimiter)}$)?`;
32641
32561
  pattern += end ? "$" : `(?=${escape$1(delimiter)}|$)`;
32642
- const regexp = new RegExp(pattern, flags);
32643
32562
  return {
32644
- regexp,
32563
+ regexp: new RegExp(pattern, flags),
32645
32564
  keys
32646
32565
  };
32647
32566
  }
@@ -32707,8 +32626,7 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-rege
32707
32626
  let value = "";
32708
32627
  let i$6 = 0;
32709
32628
  function name(value$1) {
32710
- const isSafe = isNameSafe(value$1) && isNextNameSafe(tokens[i$6]);
32711
- return isSafe ? value$1 : JSON.stringify(value$1);
32629
+ return isNameSafe(value$1) && isNextNameSafe(tokens[i$6]) ? value$1 : JSON.stringify(value$1);
32712
32630
  }
32713
32631
  while (i$6 < tokens.length) {
32714
32632
  const token = tokens[i$6++];
@@ -32799,8 +32717,7 @@ var require_layer = /* @__PURE__ */ __commonJS({ "../../node_modules/router/lib/
32799
32717
  if (!match$1) return false;
32800
32718
  const params = {};
32801
32719
  for (let i$6 = 1; i$6 < match$1.length; i$6++) {
32802
- const key$1 = keys[i$6 - 1];
32803
- const prop = key$1.name;
32720
+ const prop = keys[i$6 - 1].name;
32804
32721
  const val = decodeParam(match$1[i$6]);
32805
32722
  if (val !== void 0) params[prop] = val;
32806
32723
  }
@@ -33093,7 +33010,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33093
33010
  /**
33094
33011
  * Expose `Router`.
33095
33012
  */
33096
- module.exports = Router$2;
33013
+ module.exports = Router$3;
33097
33014
  /**
33098
33015
  * Expose `Route`.
33099
33016
  */
@@ -33105,8 +33022,8 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33105
33022
  * @return {Router} which is a callable function
33106
33023
  * @public
33107
33024
  */
33108
- function Router$2(options) {
33109
- if (!(this instanceof Router$2)) return new Router$2(options);
33025
+ function Router$3(options) {
33026
+ if (!(this instanceof Router$3)) return new Router$3(options);
33110
33027
  const opts = options || {};
33111
33028
  function router(req$2, res$2, next) {
33112
33029
  router.handle(req$2, res$2, next);
@@ -33123,7 +33040,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33123
33040
  * Router prototype inherits from a Function.
33124
33041
  */
33125
33042
  /* istanbul ignore next */
33126
- Router$2.prototype = function() {};
33043
+ Router$3.prototype = function() {};
33127
33044
  /**
33128
33045
  * Map the given param placeholder `name`(s) to the given callback.
33129
33046
  *
@@ -33156,7 +33073,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33156
33073
  * @param {function} fn
33157
33074
  * @public
33158
33075
  */
33159
- Router$2.prototype.param = function param(name, fn) {
33076
+ Router$3.prototype.param = function param(name, fn) {
33160
33077
  if (!name) throw new TypeError("argument name is required");
33161
33078
  if (typeof name !== "string") throw new TypeError("argument name must be a string");
33162
33079
  if (!fn) throw new TypeError("argument fn is required");
@@ -33171,7 +33088,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33171
33088
  *
33172
33089
  * @private
33173
33090
  */
33174
- Router$2.prototype.handle = function handle(req$2, res$2, callback) {
33091
+ Router$3.prototype.handle = function handle(req$2, res$2, callback) {
33175
33092
  if (!callback) throw new TypeError("argument callback is required");
33176
33093
  debug$2("dispatching %s %s", req$2.method, req$2.url);
33177
33094
  let idx = 0;
@@ -33285,7 +33202,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33285
33202
  *
33286
33203
  * @public
33287
33204
  */
33288
- Router$2.prototype.use = function use(handler) {
33205
+ Router$3.prototype.use = function use(handler) {
33289
33206
  let offset = 0;
33290
33207
  let path$4 = "/";
33291
33208
  if (typeof handler !== "function") {
@@ -33324,7 +33241,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33324
33241
  * @return {Route}
33325
33242
  * @public
33326
33243
  */
33327
- Router$2.prototype.route = function route(path$4) {
33244
+ Router$3.prototype.route = function route(path$4) {
33328
33245
  const route$1 = new Route(path$4);
33329
33246
  const layer = new Layer(path$4, {
33330
33247
  sensitive: this.caseSensitive,
@@ -33339,7 +33256,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33339
33256
  return route$1;
33340
33257
  };
33341
33258
  methods$1.concat("all").forEach(function(method) {
33342
- Router$2.prototype[method] = function(path$4) {
33259
+ Router$3.prototype[method] = function(path$4) {
33343
33260
  const route = this.route(path$4);
33344
33261
  route[method].apply(route, slice$1.call(arguments, 1));
33345
33262
  return this;
@@ -33368,7 +33285,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33368
33285
  try {
33369
33286
  return parseUrl$1(req$2).pathname;
33370
33287
  } catch (err) {
33371
- return void 0;
33288
+ return;
33372
33289
  }
33373
33290
  }
33374
33291
  /**
@@ -33378,7 +33295,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33378
33295
  * @private
33379
33296
  */
33380
33297
  function getProtohost(url$2) {
33381
- if (typeof url$2 !== "string" || url$2.length === 0 || url$2[0] === "/") return void 0;
33298
+ if (typeof url$2 !== "string" || url$2.length === 0 || url$2[0] === "/") return;
33382
33299
  const searchIndex = url$2.indexOf("?");
33383
33300
  const pathLength = searchIndex !== -1 ? searchIndex : url$2.length;
33384
33301
  const fqdnIndex = url$2.substring(0, pathLength).indexOf("://");
@@ -33550,7 +33467,7 @@ var require_application = /* @__PURE__ */ __commonJS({ "../../node_modules/expre
33550
33467
  var compileTrust = require_utils().compileTrust;
33551
33468
  var resolve$3 = __require("node:path").resolve;
33552
33469
  var once = require_once();
33553
- var Router$1 = require_router();
33470
+ var Router$2 = require_router();
33554
33471
  /**
33555
33472
  * Module variables.
33556
33473
  * @private
@@ -33585,7 +33502,7 @@ var require_application = /* @__PURE__ */ __commonJS({ "../../node_modules/expre
33585
33502
  configurable: true,
33586
33503
  enumerable: true,
33587
33504
  get: function getrouter() {
33588
- if (router === null) router = new Router$1({
33505
+ if (router === null) router = new Router$2({
33589
33506
  caseSensitive: this.enabled("case sensitive routing"),
33590
33507
  strict: this.enabled("strict routing")
33591
33508
  });
@@ -33924,8 +33841,7 @@ var require_application = /* @__PURE__ */ __commonJS({ "../../node_modules/expre
33924
33841
  if (renderOptions.cache == null) renderOptions.cache = this.enabled("view cache");
33925
33842
  if (renderOptions.cache) view = cache[name];
33926
33843
  if (!view) {
33927
- var View$2 = this.get("view");
33928
- view = new View$2(name, {
33844
+ view = new (this.get("view"))(name, {
33929
33845
  defaultEngine: this.get("view engine"),
33930
33846
  root: this.get("views"),
33931
33847
  engines
@@ -34702,8 +34618,7 @@ var require_accepts = /* @__PURE__ */ __commonJS({ "../../node_modules/accepts/i
34702
34618
  if (!types || types.length === 0) return this.negotiator.mediaTypes();
34703
34619
  if (!this.headers.accept) return types[0];
34704
34620
  var mimes = types.map(extToMime);
34705
- var accepts$1 = this.negotiator.mediaTypes(mimes.filter(validMime));
34706
- var first$2 = accepts$1[0];
34621
+ var first$2 = this.negotiator.mediaTypes(mimes.filter(validMime))[0];
34707
34622
  return first$2 ? types[mimes.indexOf(first$2)] : false;
34708
34623
  };
34709
34624
  /**
@@ -34831,8 +34746,7 @@ var require_fresh = /* @__PURE__ */ __commonJS({ "../../node_modules/fresh/index
34831
34746
  }
34832
34747
  if (modifiedSince) {
34833
34748
  var lastModified = resHeaders["last-modified"];
34834
- var modifiedStale = !lastModified || !(parseHttpDate$1(lastModified) <= parseHttpDate$1(modifiedSince));
34835
- if (modifiedStale) return false;
34749
+ if (!lastModified || !(parseHttpDate$1(lastModified) <= parseHttpDate$1(modifiedSince))) return false;
34836
34750
  }
34837
34751
  return true;
34838
34752
  }
@@ -35207,8 +35121,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35207
35121
  */
35208
35122
  defineGetter(req$1, "protocol", function protocol() {
35209
35123
  var proto$1 = this.connection.encrypted ? "https" : "http";
35210
- var trust = this.app.get("trust proxy fn");
35211
- if (!trust(this.connection.remoteAddress, 0)) return proto$1;
35124
+ if (!this.app.get("trust proxy fn")(this.connection.remoteAddress, 0)) return proto$1;
35212
35125
  var header = this.get("X-Forwarded-Proto") || proto$1;
35213
35126
  var index = header.indexOf(",");
35214
35127
  return index !== -1 ? header.substring(0, index).trim() : header.trim();
@@ -35272,8 +35185,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35272
35185
  var hostname = this.hostname;
35273
35186
  if (!hostname) return [];
35274
35187
  var offset = this.app.get("subdomain offset");
35275
- var subdomains$1 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
35276
- return subdomains$1.slice(offset);
35188
+ return (!isIP(hostname) ? hostname.split(".").reverse() : [hostname]).slice(offset);
35277
35189
  });
35278
35190
  /**
35279
35191
  * Short-hand for `url.parse(req.url).pathname`.
@@ -35355,8 +35267,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35355
35267
  * @public
35356
35268
  */
35357
35269
  defineGetter(req$1, "xhr", function xhr() {
35358
- var val = this.get("X-Requested-With") || "";
35359
- return val.toLowerCase() === "xmlhttprequest";
35270
+ return (this.get("X-Requested-With") || "").toLowerCase() === "xmlhttprequest";
35360
35271
  });
35361
35272
  /**
35362
35273
  * Helper function for creating a getter on an object.
@@ -35535,9 +35446,7 @@ var require_content_disposition = /* @__PURE__ */ __commonJS({ "../../node_modul
35535
35446
  */
35536
35447
  function contentDisposition$1(filename, options) {
35537
35448
  var opts = options || {};
35538
- var type = opts.type || "attachment";
35539
- var params = createparams(filename, opts.fallback);
35540
- return format(new ContentDisposition(type, params));
35449
+ return format(new ContentDisposition(opts.type || "attachment", createparams(filename, opts.fallback)));
35541
35450
  }
35542
35451
  /**
35543
35452
  * Create parameters object from filename and fallback.
@@ -35690,8 +35599,7 @@ var require_content_disposition = /* @__PURE__ */ __commonJS({ "../../node_modul
35690
35599
  * @private
35691
35600
  */
35692
35601
  function qstring(val) {
35693
- var str = String(val);
35694
- return "\"" + str.replace(QUOTE_REGEXP, "\\$1") + "\"";
35602
+ return "\"" + String(val).replace(QUOTE_REGEXP, "\\$1") + "\"";
35695
35603
  }
35696
35604
  /**
35697
35605
  * Encode a Unicode string for HTTP (RFC 5987).
@@ -35702,8 +35610,7 @@ var require_content_disposition = /* @__PURE__ */ __commonJS({ "../../node_modul
35702
35610
  */
35703
35611
  function ustring(val) {
35704
35612
  var str = String(val);
35705
- var encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
35706
- return "UTF-8''" + encoded;
35613
+ return "UTF-8''" + encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
35707
35614
  }
35708
35615
  /**
35709
35616
  * Class for parsed Content-Disposition header for v8 optimization
@@ -35864,8 +35771,7 @@ var require_cookie = /* @__PURE__ */ __commonJS({ "../../node_modules/cookie/ind
35864
35771
  valStartIdx++;
35865
35772
  valEndIdx--;
35866
35773
  }
35867
- var val = str.slice(valStartIdx, valEndIdx);
35868
- obj[key$1] = tryDecode(val, dec);
35774
+ obj[key$1] = tryDecode(str.slice(valStartIdx, valEndIdx), dec);
35869
35775
  }
35870
35776
  index = endIdx + 1;
35871
35777
  } while (index < len);
@@ -35929,38 +35835,32 @@ var require_cookie = /* @__PURE__ */ __commonJS({ "../../node_modules/cookie/ind
35929
35835
  if (opt.httpOnly) str += "; HttpOnly";
35930
35836
  if (opt.secure) str += "; Secure";
35931
35837
  if (opt.partitioned) str += "; Partitioned";
35932
- if (opt.priority) {
35933
- var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
35934
- switch (priority) {
35935
- case "low":
35936
- str += "; Priority=Low";
35937
- break;
35938
- case "medium":
35939
- str += "; Priority=Medium";
35940
- break;
35941
- case "high":
35942
- str += "; Priority=High";
35943
- break;
35944
- default: throw new TypeError("option priority is invalid");
35945
- }
35838
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
35839
+ case "low":
35840
+ str += "; Priority=Low";
35841
+ break;
35842
+ case "medium":
35843
+ str += "; Priority=Medium";
35844
+ break;
35845
+ case "high":
35846
+ str += "; Priority=High";
35847
+ break;
35848
+ default: throw new TypeError("option priority is invalid");
35946
35849
  }
35947
- if (opt.sameSite) {
35948
- var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
35949
- switch (sameSite) {
35950
- case true:
35951
- str += "; SameSite=Strict";
35952
- break;
35953
- case "lax":
35954
- str += "; SameSite=Lax";
35955
- break;
35956
- case "strict":
35957
- str += "; SameSite=Strict";
35958
- break;
35959
- case "none":
35960
- str += "; SameSite=None";
35961
- break;
35962
- default: throw new TypeError("option sameSite is invalid");
35963
- }
35850
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
35851
+ case true:
35852
+ str += "; SameSite=Strict";
35853
+ break;
35854
+ case "lax":
35855
+ str += "; SameSite=Lax";
35856
+ break;
35857
+ case "strict":
35858
+ str += "; SameSite=Strict";
35859
+ break;
35860
+ case "none":
35861
+ str += "; SameSite=None";
35862
+ break;
35863
+ default: throw new TypeError("option sameSite is invalid");
35964
35864
  }
35965
35865
  return str;
35966
35866
  }
@@ -36103,8 +36003,7 @@ var require_send = /* @__PURE__ */ __commonJS({ "../../node_modules/send/index.j
36103
36003
  SendStream.prototype.error = function error(status$2, err) {
36104
36004
  if (hasListeners(this, "error")) return this.emit("error", createHttpError(status$2, err));
36105
36005
  var res$2 = this.res;
36106
- var msg = statuses$1.message[status$2] || String(status$2);
36107
- var doc = createHtmlDocument$1("Error", escapeHtml$2(msg));
36006
+ var doc = createHtmlDocument$1("Error", escapeHtml$2(statuses$1.message[status$2] || String(status$2)));
36108
36007
  clearHeaders(res$2);
36109
36008
  if (err && err.headers) setHeaders(res$2, err.headers);
36110
36009
  res$2.statusCode = status$2;
@@ -36244,8 +36143,7 @@ var require_send = /* @__PURE__ */ __commonJS({ "../../node_modules/send/index.j
36244
36143
  var etag$3 = this.res.getHeader("ETag");
36245
36144
  return Boolean(etag$3 && ifRange.indexOf(etag$3) !== -1);
36246
36145
  }
36247
- var lastModified = this.res.getHeader("Last-Modified");
36248
- return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
36146
+ return parseHttpDate(this.res.getHeader("Last-Modified")) <= parseHttpDate(ifRange);
36249
36147
  };
36250
36148
  /**
36251
36149
  * Redirect to path.
@@ -36614,8 +36512,7 @@ var require_send = /* @__PURE__ */ __commonJS({ "../../node_modules/send/index.j
36614
36512
  * @private
36615
36513
  */
36616
36514
  function hasListeners(emitter, type) {
36617
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
36618
- return count > 0;
36515
+ return (typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type)) > 0;
36619
36516
  }
36620
36517
  /**
36621
36518
  * Normalize the index option into an array.
@@ -36761,8 +36658,7 @@ var require_vary = /* @__PURE__ */ __commonJS({ "../../node_modules/vary/index.j
36761
36658
  function vary$1(res$2, field) {
36762
36659
  if (!res$2 || !res$2.getHeader || !res$2.setHeader) throw new TypeError("res argument is required");
36763
36660
  var val = res$2.getHeader("Vary") || "";
36764
- var header = Array.isArray(val) ? val.join(", ") : String(val);
36765
- if (val = append(header, field)) res$2.setHeader("Vary", val);
36661
+ if (val = append(Array.isArray(val) ? val.join(", ") : String(val), field)) res$2.setHeader("Vary", val);
36766
36662
  }
36767
36663
  }) });
36768
36664
 
@@ -36783,7 +36679,7 @@ var require_response = /* @__PURE__ */ __commonJS({ "../../node_modules/express/
36783
36679
  var path$1 = __require("node:path");
36784
36680
  var pathIsAbsolute = __require("node:path").isAbsolute;
36785
36681
  var statuses = require_statuses();
36786
- var sign$1 = require_cookie_signature().sign;
36682
+ var sign = require_cookie_signature().sign;
36787
36683
  var normalizeType = require_utils().normalizeType;
36788
36684
  var normalizeTypes = require_utils().normalizeTypes;
36789
36685
  var setCharset = require_utils().setCharset;
@@ -36931,9 +36827,7 @@ var require_response = /* @__PURE__ */ __commonJS({ "../../node_modules/express/
36931
36827
  res$1.json = function json$1(obj) {
36932
36828
  var app$1 = this.app;
36933
36829
  var escape$2 = app$1.get("json escape");
36934
- var replacer = app$1.get("json replacer");
36935
- var spaces = app$1.get("json spaces");
36936
- var body = stringify$1(obj, replacer, spaces, escape$2);
36830
+ var body = stringify$1(obj, app$1.get("json replacer"), app$1.get("json spaces"), escape$2);
36937
36831
  if (!this.get("Content-Type")) this.set("Content-Type", "application/json");
36938
36832
  return this.send(body);
36939
36833
  };
@@ -36951,9 +36845,7 @@ var require_response = /* @__PURE__ */ __commonJS({ "../../node_modules/express/
36951
36845
  res$1.jsonp = function jsonp(obj) {
36952
36846
  var app$1 = this.app;
36953
36847
  var escape$2 = app$1.get("json escape");
36954
- var replacer = app$1.get("json replacer");
36955
- var spaces = app$1.get("json spaces");
36956
- var body = stringify$1(obj, replacer, spaces, escape$2);
36848
+ var body = stringify$1(obj, app$1.get("json replacer"), app$1.get("json spaces"), escape$2);
36957
36849
  var callback = this.req.query[app$1.get("jsonp callback name")];
36958
36850
  if (!this.get("Content-Type")) {
36959
36851
  this.set("X-Content-Type-Options", "nosniff");
@@ -37045,8 +36937,7 @@ var require_response = /* @__PURE__ */ __commonJS({ "../../node_modules/express/
37045
36937
  if (!opts.root && !pathIsAbsolute(path$4)) throw new TypeError("path must be absolute or specify root to res.sendFile");
37046
36938
  var pathname = encodeURI(path$4);
37047
36939
  opts.etag = this.app.enabled("etag");
37048
- var file = send$1(req$2, pathname, opts);
37049
- sendfile(res$2, file, opts, function(err) {
36940
+ sendfile(res$2, send$1(req$2, pathname, opts), opts, function(err) {
37050
36941
  if (done) return done(err);
37051
36942
  if (err && err.code === "EISDIR") return next();
37052
36943
  if (err && err.code !== "ECONNABORTED" && err.syscall !== "write") next(err);
@@ -37312,7 +37203,7 @@ var require_response = /* @__PURE__ */ __commonJS({ "../../node_modules/express/
37312
37203
  var signed = opts.signed;
37313
37204
  if (signed && !secret) throw new Error("cookieParser(\"secret\") required for signed cookies");
37314
37205
  var val = typeof value === "object" ? "j:" + JSON.stringify(value) : String(value);
37315
- if (signed) val = "s:" + sign$1(val, secret);
37206
+ if (signed) val = "s:" + sign(val, secret);
37316
37207
  if (opts.maxAge != null) {
37317
37208
  var maxAge = opts.maxAge - 0;
37318
37209
  if (!isNaN(maxAge)) {
@@ -37638,7 +37529,7 @@ var require_express$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/express
37638
37529
  var EventEmitter = __require("node:events").EventEmitter;
37639
37530
  var mixin = require_merge_descriptors();
37640
37531
  var proto = require_application();
37641
- var Router = require_router();
37532
+ var Router$1 = require_router();
37642
37533
  var req = require_request();
37643
37534
  var res = require_response();
37644
37535
  /**
@@ -37681,8 +37572,8 @@ var require_express$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/express
37681
37572
  /**
37682
37573
  * Expose constructors.
37683
37574
  */
37684
- exports.Route = Router.Route;
37685
- exports.Router = Router;
37575
+ exports.Route = Router$1.Route;
37576
+ exports.Router = Router$1;
37686
37577
  /**
37687
37578
  * Expose middleware
37688
37579
  */
@@ -37717,10 +37608,9 @@ var require_object_assign = /* @__PURE__ */ __commonJS({ "../../node_modules/obj
37717
37608
  if (Object.getOwnPropertyNames(test1)[0] === "5") return false;
37718
37609
  var test2 = {};
37719
37610
  for (var i$6 = 0; i$6 < 10; i$6++) test2["_" + String.fromCharCode(i$6)] = i$6;
37720
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
37611
+ if (Object.getOwnPropertyNames(test2).map(function(n) {
37721
37612
  return test2[n];
37722
- });
37723
- if (order2.join("") !== "0123456789") return false;
37613
+ }).join("") !== "0123456789") return false;
37724
37614
  var test3 = {};
37725
37615
  "abcdefghijklmnopqrst".split("").forEach(function(letter) {
37726
37616
  test3[letter] = letter;
@@ -37858,8 +37748,8 @@ var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/cors/lib/inde
37858
37748
  }
37859
37749
  }
37860
37750
  function cors$1(options, req$2, res$2, next) {
37861
- var headers = [], method = req$2.method && req$2.method.toUpperCase && req$2.method.toUpperCase();
37862
- if (method === "OPTIONS") {
37751
+ var headers = [];
37752
+ if ((req$2.method && req$2.method.toUpperCase && req$2.method.toUpperCase()) === "OPTIONS") {
37863
37753
  headers.push(configureOrigin(options, req$2));
37864
37754
  headers.push(configureCredentials(options, req$2));
37865
37755
  headers.push(configureMethods(options, req$2));
@@ -37951,8 +37841,7 @@ const createSession = () => {
37951
37841
  //#region src/middleware/error-handling.ts
37952
37842
  function defaultErrorHandler(error, _req, res$2, next) {
37953
37843
  if (res$2.headersSent) return next(error);
37954
- let assertCondition = "Assert condition failed: ";
37955
- if (error?.message?.startsWith(assertCondition)) {
37844
+ if (error?.message?.startsWith("Assert condition failed: ")) {
37956
37845
  let errorCode = 500;
37957
37846
  let errorResponse = error.message;
37958
37847
  if (error.message.includes("::")) {
@@ -38072,8 +37961,7 @@ const createWebMessageHandler = () => function(req$2, res$2) {
38072
37961
  //#endregion
38073
37962
  //#region src/handlers/utils.ts
38074
37963
  const createPersonQuery = (store) => (predicate) => {
38075
- const users = store.schema.users.selectTableAsList(store.store.getState());
38076
- return users.find(predicate);
37964
+ return store.schema.users.selectTableAsList(store.store.getState()).find(predicate);
38077
37965
  };
38078
37966
  const deriveScope = ({ scopeConfig, clientID, audience }) => {
38079
37967
  if (typeof scopeConfig === "string") return scopeConfig;
@@ -38257,7 +38145,7 @@ function createJsonWebToken(payload, privateKey = parseKey(PRIVATE_KEY), options
38257
38145
  algorithm: "RS256",
38258
38146
  keyid: JWKS.keys[0].kid
38259
38147
  }) {
38260
- return sign(payload, privateKey, options);
38148
+ return jwt.sign(payload, privateKey, options);
38261
38149
  }
38262
38150
 
38263
38151
  //#endregion
@@ -38267,17 +38155,15 @@ const extensionlessFileName = (fileName) => fileName.indexOf(".") === -1 ? fileN
38267
38155
  //#endregion
38268
38156
  //#region src/rules/parse-rules-files.ts
38269
38157
  function parseRulesFiles(rulesPath) {
38270
- let ruleFiles = fs.readdirSync(rulesPath).filter((f) => path.extname(f) === ".js");
38271
- return ruleFiles.map((r) => {
38158
+ return fs.readdirSync(rulesPath).filter((f) => path.extname(f) === ".js").map((r) => {
38272
38159
  let filename = path.join(rulesPath, r);
38273
38160
  let jsonFile = `${extensionlessFileName(filename)}.json`;
38274
38161
  assert(!!jsonFile, `no corresponding rule file for ${r}`);
38275
38162
  let rawRule = fs.readFileSync(jsonFile, "utf8");
38276
38163
  let { enabled, order = 0, stage = "login_success" } = JSON.parse(rawRule);
38277
- if (!enabled) return void 0;
38278
- let code = fs.readFileSync(filename, { encoding: "utf-8" });
38164
+ if (!enabled) return;
38279
38165
  return {
38280
- code,
38166
+ code: fs.readFileSync(filename, { encoding: "utf-8" }),
38281
38167
  filename,
38282
38168
  order,
38283
38169
  stage
@@ -38312,7 +38198,7 @@ async function runRule(user, context, rule) {
38312
38198
  assert(typeof rule !== "undefined", "undefined rule");
38313
38199
  let { code, filename } = rule;
38314
38200
  console.debug(`executing rule ${path.basename(filename)}`);
38315
- let script = new vm.Script(`
38201
+ new vm.Script(`
38316
38202
  (async function(exports) {
38317
38203
  try {
38318
38204
  await (${code})(__simulator.user, __simulator.context, resolve);
@@ -38321,8 +38207,7 @@ async function runRule(user, context, rule) {
38321
38207
  reject();
38322
38208
  }
38323
38209
  })(module.exports)
38324
- `);
38325
- script.runInContext(vmContext, {
38210
+ `).runInContext(vmContext, {
38326
38211
  filename,
38327
38212
  displayErrors: true,
38328
38213
  timeout: 2e4
@@ -38380,8 +38265,7 @@ const createTokens = async ({ body, iss, clientID, audience, rulesDirectory, sco
38380
38265
  else if (grant_type === "refresh_token") {
38381
38266
  let { refresh_token: refreshTokenValue } = body;
38382
38267
  let refreshToken = JSON.parse(decode(refreshTokenValue));
38383
- let findUser = createPersonQuery(simulationStore);
38384
- user = findUser((person) => person.id === refreshToken.user.id);
38268
+ user = createPersonQuery(simulationStore)((person) => person.id === refreshToken.user.id);
38385
38269
  nonce = refreshToken.nonce;
38386
38270
  assert(!!nonce, `400::No nonce in request`);
38387
38271
  } else {
@@ -38409,8 +38293,7 @@ const createTokens = async ({ body, iss, clientID, audience, rulesDirectory, sco
38409
38293
  },
38410
38294
  idToken: idTokenData
38411
38295
  };
38412
- let rulesRunner = createRulesRunner(rulesDirectory);
38413
- await rulesRunner(userData, context);
38296
+ await createRulesRunner(rulesDirectory)(userData, context);
38414
38297
  return {
38415
38298
  access_token: createJsonWebToken({
38416
38299
  ...accessToken,
@@ -38496,7 +38379,13 @@ const verifyUserExistsInStore = ({ simulationStore, body, grant_type }) => {
38496
38379
  //#endregion
38497
38380
  //#region src/views/username-password.ts
38498
38381
  const userNamePasswordForm = ({ auth0Domain = "/login/callback", redirect_uri, state, nonce, client_id, scope, audience, connection, response_type, tenant }) => {
38499
- let wctx = encode$1(JSON.stringify({
38382
+ return `
38383
+ <form method="post" name="hiddenform" action="${auth0Domain}">
38384
+ <input type="hidden" name="wa" value="wsignin1.0">
38385
+ <input type="hidden"
38386
+ name="wresult"
38387
+ value="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjoiNjA1MzhjYWQ2YWI5ODQwMDY5OWIxZDZhIiwiZW1haWwiOiJpbXJhbi5zdWxlbWFuamlAcmVzaWRlby5jb20iLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsInNpZCI6Im5zSHZTQ0lYT2NGSUZINUIyRzdVdUFEWDVQTlR4cmRPIiwiaWF0IjoxNjE2MTU0ODA0LCJleHAiOjE2MTYxNTQ4NjQsImF1ZCI6InVybjphdXRoMDpyZXNpZGVvOlVzZXJuYW1lLVBhc3N3b3JkLUF1dGhlbnRpY2F0aW9uIiwiaXNzIjoidXJuOmF1dGgwIn0.CTl0A1hDc4YrErsrFBCCEG0ekIUU3bv0x12p_vUgoyD6zOg_QhaSZjKeZI2elaeYnAi7KUcohgOP9TApj3VlQtm6GlGNuWIiQke4866FtfhufGo2_uLBWyf4nmOgbNcmhpIg2bvVJHUqM-6OCNfnzPWAoFW2_g-DeIo20WBfK2E">
38388
+ <input type="hidden" name="wctx" value="${encode$1(JSON.stringify({
38500
38389
  strategy: "auth0",
38501
38390
  tenant,
38502
38391
  connection,
@@ -38508,14 +38397,7 @@ const userNamePasswordForm = ({ auth0Domain = "/login/callback", redirect_uri, s
38508
38397
  nonce,
38509
38398
  audience,
38510
38399
  realm: connection
38511
- }));
38512
- return `
38513
- <form method="post" name="hiddenform" action="${auth0Domain}">
38514
- <input type="hidden" name="wa" value="wsignin1.0">
38515
- <input type="hidden"
38516
- name="wresult"
38517
- value="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjoiNjA1MzhjYWQ2YWI5ODQwMDY5OWIxZDZhIiwiZW1haWwiOiJpbXJhbi5zdWxlbWFuamlAcmVzaWRlby5jb20iLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsInNpZCI6Im5zSHZTQ0lYT2NGSUZINUIyRzdVdUFEWDVQTlR4cmRPIiwiaWF0IjoxNjE2MTU0ODA0LCJleHAiOjE2MTYxNTQ4NjQsImF1ZCI6InVybjphdXRoMDpyZXNpZGVvOlVzZXJuYW1lLVBhc3N3b3JkLUF1dGhlbnRpY2F0aW9uIiwiaXNzIjoidXJuOmF1dGgwIn0.CTl0A1hDc4YrErsrFBCCEG0ekIUU3bv0x12p_vUgoyD6zOg_QhaSZjKeZI2elaeYnAi7KUcohgOP9TApj3VlQtm6GlGNuWIiQke4866FtfhufGo2_uLBWyf4nmOgbNcmhpIg2bvVJHUqM-6OCNfnzPWAoFW2_g-DeIo20WBfK2E">
38518
- <input type="hidden" name="wctx" value="${wctx}">
38400
+ }))}">
38519
38401
  <noscript>
38520
38402
  <p>
38521
38403
  Script is disabled. Click Submit to continue.
@@ -38586,8 +38468,7 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38586
38468
  assert(!!username, "no username in /usernamepassword/login");
38587
38469
  assert(!!nonce, "no nonce in /usernamepassword/login");
38588
38470
  assert(!!req$2.session, "no session");
38589
- let user = personQuery((person) => person.email?.toLowerCase() === username.toLowerCase() && person.password === password);
38590
- if (!user) {
38471
+ if (!personQuery((person) => person.email?.toLowerCase() === username.toLowerCase() && person.password === password)) {
38591
38472
  let query = req$2.query;
38592
38473
  let responseClientId = query.client_id ?? clientID;
38593
38474
  let responseAudience = query.audience ?? audience;
@@ -38619,14 +38500,11 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38619
38500
  wctx
38620
38501
  } });
38621
38502
  let { redirect_uri, nonce } = wctx;
38622
- const session = simulationStore.schema.sessions.selectById(simulationStore.store.getState(), { id: nonce });
38623
- const { username } = session ?? {};
38624
- let encodedNonce = encode(`${nonce}:${username}`);
38625
- let qs$2 = stringify({
38626
- code: encodedNonce,
38503
+ const { username } = simulationStore.schema.sessions.selectById(simulationStore.store.getState(), { id: nonce }) ?? {};
38504
+ let routerUrl = `${redirect_uri}?${stringify({
38505
+ code: encode(`${nonce}:${username}`),
38627
38506
  ...wctx
38628
- });
38629
- let routerUrl = `${redirect_uri}?${qs$2}`;
38507
+ })}`;
38630
38508
  res$2.redirect(302, routerUrl);
38631
38509
  },
38632
38510
  ["/oauth/token"]: async function(req$2, res$2, next) {
@@ -38665,10 +38543,8 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38665
38543
  },
38666
38544
  ["/userinfo"]: function(req$2, res$2) {
38667
38545
  let token = null;
38668
- if (req$2.headers.authorization) {
38669
- let authorizationHeader = req$2.headers.authorization;
38670
- token = authorizationHeader?.split(" ")?.[1];
38671
- } else token = req$2?.query?.access_token;
38546
+ if (req$2.headers.authorization) token = req$2.headers.authorization?.split(" ")?.[1];
38547
+ else token = req$2?.query?.access_token;
38672
38548
  assert(!!token, "no authorization header or access_token");
38673
38549
  let { sub } = decode$1(token, { json: true });
38674
38550
  let user = personQuery((person) => {
@@ -38691,7 +38567,7 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38691
38567
  ["/passwordless/start"]: function(req$2, res$2, next) {
38692
38568
  logger.log({ "/passwordless/start": { body: req$2.body } });
38693
38569
  try {
38694
- const { client_id, connection, email, phone_number, send: send$4 } = req$2.body;
38570
+ const { client_id, connection, email, phone_number } = req$2.body;
38695
38571
  if (!client_id) {
38696
38572
  res$2.status(400).json({ error: "client_id is required" });
38697
38573
  return;
@@ -38780,11 +38656,13 @@ const configurationSchema = z.object({
38780
38656
  //#endregion
38781
38657
  //#region src/handlers/index.ts
38782
38658
  const publicDir = path.join(import.meta.dirname, "..", "views", "public");
38783
- const extendRouter = (config, debug$11 = false) => (router, simulationStore) => {
38659
+ const extendRouter = (config, extend, debug$11 = false) => (router, simulationStore) => {
38784
38660
  const serviceURL = (request) => `${request.protocol}://${request.get("Host")}/`;
38785
38661
  const auth0 = createAuth0Handlers(simulationStore, serviceURL, config, debug$11);
38786
38662
  const openid = createOpenIdHandlers(serviceURL);
38787
- router.use(import_express.static(publicDir)).use(createSession()).use(createCors()).use(noCache()).get("/health", (_, response) => {
38663
+ router.use(import_express.static(publicDir)).use(createSession()).use(createCors()).use(noCache());
38664
+ if (extend) extend(router, simulationStore);
38665
+ router.get("/health", (_, response) => {
38788
38666
  response.send({ status: "ok" });
38789
38667
  }).get("/heartbeat", auth0["/heartbeat"]).get("/authorize", auth0["/authorize"]).get("/login", auth0["/login"]).get("/u/login", auth0["/usernamepassword/login"]).post("/usernamepassword/login", auth0["/usernamepassword/login"]).post("/login/callback", auth0["/login/callback"]).post("/oauth/token", auth0["/oauth/token"]).post("/passwordless/start", auth0["/passwordless/start"]).get("/userinfo", auth0["/userinfo"]).get("/v2/logout", auth0["/v2/logout"]).get("/.well-known/jwks.json", openid["/.well-known/jwks.json"]).get("/.well-known/openid-configuration", openid["/.well-known/openid-configuration"]);
38790
38668
  router.use(defaultErrorHandler);
@@ -38830,10 +38708,10 @@ const simulation = (args = {}) => {
38830
38708
  const config = getConfig(args.options);
38831
38709
  const parsedInitialState = !args?.initialState ? void 0 : auth0InitialStoreSchema.parse(args?.initialState);
38832
38710
  return createFoundationSimulationServer({
38833
- port: 4400,
38711
+ port: config.port ?? 4400,
38834
38712
  protocol: "https",
38835
38713
  extendStore: extendStore(parsedInitialState, args?.extend?.extendStore),
38836
- extendRouter: extendRouter(config, args.debug)
38714
+ extendRouter: extendRouter(config, args.extend?.extendRouter, args.debug)
38837
38715
  })();
38838
38716
  };
38839
38717