strapi-plugin-firebase-authentication 1.2.1 → 1.2.3

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.
@@ -13,7 +13,7 @@ const require$$0$8 = require("constants");
13
13
  require("node:stream");
14
14
  const admin$1 = require("firebase-admin");
15
15
  const CryptoJS = require("crypto-js");
16
- const fs$6 = require("fs/promises");
16
+ const fs$8 = require("fs/promises");
17
17
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
18
18
  function _interopNamespace(e) {
19
19
  if (e && e.__esModule) return e;
@@ -45,7 +45,7 @@ const require$$2__default$1 = /* @__PURE__ */ _interopDefault(require$$2$1);
45
45
  const require$$0__default$6 = /* @__PURE__ */ _interopDefault(require$$0$8);
46
46
  const admin__default = /* @__PURE__ */ _interopDefault(admin$1);
47
47
  const CryptoJS__default = /* @__PURE__ */ _interopDefault(CryptoJS);
48
- const fs__namespace = /* @__PURE__ */ _interopNamespace(fs$6);
48
+ const fs__namespace = /* @__PURE__ */ _interopNamespace(fs$8);
49
49
  async function migrateFirebaseUserData(strapi2, dryRun = false) {
50
50
  strapi2.log.info("=== Firebase User Data Migration ===");
51
51
  strapi2.log.info(`Mode: ${dryRun ? "DRY RUN (no changes)" : "LIVE (will modify database)"}`);
@@ -1014,9 +1014,9 @@ lodash.exports;
1014
1014
  function hasUnicodeWord2(string2) {
1015
1015
  return reHasUnicodeWord2.test(string2);
1016
1016
  }
1017
- function iteratorToArray(iterator) {
1017
+ function iteratorToArray(iterator2) {
1018
1018
  var data, result = [];
1019
- while (!(data = iterator.next()).done) {
1019
+ while (!(data = iterator2.next()).done) {
1020
1020
  result.push(data.value);
1021
1021
  }
1022
1022
  return result;
@@ -9599,7 +9599,7 @@ var _mapping = {};
9599
9599
  })(_mapping);
9600
9600
  var placeholder = {};
9601
9601
  var mapping = _mapping, fallbackHolder = placeholder;
9602
- var push = Array.prototype.push;
9602
+ var push$1 = Array.prototype.push;
9603
9603
  function baseArity(func, n) {
9604
9604
  return n == 2 ? function(a, b) {
9605
9605
  return func.apply(void 0, arguments);
@@ -9634,10 +9634,10 @@ function flatSpread(func, start) {
9634
9634
  }
9635
9635
  var array2 = args[start], otherArgs = args.slice(0, start);
9636
9636
  if (array2) {
9637
- push.apply(otherArgs, array2);
9637
+ push$1.apply(otherArgs, array2);
9638
9638
  }
9639
9639
  if (start != lastIndex) {
9640
- push.apply(otherArgs, args.slice(start + 1));
9640
+ push$1.apply(otherArgs, args.slice(start + 1));
9641
9641
  }
9642
9642
  return func.apply(this, otherArgs);
9643
9643
  };
@@ -12245,11 +12245,11 @@ function baseGet$2(object2, path2) {
12245
12245
  }
12246
12246
  var _baseGet = baseGet$2;
12247
12247
  var baseGet$1 = _baseGet;
12248
- function get$1(object2, path2, defaultValue) {
12248
+ function get$2(object2, path2, defaultValue) {
12249
12249
  var result = object2 == null ? void 0 : baseGet$1(object2, path2);
12250
12250
  return result === void 0 ? defaultValue : result;
12251
12251
  }
12252
- var get_1 = get$1;
12252
+ var get_1 = get$2;
12253
12253
  function baseHasIn$1(object2, key) {
12254
12254
  return object2 != null && key in Object(object2);
12255
12255
  }
@@ -12259,14 +12259,14 @@ function hasIn$1(object2, path2) {
12259
12259
  return object2 != null && hasPath(object2, path2, baseHasIn);
12260
12260
  }
12261
12261
  var hasIn_1 = hasIn$1;
12262
- var baseIsEqual = _baseIsEqual, get = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
12262
+ var baseIsEqual = _baseIsEqual, get$1 = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
12263
12263
  var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
12264
12264
  function baseMatchesProperty$1(path2, srcValue) {
12265
12265
  if (isKey$1(path2) && isStrictComparable(srcValue)) {
12266
12266
  return matchesStrictComparable(toKey$1(path2), srcValue);
12267
12267
  }
12268
12268
  return function(object2) {
12269
- var objValue = get(object2, path2);
12269
+ var objValue = get$1(object2, path2);
12270
12270
  return objValue === void 0 && objValue === srcValue ? hasIn(object2, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
12271
12271
  };
12272
12272
  }
@@ -12562,7 +12562,7 @@ function createValidation(config2) {
12562
12562
  validate2.OPTIONS = config2;
12563
12563
  return validate2;
12564
12564
  }
12565
- let trim = (part) => part.substr(0, part.length - 1).substr(1);
12565
+ let trim$1 = (part) => part.substr(0, part.length - 1).substr(1);
12566
12566
  function getIn(schema2, path2, value, context = value) {
12567
12567
  let parent, lastPart, lastPartDebug;
12568
12568
  if (!path2) return {
@@ -12571,7 +12571,7 @@ function getIn(schema2, path2, value, context = value) {
12571
12571
  schema: schema2
12572
12572
  };
12573
12573
  propertyExpr.forEach(path2, (_part, isBracket, isArray2) => {
12574
- let part = isBracket ? trim(_part) : _part;
12574
+ let part = isBracket ? trim$1(_part) : _part;
12575
12575
  schema2 = schema2.resolve({
12576
12576
  context,
12577
12577
  parent,
@@ -14958,7 +14958,7 @@ var pMap = async (iterable, mapper, {
14958
14958
  }
14959
14959
  const result = [];
14960
14960
  const errors2 = [];
14961
- const iterator = iterable[Symbol.iterator]();
14961
+ const iterator2 = iterable[Symbol.iterator]();
14962
14962
  let isRejected = false;
14963
14963
  let isIterableDone = false;
14964
14964
  let resolvingCount = 0;
@@ -14967,7 +14967,7 @@ var pMap = async (iterable, mapper, {
14967
14967
  if (isRejected) {
14968
14968
  return;
14969
14969
  }
14970
- const nextItem = iterator.next();
14970
+ const nextItem = iterator2.next();
14971
14971
  const index2 = currentIndex;
14972
14972
  currentIndex++;
14973
14973
  if (nextItem.done) {
@@ -16177,16 +16177,16 @@ var shebangCommand$1 = (string2 = "") => {
16177
16177
  }
16178
16178
  return argument ? `${binary2} ${argument}` : binary2;
16179
16179
  };
16180
- const fs$5 = require$$0__default$2.default;
16180
+ const fs$7 = require$$0__default$2.default;
16181
16181
  const shebangCommand = shebangCommand$1;
16182
16182
  function readShebang$1(command2) {
16183
16183
  const size = 150;
16184
16184
  const buffer = Buffer.alloc(size);
16185
16185
  let fd;
16186
16186
  try {
16187
- fd = fs$5.openSync(command2, "r");
16188
- fs$5.readSync(fd, buffer, 0, size, 0);
16189
- fs$5.closeSync(fd);
16187
+ fd = fs$7.openSync(command2, "r");
16188
+ fs$7.readSync(fd, buffer, 0, size, 0);
16189
+ fs$7.closeSync(fd);
16190
16190
  } catch (e) {
16191
16191
  }
16192
16192
  return shebangCommand(buffer.toString());
@@ -17197,9 +17197,9 @@ var bufferStream$1 = (options2) => {
17197
17197
  };
17198
17198
  const { constants: BufferConstants } = require$$0__default$5.default;
17199
17199
  const stream$1 = require$$0__default$4.default;
17200
- const { promisify: promisify$3 } = require$$2__default$1.default;
17200
+ const { promisify: promisify$5 } = require$$2__default$1.default;
17201
17201
  const bufferStream = bufferStream$1;
17202
- const streamPipelinePromisified = promisify$3(stream$1.pipeline);
17202
+ const streamPipelinePromisified = promisify$5(stream$1.pipeline);
17203
17203
  class MaxBufferError extends Error {
17204
17204
  constructor() {
17205
17205
  super("maxBuffer exceeded");
@@ -17735,11 +17735,11 @@ pLocate$4.exports = pLocate$3;
17735
17735
  pLocate$4.exports.default = pLocate$3;
17736
17736
  var pLocateExports = pLocate$4.exports;
17737
17737
  const path$4 = require$$0__namespace.default;
17738
- const fs$4 = require$$0__default$2.default;
17739
- const { promisify: promisify$2 } = require$$2__default$1.default;
17738
+ const fs$6 = require$$0__default$2.default;
17739
+ const { promisify: promisify$4 } = require$$2__default$1.default;
17740
17740
  const pLocate$2 = pLocateExports;
17741
- const fsStat$1 = promisify$2(fs$4.stat);
17742
- const fsLStat$1 = promisify$2(fs$4.lstat);
17741
+ const fsStat$1 = promisify$4(fs$6.stat);
17742
+ const fsLStat$1 = promisify$4(fs$6.lstat);
17743
17743
  const typeMappings$1 = {
17744
17744
  directory: "isDirectory",
17745
17745
  file: "isFile"
@@ -17777,7 +17777,7 @@ locatePath$1.exports.sync = (paths, options2) => {
17777
17777
  ...options2
17778
17778
  };
17779
17779
  checkType$1(options2);
17780
- const statFn = options2.allowSymlinks ? fs$4.statSync : fs$4.lstatSync;
17780
+ const statFn = options2.allowSymlinks ? fs$6.statSync : fs$6.lstatSync;
17781
17781
  for (const path_ of paths) {
17782
17782
  try {
17783
17783
  const stat = statFn(path$4.resolve(options2.cwd, path_));
@@ -17789,31 +17789,31 @@ locatePath$1.exports.sync = (paths, options2) => {
17789
17789
  }
17790
17790
  };
17791
17791
  var locatePathExports$1 = locatePath$1.exports;
17792
- var pathExists = { exports: {} };
17793
- const fs$3 = require$$0__default$2.default;
17794
- const { promisify: promisify$1 } = require$$2__default$1.default;
17795
- const pAccess = promisify$1(fs$3.access);
17796
- pathExists.exports = async (path2) => {
17792
+ var pathExists$2 = { exports: {} };
17793
+ const fs$5 = require$$0__default$2.default;
17794
+ const { promisify: promisify$3 } = require$$2__default$1.default;
17795
+ const pAccess$2 = promisify$3(fs$5.access);
17796
+ pathExists$2.exports = async (path2) => {
17797
17797
  try {
17798
- await pAccess(path2);
17798
+ await pAccess$2(path2);
17799
17799
  return true;
17800
17800
  } catch (_2) {
17801
17801
  return false;
17802
17802
  }
17803
17803
  };
17804
- pathExists.exports.sync = (path2) => {
17804
+ pathExists$2.exports.sync = (path2) => {
17805
17805
  try {
17806
- fs$3.accessSync(path2);
17806
+ fs$5.accessSync(path2);
17807
17807
  return true;
17808
17808
  } catch (_2) {
17809
17809
  return false;
17810
17810
  }
17811
17811
  };
17812
- var pathExistsExports = pathExists.exports;
17812
+ var pathExistsExports$1 = pathExists$2.exports;
17813
17813
  (function(module2) {
17814
17814
  const path2 = require$$0__namespace.default;
17815
17815
  const locatePath2 = locatePathExports$1;
17816
- const pathExists2 = pathExistsExports;
17816
+ const pathExists2 = pathExistsExports$1;
17817
17817
  const stop = Symbol("findUp.stop");
17818
17818
  module2.exports = async (name, options2 = {}) => {
17819
17819
  let directory = path2.resolve(options2.cwd || "");
@@ -20567,14 +20567,14 @@ const core_1 = core$1;
20567
20567
  core_1.findWorkspaceRoot;
20568
20568
  var findUp = { exports: {} };
20569
20569
  var locatePath = { exports: {} };
20570
- class Node {
20570
+ let Node$1 = class Node {
20571
20571
  /// value;
20572
20572
  /// next;
20573
20573
  constructor(value) {
20574
20574
  this.value = value;
20575
20575
  this.next = void 0;
20576
20576
  }
20577
- }
20577
+ };
20578
20578
  let Queue$1 = class Queue {
20579
20579
  // TODO: Use private class fields when targeting Node.js 12.
20580
20580
  // #_head;
@@ -20584,7 +20584,7 @@ let Queue$1 = class Queue {
20584
20584
  this.clear();
20585
20585
  }
20586
20586
  enqueue(value) {
20587
- const node = new Node(value);
20587
+ const node = new Node$1(value);
20588
20588
  if (this._head) {
20589
20589
  this._tail.next = node;
20590
20590
  this._tail = node;
@@ -20706,11 +20706,11 @@ const pLocate$1 = async (iterable, tester, options2) => {
20706
20706
  };
20707
20707
  var pLocate_1 = pLocate$1;
20708
20708
  const path = require$$0__namespace.default;
20709
- const fs$2 = require$$0__default$2.default;
20710
- const { promisify } = require$$2__default$1.default;
20709
+ const fs$4 = require$$0__default$2.default;
20710
+ const { promisify: promisify$2 } = require$$2__default$1.default;
20711
20711
  const pLocate = pLocate_1;
20712
- const fsStat = promisify(fs$2.stat);
20713
- const fsLStat = promisify(fs$2.lstat);
20712
+ const fsStat = promisify$2(fs$4.stat);
20713
+ const fsLStat = promisify$2(fs$4.lstat);
20714
20714
  const typeMappings = {
20715
20715
  directory: "isDirectory",
20716
20716
  file: "isFile"
@@ -20748,7 +20748,7 @@ locatePath.exports.sync = (paths, options2) => {
20748
20748
  ...options2
20749
20749
  };
20750
20750
  checkType(options2);
20751
- const statFn = options2.allowSymlinks ? fs$2.statSync : fs$2.lstatSync;
20751
+ const statFn = options2.allowSymlinks ? fs$4.statSync : fs$4.lstatSync;
20752
20752
  for (const path_ of paths) {
20753
20753
  try {
20754
20754
  const stat = statFn(path.resolve(options2.cwd, path_));
@@ -20760,6 +20760,27 @@ locatePath.exports.sync = (paths, options2) => {
20760
20760
  }
20761
20761
  };
20762
20762
  var locatePathExports = locatePath.exports;
20763
+ var pathExists$1 = { exports: {} };
20764
+ const fs$3 = require$$0__default$2.default;
20765
+ const { promisify: promisify$1 } = require$$2__default$1.default;
20766
+ const pAccess$1 = promisify$1(fs$3.access);
20767
+ pathExists$1.exports = async (path2) => {
20768
+ try {
20769
+ await pAccess$1(path2);
20770
+ return true;
20771
+ } catch (_2) {
20772
+ return false;
20773
+ }
20774
+ };
20775
+ pathExists$1.exports.sync = (path2) => {
20776
+ try {
20777
+ fs$3.accessSync(path2);
20778
+ return true;
20779
+ } catch (_2) {
20780
+ return false;
20781
+ }
20782
+ };
20783
+ var pathExistsExports = pathExists$1.exports;
20763
20784
  (function(module2) {
20764
20785
  const path2 = require$$0__namespace.default;
20765
20786
  const locatePath2 = locatePathExports;
@@ -20825,6 +20846,26 @@ var locatePathExports = locatePath.exports;
20825
20846
  module2.exports.sync.exists = pathExists2.sync;
20826
20847
  module2.exports.stop = stop;
20827
20848
  })(findUp);
20849
+ var pathExists = { exports: {} };
20850
+ const fs$2 = require$$0__default$2.default;
20851
+ const { promisify } = require$$2__default$1.default;
20852
+ const pAccess = promisify(fs$2.access);
20853
+ pathExists.exports = async (path2) => {
20854
+ try {
20855
+ await pAccess(path2);
20856
+ return true;
20857
+ } catch (_2) {
20858
+ return false;
20859
+ }
20860
+ };
20861
+ pathExists.exports.sync = (path2) => {
20862
+ try {
20863
+ fs$2.accessSync(path2);
20864
+ return true;
20865
+ } catch (_2) {
20866
+ return false;
20867
+ }
20868
+ };
20828
20869
  var loadYamlFile = { exports: {} };
20829
20870
  var constants$2 = require$$0__default$6.default;
20830
20871
  var origCwd = process.cwd;
@@ -23652,17 +23693,17 @@ function loadDocuments(input, options2) {
23652
23693
  }
23653
23694
  return state.documents;
23654
23695
  }
23655
- function loadAll(input, iterator, options2) {
23656
- if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
23657
- options2 = iterator;
23658
- iterator = null;
23696
+ function loadAll(input, iterator2, options2) {
23697
+ if (iterator2 !== null && typeof iterator2 === "object" && typeof options2 === "undefined") {
23698
+ options2 = iterator2;
23699
+ iterator2 = null;
23659
23700
  }
23660
23701
  var documents = loadDocuments(input, options2);
23661
- if (typeof iterator !== "function") {
23702
+ if (typeof iterator2 !== "function") {
23662
23703
  return documents;
23663
23704
  }
23664
23705
  for (var index2 = 0, length = documents.length; index2 < length; index2 += 1) {
23665
- iterator(documents[index2]);
23706
+ iterator2(documents[index2]);
23666
23707
  }
23667
23708
  }
23668
23709
  function load(input, options2) {
@@ -23674,12 +23715,12 @@ function load(input, options2) {
23674
23715
  }
23675
23716
  throw new YAMLException$1("expected a single document in the stream, but found more");
23676
23717
  }
23677
- function safeLoadAll(input, iterator, options2) {
23678
- if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
23679
- options2 = iterator;
23680
- iterator = null;
23718
+ function safeLoadAll(input, iterator2, options2) {
23719
+ if (typeof iterator2 === "object" && iterator2 !== null && typeof options2 === "undefined") {
23720
+ options2 = iterator2;
23721
+ iterator2 = null;
23681
23722
  }
23682
- return loadAll(input, iterator, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
23723
+ return loadAll(input, iterator2, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
23683
23724
  }
23684
23725
  function safeLoad(input, options2) {
23685
23726
  return load(input, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
@@ -28942,12 +28983,15 @@ const firebaseController = {
28942
28983
  try {
28943
28984
  const { token } = ctx.request.body || {};
28944
28985
  if (!token) {
28945
- throw new ValidationError$1("Token is required");
28986
+ return ctx.badRequest("Token is required");
28946
28987
  }
28947
28988
  const result = await strapi.plugin(pluginName).service("firebaseService").verifyEmail(token);
28948
28989
  ctx.body = result;
28949
28990
  } catch (error2) {
28950
28991
  strapi.log.error("verifyEmail controller error:", error2);
28992
+ if (error2.name === "ValidationError") {
28993
+ return ctx.badRequest(error2.message);
28994
+ }
28951
28995
  throw error2;
28952
28996
  }
28953
28997
  }
@@ -31143,6 +31187,22 @@ const firebaseService = ({ strapi: strapi2 }) => ({
31143
31187
  const tokenService2 = strapi2.plugin("firebase-authentication").service("tokenService");
31144
31188
  const validationResult = await tokenService2.validateVerificationToken(token);
31145
31189
  if (!validationResult.valid) {
31190
+ if (validationResult.code === "TOKEN_ALREADY_USED" && validationResult.firebaseUID) {
31191
+ try {
31192
+ const firebaseUser = await strapi2.firebase.auth().getUser(validationResult.firebaseUID);
31193
+ if (firebaseUser.emailVerified) {
31194
+ strapi2.log.info(
31195
+ `[verifyEmail] Token already used but email is verified for: ${firebaseUser.email}`
31196
+ );
31197
+ return {
31198
+ success: true,
31199
+ message: "This email has already been verified."
31200
+ };
31201
+ }
31202
+ } catch (checkError) {
31203
+ strapi2.log.warn(`[verifyEmail] Could not verify Firebase user status: ${checkError.message}`);
31204
+ }
31205
+ }
31146
31206
  strapi2.log.warn(`[verifyEmail] Token validation failed: ${validationResult.error}`);
31147
31207
  throw new ValidationError$1(validationResult.error || "Invalid verification link");
31148
31208
  }
@@ -33499,7 +33559,6 @@ var debug_1 = debug$1;
33499
33559
  const re2 = exports$1.re = [];
33500
33560
  const safeRe = exports$1.safeRe = [];
33501
33561
  const src = exports$1.src = [];
33502
- const safeSrc = exports$1.safeSrc = [];
33503
33562
  const t2 = exports$1.t = {};
33504
33563
  let R = 0;
33505
33564
  const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
@@ -33520,7 +33579,6 @@ var debug_1 = debug$1;
33520
33579
  debug2(name, index2, value);
33521
33580
  t2[name] = index2;
33522
33581
  src[index2] = value;
33523
- safeSrc[index2] = safe;
33524
33582
  re2[index2] = new RegExp(value, isGlobal ? "g" : void 0);
33525
33583
  safeRe[index2] = new RegExp(safe, isGlobal ? "g" : void 0);
33526
33584
  };
@@ -33529,8 +33587,8 @@ var debug_1 = debug$1;
33529
33587
  createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
33530
33588
  createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
33531
33589
  createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
33532
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIER]})`);
33533
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIERLOOSE]})`);
33590
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
33591
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
33534
33592
  createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
33535
33593
  createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
33536
33594
  createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
@@ -33546,11 +33604,8 @@ var debug_1 = debug$1;
33546
33604
  createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
33547
33605
  createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
33548
33606
  createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
33549
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
33550
- createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
33551
- createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
33607
+ createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:$|[^\\d])`);
33552
33608
  createToken("COERCERTL", src[t2.COERCE], true);
33553
- createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
33554
33609
  createToken("LONETILDE", "(?:~>?)");
33555
33610
  createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
33556
33611
  exports$1.tildeTrimReplace = "$1~";
@@ -33586,9 +33641,6 @@ const parseOptions$1 = (options2) => {
33586
33641
  var parseOptions_1 = parseOptions$1;
33587
33642
  const numeric = /^[0-9]+$/;
33588
33643
  const compareIdentifiers$1 = (a, b) => {
33589
- if (typeof a === "number" && typeof b === "number") {
33590
- return a === b ? 0 : a < b ? -1 : 1;
33591
- }
33592
33644
  const anum = numeric.test(a);
33593
33645
  const bnum = numeric.test(b);
33594
33646
  if (anum && bnum) {
@@ -33688,25 +33740,7 @@ let SemVer$d = class SemVer {
33688
33740
  if (!(other instanceof SemVer)) {
33689
33741
  other = new SemVer(other, this.options);
33690
33742
  }
33691
- if (this.major < other.major) {
33692
- return -1;
33693
- }
33694
- if (this.major > other.major) {
33695
- return 1;
33696
- }
33697
- if (this.minor < other.minor) {
33698
- return -1;
33699
- }
33700
- if (this.minor > other.minor) {
33701
- return 1;
33702
- }
33703
- if (this.patch < other.patch) {
33704
- return -1;
33705
- }
33706
- if (this.patch > other.patch) {
33707
- return 1;
33708
- }
33709
- return 0;
33743
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
33710
33744
  }
33711
33745
  comparePre(other) {
33712
33746
  if (!(other instanceof SemVer)) {
@@ -33745,7 +33779,7 @@ let SemVer$d = class SemVer {
33745
33779
  do {
33746
33780
  const a = this.build[i];
33747
33781
  const b = other.build[i];
33748
- debug("build compare", i, a, b);
33782
+ debug("prerelease compare", i, a, b);
33749
33783
  if (a === void 0 && b === void 0) {
33750
33784
  return 0;
33751
33785
  } else if (b === void 0) {
@@ -33762,17 +33796,6 @@ let SemVer$d = class SemVer {
33762
33796
  // preminor will bump the version up to the next minor release, and immediately
33763
33797
  // down to pre-release. premajor and prepatch work the same way.
33764
33798
  inc(release, identifier, identifierBase) {
33765
- if (release.startsWith("pre")) {
33766
- if (!identifier && identifierBase === false) {
33767
- throw new Error("invalid increment argument: identifier is empty");
33768
- }
33769
- if (identifier) {
33770
- const match = `-${identifier}`.match(this.options.loose ? re$1[t$1.PRERELEASELOOSE] : re$1[t$1.PRERELEASE]);
33771
- if (!match || match[1] !== identifier) {
33772
- throw new Error(`invalid identifier: ${identifier}`);
33773
- }
33774
- }
33775
- }
33776
33799
  switch (release) {
33777
33800
  case "premajor":
33778
33801
  this.prerelease.length = 0;
@@ -33798,12 +33821,6 @@ let SemVer$d = class SemVer {
33798
33821
  }
33799
33822
  this.inc("pre", identifier, identifierBase);
33800
33823
  break;
33801
- case "release":
33802
- if (this.prerelease.length === 0) {
33803
- throw new Error(`version ${this.raw} is not a prerelease`);
33804
- }
33805
- this.prerelease.length = 0;
33806
- break;
33807
33824
  case "major":
33808
33825
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
33809
33826
  this.major++;
@@ -33827,6 +33844,9 @@ let SemVer$d = class SemVer {
33827
33844
  break;
33828
33845
  case "pre": {
33829
33846
  const base = Number(identifierBase) ? 1 : 0;
33847
+ if (!identifier && identifierBase === false) {
33848
+ throw new Error("invalid increment argument: identifier is empty");
33849
+ }
33830
33850
  if (this.prerelease.length === 0) {
33831
33851
  this.prerelease = [base];
33832
33852
  } else {
@@ -33931,12 +33951,13 @@ const diff$1 = (version1, version2) => {
33931
33951
  if (!lowVersion.patch && !lowVersion.minor) {
33932
33952
  return "major";
33933
33953
  }
33934
- if (lowVersion.compareMain(highVersion) === 0) {
33935
- if (lowVersion.minor && !lowVersion.patch) {
33936
- return "minor";
33937
- }
33954
+ if (highVersion.patch) {
33938
33955
  return "patch";
33939
33956
  }
33957
+ if (highVersion.minor) {
33958
+ return "minor";
33959
+ }
33960
+ return "major";
33940
33961
  }
33941
33962
  const prefix = highHasPre ? "pre" : "";
33942
33963
  if (v1.major !== v2.major) {
@@ -34065,66 +34086,666 @@ const coerce$1 = (version2, options2) => {
34065
34086
  options2 = options2 || {};
34066
34087
  let match = null;
34067
34088
  if (!options2.rtl) {
34068
- match = version2.match(options2.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
34089
+ match = version2.match(re[t.COERCE]);
34069
34090
  } else {
34070
- const coerceRtlRegex = options2.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
34071
34091
  let next;
34072
- while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
34092
+ while ((next = re[t.COERCERTL].exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
34073
34093
  if (!match || next.index + next[0].length !== match.index + match[0].length) {
34074
34094
  match = next;
34075
34095
  }
34076
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
34096
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
34077
34097
  }
34078
- coerceRtlRegex.lastIndex = -1;
34098
+ re[t.COERCERTL].lastIndex = -1;
34079
34099
  }
34080
34100
  if (match === null) {
34081
34101
  return null;
34082
34102
  }
34083
- const major2 = match[2];
34084
- const minor2 = match[3] || "0";
34085
- const patch2 = match[4] || "0";
34086
- const prerelease2 = options2.includePrerelease && match[5] ? `-${match[5]}` : "";
34087
- const build = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
34088
- return parse$1(`${major2}.${minor2}.${patch2}${prerelease2}${build}`, options2);
34103
+ return parse$1(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options2);
34089
34104
  };
34090
34105
  var coerce_1 = coerce$1;
34106
+ var iterator;
34107
+ var hasRequiredIterator;
34108
+ function requireIterator() {
34109
+ if (hasRequiredIterator) return iterator;
34110
+ hasRequiredIterator = 1;
34111
+ iterator = function(Yallist2) {
34112
+ Yallist2.prototype[Symbol.iterator] = function* () {
34113
+ for (let walker = this.head; walker; walker = walker.next) {
34114
+ yield walker.value;
34115
+ }
34116
+ };
34117
+ };
34118
+ return iterator;
34119
+ }
34120
+ var yallist = Yallist$1;
34121
+ Yallist$1.Node = Node2;
34122
+ Yallist$1.create = Yallist$1;
34123
+ function Yallist$1(list) {
34124
+ var self2 = this;
34125
+ if (!(self2 instanceof Yallist$1)) {
34126
+ self2 = new Yallist$1();
34127
+ }
34128
+ self2.tail = null;
34129
+ self2.head = null;
34130
+ self2.length = 0;
34131
+ if (list && typeof list.forEach === "function") {
34132
+ list.forEach(function(item) {
34133
+ self2.push(item);
34134
+ });
34135
+ } else if (arguments.length > 0) {
34136
+ for (var i = 0, l = arguments.length; i < l; i++) {
34137
+ self2.push(arguments[i]);
34138
+ }
34139
+ }
34140
+ return self2;
34141
+ }
34142
+ Yallist$1.prototype.removeNode = function(node) {
34143
+ if (node.list !== this) {
34144
+ throw new Error("removing node which does not belong to this list");
34145
+ }
34146
+ var next = node.next;
34147
+ var prev = node.prev;
34148
+ if (next) {
34149
+ next.prev = prev;
34150
+ }
34151
+ if (prev) {
34152
+ prev.next = next;
34153
+ }
34154
+ if (node === this.head) {
34155
+ this.head = next;
34156
+ }
34157
+ if (node === this.tail) {
34158
+ this.tail = prev;
34159
+ }
34160
+ node.list.length--;
34161
+ node.next = null;
34162
+ node.prev = null;
34163
+ node.list = null;
34164
+ return next;
34165
+ };
34166
+ Yallist$1.prototype.unshiftNode = function(node) {
34167
+ if (node === this.head) {
34168
+ return;
34169
+ }
34170
+ if (node.list) {
34171
+ node.list.removeNode(node);
34172
+ }
34173
+ var head = this.head;
34174
+ node.list = this;
34175
+ node.next = head;
34176
+ if (head) {
34177
+ head.prev = node;
34178
+ }
34179
+ this.head = node;
34180
+ if (!this.tail) {
34181
+ this.tail = node;
34182
+ }
34183
+ this.length++;
34184
+ };
34185
+ Yallist$1.prototype.pushNode = function(node) {
34186
+ if (node === this.tail) {
34187
+ return;
34188
+ }
34189
+ if (node.list) {
34190
+ node.list.removeNode(node);
34191
+ }
34192
+ var tail = this.tail;
34193
+ node.list = this;
34194
+ node.prev = tail;
34195
+ if (tail) {
34196
+ tail.next = node;
34197
+ }
34198
+ this.tail = node;
34199
+ if (!this.head) {
34200
+ this.head = node;
34201
+ }
34202
+ this.length++;
34203
+ };
34204
+ Yallist$1.prototype.push = function() {
34205
+ for (var i = 0, l = arguments.length; i < l; i++) {
34206
+ push(this, arguments[i]);
34207
+ }
34208
+ return this.length;
34209
+ };
34210
+ Yallist$1.prototype.unshift = function() {
34211
+ for (var i = 0, l = arguments.length; i < l; i++) {
34212
+ unshift(this, arguments[i]);
34213
+ }
34214
+ return this.length;
34215
+ };
34216
+ Yallist$1.prototype.pop = function() {
34217
+ if (!this.tail) {
34218
+ return void 0;
34219
+ }
34220
+ var res = this.tail.value;
34221
+ this.tail = this.tail.prev;
34222
+ if (this.tail) {
34223
+ this.tail.next = null;
34224
+ } else {
34225
+ this.head = null;
34226
+ }
34227
+ this.length--;
34228
+ return res;
34229
+ };
34230
+ Yallist$1.prototype.shift = function() {
34231
+ if (!this.head) {
34232
+ return void 0;
34233
+ }
34234
+ var res = this.head.value;
34235
+ this.head = this.head.next;
34236
+ if (this.head) {
34237
+ this.head.prev = null;
34238
+ } else {
34239
+ this.tail = null;
34240
+ }
34241
+ this.length--;
34242
+ return res;
34243
+ };
34244
+ Yallist$1.prototype.forEach = function(fn, thisp) {
34245
+ thisp = thisp || this;
34246
+ for (var walker = this.head, i = 0; walker !== null; i++) {
34247
+ fn.call(thisp, walker.value, i, this);
34248
+ walker = walker.next;
34249
+ }
34250
+ };
34251
+ Yallist$1.prototype.forEachReverse = function(fn, thisp) {
34252
+ thisp = thisp || this;
34253
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
34254
+ fn.call(thisp, walker.value, i, this);
34255
+ walker = walker.prev;
34256
+ }
34257
+ };
34258
+ Yallist$1.prototype.get = function(n) {
34259
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
34260
+ walker = walker.next;
34261
+ }
34262
+ if (i === n && walker !== null) {
34263
+ return walker.value;
34264
+ }
34265
+ };
34266
+ Yallist$1.prototype.getReverse = function(n) {
34267
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
34268
+ walker = walker.prev;
34269
+ }
34270
+ if (i === n && walker !== null) {
34271
+ return walker.value;
34272
+ }
34273
+ };
34274
+ Yallist$1.prototype.map = function(fn, thisp) {
34275
+ thisp = thisp || this;
34276
+ var res = new Yallist$1();
34277
+ for (var walker = this.head; walker !== null; ) {
34278
+ res.push(fn.call(thisp, walker.value, this));
34279
+ walker = walker.next;
34280
+ }
34281
+ return res;
34282
+ };
34283
+ Yallist$1.prototype.mapReverse = function(fn, thisp) {
34284
+ thisp = thisp || this;
34285
+ var res = new Yallist$1();
34286
+ for (var walker = this.tail; walker !== null; ) {
34287
+ res.push(fn.call(thisp, walker.value, this));
34288
+ walker = walker.prev;
34289
+ }
34290
+ return res;
34291
+ };
34292
+ Yallist$1.prototype.reduce = function(fn, initial) {
34293
+ var acc;
34294
+ var walker = this.head;
34295
+ if (arguments.length > 1) {
34296
+ acc = initial;
34297
+ } else if (this.head) {
34298
+ walker = this.head.next;
34299
+ acc = this.head.value;
34300
+ } else {
34301
+ throw new TypeError("Reduce of empty list with no initial value");
34302
+ }
34303
+ for (var i = 0; walker !== null; i++) {
34304
+ acc = fn(acc, walker.value, i);
34305
+ walker = walker.next;
34306
+ }
34307
+ return acc;
34308
+ };
34309
+ Yallist$1.prototype.reduceReverse = function(fn, initial) {
34310
+ var acc;
34311
+ var walker = this.tail;
34312
+ if (arguments.length > 1) {
34313
+ acc = initial;
34314
+ } else if (this.tail) {
34315
+ walker = this.tail.prev;
34316
+ acc = this.tail.value;
34317
+ } else {
34318
+ throw new TypeError("Reduce of empty list with no initial value");
34319
+ }
34320
+ for (var i = this.length - 1; walker !== null; i--) {
34321
+ acc = fn(acc, walker.value, i);
34322
+ walker = walker.prev;
34323
+ }
34324
+ return acc;
34325
+ };
34326
+ Yallist$1.prototype.toArray = function() {
34327
+ var arr = new Array(this.length);
34328
+ for (var i = 0, walker = this.head; walker !== null; i++) {
34329
+ arr[i] = walker.value;
34330
+ walker = walker.next;
34331
+ }
34332
+ return arr;
34333
+ };
34334
+ Yallist$1.prototype.toArrayReverse = function() {
34335
+ var arr = new Array(this.length);
34336
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
34337
+ arr[i] = walker.value;
34338
+ walker = walker.prev;
34339
+ }
34340
+ return arr;
34341
+ };
34342
+ Yallist$1.prototype.slice = function(from, to) {
34343
+ to = to || this.length;
34344
+ if (to < 0) {
34345
+ to += this.length;
34346
+ }
34347
+ from = from || 0;
34348
+ if (from < 0) {
34349
+ from += this.length;
34350
+ }
34351
+ var ret = new Yallist$1();
34352
+ if (to < from || to < 0) {
34353
+ return ret;
34354
+ }
34355
+ if (from < 0) {
34356
+ from = 0;
34357
+ }
34358
+ if (to > this.length) {
34359
+ to = this.length;
34360
+ }
34361
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
34362
+ walker = walker.next;
34363
+ }
34364
+ for (; walker !== null && i < to; i++, walker = walker.next) {
34365
+ ret.push(walker.value);
34366
+ }
34367
+ return ret;
34368
+ };
34369
+ Yallist$1.prototype.sliceReverse = function(from, to) {
34370
+ to = to || this.length;
34371
+ if (to < 0) {
34372
+ to += this.length;
34373
+ }
34374
+ from = from || 0;
34375
+ if (from < 0) {
34376
+ from += this.length;
34377
+ }
34378
+ var ret = new Yallist$1();
34379
+ if (to < from || to < 0) {
34380
+ return ret;
34381
+ }
34382
+ if (from < 0) {
34383
+ from = 0;
34384
+ }
34385
+ if (to > this.length) {
34386
+ to = this.length;
34387
+ }
34388
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
34389
+ walker = walker.prev;
34390
+ }
34391
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
34392
+ ret.push(walker.value);
34393
+ }
34394
+ return ret;
34395
+ };
34396
+ Yallist$1.prototype.splice = function(start, deleteCount, ...nodes) {
34397
+ if (start > this.length) {
34398
+ start = this.length - 1;
34399
+ }
34400
+ if (start < 0) {
34401
+ start = this.length + start;
34402
+ }
34403
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
34404
+ walker = walker.next;
34405
+ }
34406
+ var ret = [];
34407
+ for (var i = 0; walker && i < deleteCount; i++) {
34408
+ ret.push(walker.value);
34409
+ walker = this.removeNode(walker);
34410
+ }
34411
+ if (walker === null) {
34412
+ walker = this.tail;
34413
+ }
34414
+ if (walker !== this.head && walker !== this.tail) {
34415
+ walker = walker.prev;
34416
+ }
34417
+ for (var i = 0; i < nodes.length; i++) {
34418
+ walker = insert(this, walker, nodes[i]);
34419
+ }
34420
+ return ret;
34421
+ };
34422
+ Yallist$1.prototype.reverse = function() {
34423
+ var head = this.head;
34424
+ var tail = this.tail;
34425
+ for (var walker = head; walker !== null; walker = walker.prev) {
34426
+ var p = walker.prev;
34427
+ walker.prev = walker.next;
34428
+ walker.next = p;
34429
+ }
34430
+ this.head = tail;
34431
+ this.tail = head;
34432
+ return this;
34433
+ };
34434
+ function insert(self2, node, value) {
34435
+ var inserted = node === self2.head ? new Node2(value, null, node, self2) : new Node2(value, node, node.next, self2);
34436
+ if (inserted.next === null) {
34437
+ self2.tail = inserted;
34438
+ }
34439
+ if (inserted.prev === null) {
34440
+ self2.head = inserted;
34441
+ }
34442
+ self2.length++;
34443
+ return inserted;
34444
+ }
34445
+ function push(self2, item) {
34446
+ self2.tail = new Node2(item, self2.tail, null, self2);
34447
+ if (!self2.head) {
34448
+ self2.head = self2.tail;
34449
+ }
34450
+ self2.length++;
34451
+ }
34452
+ function unshift(self2, item) {
34453
+ self2.head = new Node2(item, null, self2.head, self2);
34454
+ if (!self2.tail) {
34455
+ self2.tail = self2.head;
34456
+ }
34457
+ self2.length++;
34458
+ }
34459
+ function Node2(value, prev, next, list) {
34460
+ if (!(this instanceof Node2)) {
34461
+ return new Node2(value, prev, next, list);
34462
+ }
34463
+ this.list = list;
34464
+ this.value = value;
34465
+ if (prev) {
34466
+ prev.next = this;
34467
+ this.prev = prev;
34468
+ } else {
34469
+ this.prev = null;
34470
+ }
34471
+ if (next) {
34472
+ next.prev = this;
34473
+ this.next = next;
34474
+ } else {
34475
+ this.next = null;
34476
+ }
34477
+ }
34478
+ try {
34479
+ requireIterator()(Yallist$1);
34480
+ } catch (er) {
34481
+ }
34482
+ const Yallist = yallist;
34483
+ const MAX = Symbol("max");
34484
+ const LENGTH = Symbol("length");
34485
+ const LENGTH_CALCULATOR = Symbol("lengthCalculator");
34486
+ const ALLOW_STALE = Symbol("allowStale");
34487
+ const MAX_AGE = Symbol("maxAge");
34488
+ const DISPOSE = Symbol("dispose");
34489
+ const NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
34490
+ const LRU_LIST = Symbol("lruList");
34491
+ const CACHE = Symbol("cache");
34492
+ const UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
34493
+ const naiveLength = () => 1;
34091
34494
  class LRUCache {
34092
- constructor() {
34093
- this.max = 1e3;
34094
- this.map = /* @__PURE__ */ new Map();
34495
+ constructor(options2) {
34496
+ if (typeof options2 === "number")
34497
+ options2 = { max: options2 };
34498
+ if (!options2)
34499
+ options2 = {};
34500
+ if (options2.max && (typeof options2.max !== "number" || options2.max < 0))
34501
+ throw new TypeError("max must be a non-negative number");
34502
+ this[MAX] = options2.max || Infinity;
34503
+ const lc = options2.length || naiveLength;
34504
+ this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
34505
+ this[ALLOW_STALE] = options2.stale || false;
34506
+ if (options2.maxAge && typeof options2.maxAge !== "number")
34507
+ throw new TypeError("maxAge must be a number");
34508
+ this[MAX_AGE] = options2.maxAge || 0;
34509
+ this[DISPOSE] = options2.dispose;
34510
+ this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false;
34511
+ this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false;
34512
+ this.reset();
34513
+ }
34514
+ // resize the cache when the max changes.
34515
+ set max(mL) {
34516
+ if (typeof mL !== "number" || mL < 0)
34517
+ throw new TypeError("max must be a non-negative number");
34518
+ this[MAX] = mL || Infinity;
34519
+ trim(this);
34520
+ }
34521
+ get max() {
34522
+ return this[MAX];
34523
+ }
34524
+ set allowStale(allowStale) {
34525
+ this[ALLOW_STALE] = !!allowStale;
34526
+ }
34527
+ get allowStale() {
34528
+ return this[ALLOW_STALE];
34529
+ }
34530
+ set maxAge(mA) {
34531
+ if (typeof mA !== "number")
34532
+ throw new TypeError("maxAge must be a non-negative number");
34533
+ this[MAX_AGE] = mA;
34534
+ trim(this);
34535
+ }
34536
+ get maxAge() {
34537
+ return this[MAX_AGE];
34538
+ }
34539
+ // resize the cache when the lengthCalculator changes.
34540
+ set lengthCalculator(lC) {
34541
+ if (typeof lC !== "function")
34542
+ lC = naiveLength;
34543
+ if (lC !== this[LENGTH_CALCULATOR]) {
34544
+ this[LENGTH_CALCULATOR] = lC;
34545
+ this[LENGTH] = 0;
34546
+ this[LRU_LIST].forEach((hit) => {
34547
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
34548
+ this[LENGTH] += hit.length;
34549
+ });
34550
+ }
34551
+ trim(this);
34552
+ }
34553
+ get lengthCalculator() {
34554
+ return this[LENGTH_CALCULATOR];
34555
+ }
34556
+ get length() {
34557
+ return this[LENGTH];
34558
+ }
34559
+ get itemCount() {
34560
+ return this[LRU_LIST].length;
34561
+ }
34562
+ rforEach(fn, thisp) {
34563
+ thisp = thisp || this;
34564
+ for (let walker = this[LRU_LIST].tail; walker !== null; ) {
34565
+ const prev = walker.prev;
34566
+ forEachStep(this, fn, walker, thisp);
34567
+ walker = prev;
34568
+ }
34569
+ }
34570
+ forEach(fn, thisp) {
34571
+ thisp = thisp || this;
34572
+ for (let walker = this[LRU_LIST].head; walker !== null; ) {
34573
+ const next = walker.next;
34574
+ forEachStep(this, fn, walker, thisp);
34575
+ walker = next;
34576
+ }
34577
+ }
34578
+ keys() {
34579
+ return this[LRU_LIST].toArray().map((k) => k.key);
34580
+ }
34581
+ values() {
34582
+ return this[LRU_LIST].toArray().map((k) => k.value);
34583
+ }
34584
+ reset() {
34585
+ if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
34586
+ this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
34587
+ }
34588
+ this[CACHE] = /* @__PURE__ */ new Map();
34589
+ this[LRU_LIST] = new Yallist();
34590
+ this[LENGTH] = 0;
34591
+ }
34592
+ dump() {
34593
+ return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
34594
+ k: hit.key,
34595
+ v: hit.value,
34596
+ e: hit.now + (hit.maxAge || 0)
34597
+ }).toArray().filter((h2) => h2);
34598
+ }
34599
+ dumpLru() {
34600
+ return this[LRU_LIST];
34601
+ }
34602
+ set(key, value, maxAge) {
34603
+ maxAge = maxAge || this[MAX_AGE];
34604
+ if (maxAge && typeof maxAge !== "number")
34605
+ throw new TypeError("maxAge must be a number");
34606
+ const now = maxAge ? Date.now() : 0;
34607
+ const len = this[LENGTH_CALCULATOR](value, key);
34608
+ if (this[CACHE].has(key)) {
34609
+ if (len > this[MAX]) {
34610
+ del(this, this[CACHE].get(key));
34611
+ return false;
34612
+ }
34613
+ const node = this[CACHE].get(key);
34614
+ const item = node.value;
34615
+ if (this[DISPOSE]) {
34616
+ if (!this[NO_DISPOSE_ON_SET])
34617
+ this[DISPOSE](key, item.value);
34618
+ }
34619
+ item.now = now;
34620
+ item.maxAge = maxAge;
34621
+ item.value = value;
34622
+ this[LENGTH] += len - item.length;
34623
+ item.length = len;
34624
+ this.get(key);
34625
+ trim(this);
34626
+ return true;
34627
+ }
34628
+ const hit = new Entry(key, value, len, now, maxAge);
34629
+ if (hit.length > this[MAX]) {
34630
+ if (this[DISPOSE])
34631
+ this[DISPOSE](key, value);
34632
+ return false;
34633
+ }
34634
+ this[LENGTH] += hit.length;
34635
+ this[LRU_LIST].unshift(hit);
34636
+ this[CACHE].set(key, this[LRU_LIST].head);
34637
+ trim(this);
34638
+ return true;
34639
+ }
34640
+ has(key) {
34641
+ if (!this[CACHE].has(key)) return false;
34642
+ const hit = this[CACHE].get(key).value;
34643
+ return !isStale(this, hit);
34095
34644
  }
34096
34645
  get(key) {
34097
- const value = this.map.get(key);
34098
- if (value === void 0) {
34099
- return void 0;
34100
- } else {
34101
- this.map.delete(key);
34102
- this.map.set(key, value);
34103
- return value;
34646
+ return get(this, key, true);
34647
+ }
34648
+ peek(key) {
34649
+ return get(this, key, false);
34650
+ }
34651
+ pop() {
34652
+ const node = this[LRU_LIST].tail;
34653
+ if (!node)
34654
+ return null;
34655
+ del(this, node);
34656
+ return node.value;
34657
+ }
34658
+ del(key) {
34659
+ del(this, this[CACHE].get(key));
34660
+ }
34661
+ load(arr) {
34662
+ this.reset();
34663
+ const now = Date.now();
34664
+ for (let l = arr.length - 1; l >= 0; l--) {
34665
+ const hit = arr[l];
34666
+ const expiresAt = hit.e || 0;
34667
+ if (expiresAt === 0)
34668
+ this.set(hit.k, hit.v);
34669
+ else {
34670
+ const maxAge = expiresAt - now;
34671
+ if (maxAge > 0) {
34672
+ this.set(hit.k, hit.v, maxAge);
34673
+ }
34674
+ }
34104
34675
  }
34105
34676
  }
34106
- delete(key) {
34107
- return this.map.delete(key);
34677
+ prune() {
34678
+ this[CACHE].forEach((value, key) => get(this, key, false));
34108
34679
  }
34109
- set(key, value) {
34110
- const deleted = this.delete(key);
34111
- if (!deleted && value !== void 0) {
34112
- if (this.map.size >= this.max) {
34113
- const firstKey = this.map.keys().next().value;
34114
- this.delete(firstKey);
34680
+ }
34681
+ const get = (self2, key, doUse) => {
34682
+ const node = self2[CACHE].get(key);
34683
+ if (node) {
34684
+ const hit = node.value;
34685
+ if (isStale(self2, hit)) {
34686
+ del(self2, node);
34687
+ if (!self2[ALLOW_STALE])
34688
+ return void 0;
34689
+ } else {
34690
+ if (doUse) {
34691
+ if (self2[UPDATE_AGE_ON_GET])
34692
+ node.value.now = Date.now();
34693
+ self2[LRU_LIST].unshiftNode(node);
34115
34694
  }
34116
- this.map.set(key, value);
34117
34695
  }
34118
- return this;
34696
+ return hit.value;
34697
+ }
34698
+ };
34699
+ const isStale = (self2, hit) => {
34700
+ if (!hit || !hit.maxAge && !self2[MAX_AGE])
34701
+ return false;
34702
+ const diff2 = Date.now() - hit.now;
34703
+ return hit.maxAge ? diff2 > hit.maxAge : self2[MAX_AGE] && diff2 > self2[MAX_AGE];
34704
+ };
34705
+ const trim = (self2) => {
34706
+ if (self2[LENGTH] > self2[MAX]) {
34707
+ for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
34708
+ const prev = walker.prev;
34709
+ del(self2, walker);
34710
+ walker = prev;
34711
+ }
34712
+ }
34713
+ };
34714
+ const del = (self2, node) => {
34715
+ if (node) {
34716
+ const hit = node.value;
34717
+ if (self2[DISPOSE])
34718
+ self2[DISPOSE](hit.key, hit.value);
34719
+ self2[LENGTH] -= hit.length;
34720
+ self2[CACHE].delete(hit.key);
34721
+ self2[LRU_LIST].removeNode(node);
34722
+ }
34723
+ };
34724
+ class Entry {
34725
+ constructor(key, value, length, now, maxAge) {
34726
+ this.key = key;
34727
+ this.value = value;
34728
+ this.length = length;
34729
+ this.now = now;
34730
+ this.maxAge = maxAge || 0;
34119
34731
  }
34120
34732
  }
34121
- var lrucache = LRUCache;
34733
+ const forEachStep = (self2, fn, node, thisp) => {
34734
+ let hit = node.value;
34735
+ if (isStale(self2, hit)) {
34736
+ del(self2, node);
34737
+ if (!self2[ALLOW_STALE])
34738
+ hit = void 0;
34739
+ }
34740
+ if (hit)
34741
+ fn.call(thisp, hit.value, hit.key, self2);
34742
+ };
34743
+ var lruCache = LRUCache;
34122
34744
  var range;
34123
34745
  var hasRequiredRange;
34124
34746
  function requireRange() {
34125
34747
  if (hasRequiredRange) return range;
34126
34748
  hasRequiredRange = 1;
34127
- const SPACE_CHARACTERS = /\s+/g;
34128
34749
  class Range2 {
34129
34750
  constructor(range2, options2) {
34130
34751
  options2 = parseOptions2(options2);
@@ -34138,13 +34759,13 @@ function requireRange() {
34138
34759
  if (range2 instanceof Comparator2) {
34139
34760
  this.raw = range2.value;
34140
34761
  this.set = [[range2]];
34141
- this.formatted = void 0;
34762
+ this.format();
34142
34763
  return this;
34143
34764
  }
34144
34765
  this.options = options2;
34145
34766
  this.loose = !!options2.loose;
34146
34767
  this.includePrerelease = !!options2.includePrerelease;
34147
- this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
34768
+ this.raw = range2.trim().split(/\s+/).join(" ");
34148
34769
  this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
34149
34770
  if (!this.set.length) {
34150
34771
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
@@ -34163,27 +34784,10 @@ function requireRange() {
34163
34784
  }
34164
34785
  }
34165
34786
  }
34166
- this.formatted = void 0;
34167
- }
34168
- get range() {
34169
- if (this.formatted === void 0) {
34170
- this.formatted = "";
34171
- for (let i = 0; i < this.set.length; i++) {
34172
- if (i > 0) {
34173
- this.formatted += "||";
34174
- }
34175
- const comps = this.set[i];
34176
- for (let k = 0; k < comps.length; k++) {
34177
- if (k > 0) {
34178
- this.formatted += " ";
34179
- }
34180
- this.formatted += comps[k].toString().trim();
34181
- }
34182
- }
34183
- }
34184
- return this.formatted;
34787
+ this.format();
34185
34788
  }
34186
34789
  format() {
34790
+ this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
34187
34791
  return this.range;
34188
34792
  }
34189
34793
  toString() {
@@ -34264,8 +34868,8 @@ function requireRange() {
34264
34868
  }
34265
34869
  }
34266
34870
  range = Range2;
34267
- const LRU = lrucache;
34268
- const cache = new LRU();
34871
+ const LRU = lruCache;
34872
+ const cache = new LRU({ max: 1e3 });
34269
34873
  const parseOptions2 = parseOptions_1;
34270
34874
  const Comparator2 = requireComparator();
34271
34875
  const debug2 = debug_1;
@@ -34293,7 +34897,6 @@ function requireRange() {
34293
34897
  return result;
34294
34898
  };
34295
34899
  const parseComparator = (comp, options2) => {
34296
- comp = comp.replace(re2[t2.BUILD], "");
34297
34900
  debug2("comp", comp, options2);
34298
34901
  comp = replaceCarets(comp, options2);
34299
34902
  debug2("caret", comp);
@@ -34444,7 +35047,7 @@ function requireRange() {
34444
35047
  debug2("replaceGTE0", comp, options2);
34445
35048
  return comp.trim().replace(re2[options2.includePrerelease ? t2.GTE0PRE : t2.GTE0], "");
34446
35049
  };
34447
- const hyphenReplace = (incPr) => ($0, from, fM, fm, fp2, fpr, fb, to, tM, tm, tp, tpr) => {
35050
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp2, fpr, fb, to, tM, tm, tp, tpr, tb) => {
34448
35051
  if (isX(fM)) {
34449
35052
  from = "";
34450
35053
  } else if (isX(fm)) {
@@ -35767,9 +36370,10 @@ const tokenService = ({ strapi: strapi2 }) => {
35767
36370
  if (firebaseUserData2.verificationTokenHash !== tokenHash) {
35768
36371
  return {
35769
36372
  valid: false,
35770
- firebaseUserDataDocumentId: "",
35771
- firebaseUID: "",
35772
- error: "Verification link has already been used or is invalid"
36373
+ firebaseUserDataDocumentId: firebaseUserData2.documentId,
36374
+ firebaseUID: firebaseUserData2.firebaseUserID,
36375
+ error: "Verification link has already been used or is invalid",
36376
+ code: "TOKEN_ALREADY_USED"
35773
36377
  };
35774
36378
  }
35775
36379
  if (firebaseUserData2.verificationTokenExpiresAt) {