xframelib 1.2.3 → 1.2.4

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.
@@ -1,29 +1,37 @@
1
- var t = Object.defineProperty;
1
+ var t = Object.defineProperty, e = (e, i) => {
2
+ let s = {};
3
+ for (var h in e) t(s, h, {
4
+ get: e[h],
5
+ enumerable: !0
6
+ });
7
+ return i || t(s, Symbol.toStringTag, { value: "Module" }), s;
8
+ };
2
9
  /**
3
10
  * @license
4
11
  * Copyright 2019 Google LLC
5
12
  * SPDX-License-Identifier: Apache-2.0
6
- */ const e = Symbol("Comlink.proxy"), i = Symbol("Comlink.endpoint"), s = Symbol("Comlink.releaseProxy"), h = Symbol("Comlink.finalizer"), n = Symbol("Comlink.thrown"), r = (t) => "object" == typeof t && null !== t || "function" == typeof t, o = /* @__PURE__ */ new Map([["proxy", {
7
- canHandle: (t) => r(t) && t[e],
13
+ */
14
+ const i = Symbol("Comlink.proxy"), s = Symbol("Comlink.endpoint"), h = Symbol("Comlink.releaseProxy"), n = Symbol("Comlink.finalizer"), r = Symbol("Comlink.thrown"), o = (t) => "object" == typeof t && null !== t || "function" == typeof t, a = /* @__PURE__ */ new Map([["proxy", {
15
+ canHandle: (t) => o(t) && t[i],
8
16
  serialize(t) {
9
17
  const { port1: e, port2: i } = new MessageChannel();
10
- return a(t, e), [i, [i]];
18
+ return l(t, e), [i, [i]];
11
19
  },
12
- deserialize: (t) => (t.start(), function(t) {
13
- const e = /* @__PURE__ */ new Map();
20
+ deserialize: (t) => (t.start(), function(t, e) {
21
+ const i = /* @__PURE__ */ new Map();
14
22
  return t.addEventListener("message", function(t) {
15
- const { data: i } = t;
16
- if (!i || !i.id) return;
17
- const s = e.get(i.id);
23
+ const { data: e } = t;
24
+ if (!e || !e.id) return;
25
+ const s = i.get(e.id);
18
26
  if (s) try {
19
- s(i);
27
+ s(e);
20
28
  } finally {
21
- e.delete(i.id);
29
+ i.delete(e.id);
22
30
  }
23
- }), p(t, e, [], void 0);
31
+ }), g(t, i, [], e);
24
32
  }(t))
25
33
  }], ["throw", {
26
- canHandle: (t) => r(t) && n in t,
34
+ canHandle: (t) => o(t) && r in t,
27
35
  serialize({ value: t }) {
28
36
  let e;
29
37
  return e = t instanceof Error ? {
@@ -43,8 +51,8 @@ var t = Object.defineProperty;
43
51
  throw t.value;
44
52
  }
45
53
  }]]);
46
- function a(t, i = globalThis, s = ["*"]) {
47
- i.addEventListener("message", function r(o) {
54
+ function l(t, e = globalThis, s = ["*"]) {
55
+ e.addEventListener("message", function h(o) {
48
56
  if (!o || !o.data) return;
49
57
  if (!function(t, e) {
50
58
  for (const i of t) {
@@ -53,30 +61,30 @@ function a(t, i = globalThis, s = ["*"]) {
53
61
  }
54
62
  return !1;
55
63
  }(s, o.origin)) return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
56
- const { id: c, type: u, path: f } = Object.assign({ path: [] }, o.data), d = (o.data.argumentList || []).map(w);
64
+ const { id: a, type: u, path: f } = Object.assign({ path: [] }, o.data), d = (o.data.argumentList || []).map(S);
57
65
  let p;
58
66
  try {
59
- const i = f.slice(0, -1).reduce((t, e) => t[e], t), s = f.reduce((t, e) => t[e], t);
67
+ const e = f.slice(0, -1).reduce((t, e) => t[e], t), s = f.reduce((t, e) => t[e], t);
60
68
  switch (u) {
61
69
  case "GET":
62
70
  p = s;
63
71
  break;
64
72
  case "SET":
65
- i[f.slice(-1)[0]] = w(o.data.value), p = !0;
73
+ e[f.slice(-1)[0]] = S(o.data.value), p = !0;
66
74
  break;
67
75
  case "APPLY":
68
- p = s.apply(i, d);
76
+ p = s.apply(e, d);
69
77
  break;
70
78
  case "CONSTRUCT":
71
79
  p = function(t) {
72
- return Object.assign(t, { [e]: !0 });
80
+ return Object.assign(t, { [i]: !0 });
73
81
  }(new s(...d));
74
82
  break;
75
83
  case "ENDPOINT":
76
84
  {
77
85
  const { port1: e, port2: i } = new MessageChannel();
78
- a(t, i), p = function(t, e) {
79
- return v.set(t, e), t;
86
+ l(t, i), p = function(t, e) {
87
+ return w.set(t, e), t;
80
88
  }(e, [e]);
81
89
  }
82
90
  break;
@@ -85,107 +93,107 @@ function a(t, i = globalThis, s = ["*"]) {
85
93
  break;
86
94
  default: return;
87
95
  }
88
- } catch (t) {
96
+ } catch (g) {
89
97
  p = {
90
- value: t,
91
- [n]: 0
98
+ value: g,
99
+ [r]: 0
92
100
  };
93
101
  }
94
102
  Promise.resolve(p).catch((t) => ({
95
103
  value: t,
96
- [n]: 0
97
- })).then((e) => {
98
- const [s, n] = m(e);
99
- i.postMessage(Object.assign(Object.assign({}, s), { id: c }), n), "RELEASE" === u && (i.removeEventListener("message", r), l(i), h in t && "function" == typeof t[h] && t[h]());
104
+ [r]: 0
105
+ })).then((i) => {
106
+ const [s, r] = m(i);
107
+ e.postMessage(Object.assign(Object.assign({}, s), { id: a }), r), "RELEASE" === u && (e.removeEventListener("message", h), c(e), n in t && "function" == typeof t[n] && t[n]());
100
108
  }).catch((t) => {
101
- const [e, s] = m({
109
+ const [i, s] = m({
102
110
  value: /* @__PURE__ */ new TypeError("Unserializable return value"),
103
- [n]: 0
111
+ [r]: 0
104
112
  });
105
- i.postMessage(Object.assign(Object.assign({}, e), { id: c }), s);
113
+ e.postMessage(Object.assign(Object.assign({}, i), { id: a }), s);
106
114
  });
107
- }), i.start && i.start();
115
+ }), e.start && e.start();
108
116
  }
109
- function l(t) {
117
+ function c(t) {
110
118
  (function(t) {
111
119
  return "MessagePort" === t.constructor.name;
112
120
  })(t) && t.close();
113
121
  }
114
- function c(t) {
122
+ function u(t) {
115
123
  if (t) throw new Error("Proxy has been released and is not useable");
116
124
  }
117
- function u(t) {
118
- return S(t, /* @__PURE__ */ new Map(), { type: "RELEASE" }).then(() => {
119
- l(t);
125
+ function f(t) {
126
+ return y(t, /* @__PURE__ */ new Map(), { type: "RELEASE" }).then(() => {
127
+ c(t);
120
128
  });
121
129
  }
122
- const f = /* @__PURE__ */ new WeakMap(), d = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
123
- const e = (f.get(t) || 0) - 1;
124
- f.set(t, e), 0 === e && u(t);
130
+ const d = /* @__PURE__ */ new WeakMap(), p = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
131
+ const e = (d.get(t) || 0) - 1;
132
+ d.set(t, e), 0 === e && f(t);
125
133
  });
126
- function p(t, e, h = [], n = function() {}) {
134
+ function g(t, e, i = [], n = function() {}) {
127
135
  let r = !1;
128
136
  const o = new Proxy(n, {
129
- get(i, n) {
130
- if (c(r), n === s) return () => {
137
+ get(s, n) {
138
+ if (u(r), n === h) return () => {
131
139
  (function(t) {
132
- d && d.unregister(t);
133
- })(o), u(t), e.clear(), r = !0;
140
+ p && p.unregister(t);
141
+ })(o), f(t), e.clear(), r = !0;
134
142
  };
135
143
  if ("then" === n) {
136
- if (0 === h.length) return { then: () => o };
137
- const i = S(t, e, {
144
+ if (0 === i.length) return { then: () => o };
145
+ const s = y(t, e, {
138
146
  type: "GET",
139
- path: h.map((t) => t.toString())
140
- }).then(w);
141
- return i.then.bind(i);
147
+ path: i.map((t) => t.toString())
148
+ }).then(S);
149
+ return s.then.bind(s);
142
150
  }
143
- return p(t, e, [...h, n]);
151
+ return g(t, e, [...i, n]);
144
152
  },
145
- set(i, s, n) {
146
- c(r);
153
+ set(s, h, n) {
154
+ u(r);
147
155
  const [o, a] = m(n);
148
- return S(t, e, {
156
+ return y(t, e, {
149
157
  type: "SET",
150
- path: [...h, s].map((t) => t.toString()),
158
+ path: [...i, h].map((t) => t.toString()),
151
159
  value: o
152
- }, a).then(w);
160
+ }, a).then(S);
153
161
  },
154
- apply(s, n, o) {
155
- c(r);
156
- const a = h[h.length - 1];
157
- if (a === i) return S(t, e, { type: "ENDPOINT" }).then(w);
158
- if ("bind" === a) return p(t, e, h.slice(0, -1));
159
- const [l, u] = g(o);
160
- return S(t, e, {
162
+ apply(h, n, o) {
163
+ u(r);
164
+ const a = i[i.length - 1];
165
+ if (a === s) return y(t, e, { type: "ENDPOINT" }).then(S);
166
+ if ("bind" === a) return g(t, e, i.slice(0, -1));
167
+ const [l, c] = v(o);
168
+ return y(t, e, {
161
169
  type: "APPLY",
162
- path: h.map((t) => t.toString()),
170
+ path: i.map((t) => t.toString()),
163
171
  argumentList: l
164
- }, u).then(w);
172
+ }, c).then(S);
165
173
  },
166
- construct(i, s) {
167
- c(r);
168
- const [n, o] = g(s);
169
- return S(t, e, {
174
+ construct(s, h) {
175
+ u(r);
176
+ const [n, o] = v(h);
177
+ return y(t, e, {
170
178
  type: "CONSTRUCT",
171
- path: h.map((t) => t.toString()),
179
+ path: i.map((t) => t.toString()),
172
180
  argumentList: n
173
- }, o).then(w);
181
+ }, o).then(S);
174
182
  }
175
183
  });
176
184
  return function(t, e) {
177
- const i = (f.get(e) || 0) + 1;
178
- f.set(e, i), d && d.register(t, e, t);
185
+ const i = (d.get(e) || 0) + 1;
186
+ d.set(e, i), p && p.register(t, e, t);
179
187
  }(o, t), o;
180
188
  }
181
- function g(t) {
189
+ function v(t) {
182
190
  const e = t.map(m);
183
191
  return [e.map((t) => t[0]), (i = e.map((t) => t[1]), Array.prototype.concat.apply([], i))];
184
192
  var i;
185
193
  }
186
- const v = /* @__PURE__ */ new WeakMap();
194
+ const w = /* @__PURE__ */ new WeakMap();
187
195
  function m(t) {
188
- for (const [e, i] of o) if (i.canHandle(t)) {
196
+ for (const [e, i] of a) if (i.canHandle(t)) {
189
197
  const [s, h] = i.serialize(t);
190
198
  return [{
191
199
  type: "HANDLER",
@@ -196,30 +204,30 @@ function m(t) {
196
204
  return [{
197
205
  type: "RAW",
198
206
  value: t
199
- }, v.get(t) || []];
207
+ }, w.get(t) || []];
200
208
  }
201
- function w(t) {
209
+ function S(t) {
202
210
  switch (t.type) {
203
- case "HANDLER": return o.get(t.name).deserialize(t.value);
211
+ case "HANDLER": return a.get(t.name).deserialize(t.value);
204
212
  case "RAW": return t.value;
205
213
  }
206
214
  }
207
- function S(t, e, i, s) {
215
+ function y(t, e, i, s) {
208
216
  return new Promise((h) => {
209
217
  const n = new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
210
218
  e.set(n, h), t.start && t.start(), t.postMessage(Object.assign({ id: n }, i), s);
211
219
  });
212
220
  }
213
- var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance && performance && "function" == typeof performance.now ? performance : Date, E = () => y.hasSubscribers || z.hasSubscribers, O = /* @__PURE__ */ new Set(), A = "object" == typeof process && process ? process : {}, F = (t) => !!t && t === Math.floor(t) && t > 0 && isFinite(t), T = (t) => F(t) ? t <= Math.pow(2, 8) ? Uint8Array : t <= Math.pow(2, 16) ? Uint16Array : t <= Math.pow(2, 32) ? Uint32Array : t <= Number.MAX_SAFE_INTEGER ? x : null : null, x = class extends Array {
221
+ var b = { hasSubscribers: !1 }, _ = b, E = b, F = "object" == typeof performance && performance && "function" == typeof performance.now ? performance : Date, O = () => _.hasSubscribers || E.hasSubscribers, A = /* @__PURE__ */ new Set(), z = "object" == typeof process && process ? process : {}, T = (t) => !!t && t === Math.floor(t) && t > 0 && isFinite(t), x = (t) => T(t) ? t <= Math.pow(2, 8) ? Uint8Array : t <= Math.pow(2, 16) ? Uint16Array : t <= Math.pow(2, 32) ? Uint32Array : t <= Number.MAX_SAFE_INTEGER ? k : null : null, k = class extends Array {
214
222
  constructor(t) {
215
223
  super(t), this.fill(0);
216
224
  }
217
- }, k = class t {
225
+ }, C = class t {
218
226
  heap;
219
227
  length;
220
228
  static #t = !1;
221
229
  static create(e) {
222
- let i = T(e);
230
+ let i = x(e);
223
231
  if (!i) return [];
224
232
  t.#t = !0;
225
233
  let s = new t(e, i);
@@ -272,21 +280,21 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
272
280
  #p;
273
281
  #g;
274
282
  #v;
275
- #m;
276
283
  #w;
284
+ #m;
277
285
  #S;
278
- #b;
279
286
  #y;
280
- #z;
287
+ #b;
281
288
  #_;
282
289
  #E;
290
+ #F;
283
291
  #O;
284
292
  #A;
285
293
  static unsafeExposeInternals(t) {
286
294
  return {
287
- starts: t.#b,
288
- ttls: t.#y,
289
- autopurgeTimers: t.#z,
295
+ starts: t.#y,
296
+ ttls: t.#b,
297
+ autopurgeTimers: t.#_,
290
298
  sizes: t.#S,
291
299
  keyMap: t.#c,
292
300
  keyList: t.#u,
@@ -299,13 +307,13 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
299
307
  get tail() {
300
308
  return t.#v;
301
309
  },
302
- free: t.#m,
303
- isBackgroundFetch: (e) => t.#F(e),
310
+ free: t.#w,
311
+ isBackgroundFetch: (e) => t.#z(e),
304
312
  backgroundFetch: (e, i, s, h) => t.#T(e, i, s, h),
305
313
  moveToTail: (e) => t.#x(e),
306
314
  indexes: (e) => t.#k(e),
307
- rindexes: (e) => t.#R(e),
308
- isStale: (e) => t.#C(e)
315
+ rindexes: (e) => t.#C(e),
316
+ isStale: (e) => t.#R(e)
309
317
  };
310
318
  }
311
319
  get max() {
@@ -336,31 +344,31 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
336
344
  return this.#h;
337
345
  }
338
346
  constructor(e) {
339
- let { max: i = 0, ttl: s, ttlResolution: h = 1, ttlAutopurge: n, updateAgeOnGet: r, updateAgeOnHas: o, allowStale: a, dispose: l, onInsert: c, disposeAfter: u, noDisposeOnSet: f, noUpdateTTL: d, maxSize: p = 0, maxEntrySize: g = 0, sizeCalculation: v, fetchMethod: m, memoMethod: w, noDeleteOnFetchRejection: S, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: z, ignoreFetchAbort: E, backgroundFetchSize: x = 1, perf: R } = e;
340
- if (this.backgroundFetchSize = x, void 0 !== R && "function" != typeof R?.now) throw new TypeError("perf option must have a now() method if specified");
341
- if (this.#o = R ?? _, 0 !== i && !F(i)) throw new TypeError("max option must be a nonnegative integer");
342
- let C = i ? T(i) : Array;
343
- if (!C) throw new Error("invalid max value: " + i);
347
+ let { max: i = 0, ttl: s, ttlResolution: h = 1, ttlAutopurge: n, updateAgeOnGet: r, updateAgeOnHas: o, allowStale: a, dispose: l, onInsert: c, disposeAfter: u, noDisposeOnSet: f, noUpdateTTL: d, maxSize: p = 0, maxEntrySize: g = 0, sizeCalculation: v, fetchMethod: w, memoMethod: m, noDeleteOnFetchRejection: S, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: _, ignoreFetchAbort: E, backgroundFetchSize: O = 1, perf: k } = e;
348
+ if (this.backgroundFetchSize = O, void 0 !== k && "function" != typeof k?.now) throw new TypeError("perf option must have a now() method if specified");
349
+ if (this.#o = k ?? F, 0 !== i && !T(i)) throw new TypeError("max option must be a nonnegative integer");
350
+ let R = i ? x(i) : Array;
351
+ if (!R) throw new Error("invalid max value: " + i);
344
352
  if (this.#t = i, this.#e = p, this.maxEntrySize = g || this.#e, this.sizeCalculation = v, this.sizeCalculation) {
345
353
  if (!this.#e && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
346
354
  if ("function" != typeof this.sizeCalculation) throw new TypeError("sizeCalculation set to non-function");
347
355
  }
348
- if (void 0 !== w && "function" != typeof w) throw new TypeError("memoMethod must be a function if defined");
349
- if (this.#r = w, void 0 !== m && "function" != typeof m) throw new TypeError("fetchMethod must be a function if specified");
350
- if (this.#n = m, this.#E = !!m, this.#c = /* @__PURE__ */ new Map(), this.#u = Array.from({ length: i }).fill(void 0), this.#f = Array.from({ length: i }).fill(void 0), this.#d = new C(i), this.#p = new C(i), this.#g = 0, this.#v = 0, this.#m = k.create(i), this.#a = 0, this.#l = 0, "function" == typeof l && (this.#i = l), "function" == typeof c && (this.#s = c), "function" == typeof u ? (this.#h = u, this.#w = []) : (this.#h = void 0, this.#w = void 0), this.#_ = !!this.#i, this.#A = !!this.#s, this.#O = !!this.#h, this.noDisposeOnSet = !!f, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!S, this.allowStaleOnFetchRejection = !!y, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!E, 0 !== this.maxEntrySize) {
351
- if (0 !== this.#e && !F(this.#e)) throw new TypeError("maxSize must be a positive integer if specified");
352
- if (!F(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
353
- this.#j();
356
+ if (void 0 !== m && "function" != typeof m) throw new TypeError("memoMethod must be a function if defined");
357
+ if (this.#r = m, void 0 !== w && "function" != typeof w) throw new TypeError("fetchMethod must be a function if specified");
358
+ if (this.#n = w, this.#F = !!w, this.#c = /* @__PURE__ */ new Map(), this.#u = Array.from({ length: i }).fill(void 0), this.#f = Array.from({ length: i }).fill(void 0), this.#d = new R(i), this.#p = new R(i), this.#g = 0, this.#v = 0, this.#w = C.create(i), this.#a = 0, this.#l = 0, "function" == typeof l && (this.#i = l), "function" == typeof c && (this.#s = c), "function" == typeof u ? (this.#h = u, this.#m = []) : (this.#h = void 0, this.#m = void 0), this.#E = !!this.#i, this.#A = !!this.#s, this.#O = !!this.#h, this.noDisposeOnSet = !!f, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!S, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!_, this.ignoreFetchAbort = !!E, 0 !== this.maxEntrySize) {
359
+ if (0 !== this.#e && !T(this.#e)) throw new TypeError("maxSize must be a positive integer if specified");
360
+ if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
361
+ this.#W();
354
362
  }
355
- if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!o, this.ttlResolution = F(h) || 0 === h ? h : 1, this.ttlAutopurge = !!n, this.ttl = s || 0, this.ttl) {
356
- if (!F(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
363
+ if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!o, this.ttlResolution = T(h) || 0 === h ? h : 1, this.ttlAutopurge = !!n, this.ttl = s || 0, this.ttl) {
364
+ if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
357
365
  this.#D();
358
366
  }
359
367
  if (0 === this.#t && 0 === this.ttl && 0 === this.#e) throw new TypeError("At least one of max, maxSize, or ttl is required");
360
368
  if (!this.ttlAutopurge && !this.#t && !this.#e) {
361
369
  let e = "LRU_CACHE_UNBOUNDED";
362
- ((t) => !O.has(t))(e) && (O.add(e), ((t, e, i, s) => {
363
- "function" == typeof A.emitWarning ? A.emitWarning(t, e, i, s) : console.error(`[${i}] ${e}: ${t}`);
370
+ ((t) => !A.has(t))(e) && (A.add(e), ((t, e, i, s) => {
371
+ "function" == typeof z.emitWarning ? z.emitWarning(t, e, i, s) : console.error(`[${i}] ${e}: ${t}`);
364
372
  })("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", e, t));
365
373
  }
366
374
  }
@@ -368,10 +376,10 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
368
376
  return this.#c.has(t) ? 1 / 0 : 0;
369
377
  }
370
378
  #D() {
371
- let t = new x(this.#t), e = new x(this.#t);
372
- this.#y = t, this.#b = e;
379
+ let t = new k(this.#t), e = new k(this.#t);
380
+ this.#b = t, this.#y = e;
373
381
  let i = this.ttlAutopurge ? Array.from({ length: this.#t }) : void 0;
374
- this.#z = i, this.#W = (i, h, n = this.#o.now()) => {
382
+ this.#_ = i, this.#L = (i, h, n = this.#o.now()) => {
375
383
  e[i] = 0 !== h ? n : 0, t[i] = h, s(i, h);
376
384
  }, this.#M = (i) => {
377
385
  e[i] = 0 !== t[i] ? this.#o.now() : 0, s(i, t[i]);
@@ -379,7 +387,7 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
379
387
  let s = this.ttlAutopurge ? (t, e) => {
380
388
  if (i?.[t] && (clearTimeout(i[t]), i[t] = void 0), e && 0 !== e && i) {
381
389
  let h = setTimeout(() => {
382
- this.#C(t) ? (this.#L(this.#u[t], "expire"), i[t] = void 0) : s(t, r(t));
390
+ this.#R(t) ? (this.#j(this.#u[t], "expire"), i[t] = void 0) : s(t, r(t));
383
391
  }, e + 1);
384
392
  h.unref && h.unref(), i[t] = h;
385
393
  }
@@ -408,25 +416,25 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
408
416
  let s = t[i], r = e[i];
409
417
  return s && r ? s - ((h || n()) - r) : 1 / 0;
410
418
  };
411
- this.#C = (i) => {
419
+ this.#R = (i) => {
412
420
  let s = e[i], r = t[i];
413
421
  return !!r && !!s && (h || n()) - s > r;
414
422
  };
415
423
  }
416
424
  #M = () => {};
417
425
  #G = () => {};
418
- #W = () => {};
419
- #C = () => !1;
420
- #j() {
421
- let t = new x(this.#t);
426
+ #L = () => {};
427
+ #R = () => !1;
428
+ #W() {
429
+ let t = new k(this.#t);
422
430
  this.#l = 0, this.#S = t, this.#U = (e) => {
423
431
  this.#l -= t[e], t[e] = 0;
424
432
  }, this.#P = (t, e, i, s) => {
425
- if (!F(i)) {
426
- if (this.#F(e)) return this.backgroundFetchSize;
433
+ if (!T(i)) {
434
+ if (this.#z(e)) return this.backgroundFetchSize;
427
435
  if (!s) throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
428
436
  if ("function" != typeof s) throw new TypeError("sizeCalculation must be a function");
429
- if (i = s(e, t), !F(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
437
+ if (i = s(e, t), !T(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
430
438
  }
431
439
  return i;
432
440
  }, this.#N = (e, i, s) => {
@@ -444,37 +452,37 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
444
452
  return 0;
445
453
  };
446
454
  *#k({ allowStale: t = this.allowStale } = {}) {
447
- if (this.#a) for (let e = this.#v; this.#H(e) && ((t || !this.#C(e)) && (yield e), e !== this.#g);) e = this.#p[e];
455
+ if (this.#a) for (let e = this.#v; this.#H(e) && ((t || !this.#R(e)) && (yield e), e !== this.#g);) e = this.#p[e];
448
456
  }
449
- *#R({ allowStale: t = this.allowStale } = {}) {
450
- if (this.#a) for (let e = this.#g; this.#H(e) && ((t || !this.#C(e)) && (yield e), e !== this.#v);) e = this.#d[e];
457
+ *#C({ allowStale: t = this.allowStale } = {}) {
458
+ if (this.#a) for (let e = this.#g; this.#H(e) && ((t || !this.#R(e)) && (yield e), e !== this.#v);) e = this.#d[e];
451
459
  }
452
460
  #H(t) {
453
461
  return void 0 !== t && this.#c.get(this.#u[t]) === t;
454
462
  }
455
463
  *entries() {
456
- for (let t of this.#k()) void 0 !== this.#f[t] && void 0 !== this.#u[t] && !this.#F(this.#f[t]) && (yield [this.#u[t], this.#f[t]]);
464
+ for (let t of this.#k()) void 0 !== this.#f[t] && void 0 !== this.#u[t] && !this.#z(this.#f[t]) && (yield [this.#u[t], this.#f[t]]);
457
465
  }
458
466
  *rentries() {
459
- for (let t of this.#R()) void 0 !== this.#f[t] && void 0 !== this.#u[t] && !this.#F(this.#f[t]) && (yield [this.#u[t], this.#f[t]]);
467
+ for (let t of this.#C()) void 0 !== this.#f[t] && void 0 !== this.#u[t] && !this.#z(this.#f[t]) && (yield [this.#u[t], this.#f[t]]);
460
468
  }
461
469
  *keys() {
462
470
  for (let t of this.#k()) {
463
471
  let e = this.#u[t];
464
- void 0 !== e && !this.#F(this.#f[t]) && (yield e);
472
+ void 0 !== e && !this.#z(this.#f[t]) && (yield e);
465
473
  }
466
474
  }
467
475
  *rkeys() {
468
- for (let t of this.#R()) {
476
+ for (let t of this.#C()) {
469
477
  let e = this.#u[t];
470
- void 0 !== e && !this.#F(this.#f[t]) && (yield e);
478
+ void 0 !== e && !this.#z(this.#f[t]) && (yield e);
471
479
  }
472
480
  }
473
481
  *values() {
474
- for (let t of this.#k()) void 0 !== this.#f[t] && !this.#F(this.#f[t]) && (yield this.#f[t]);
482
+ for (let t of this.#k()) void 0 !== this.#f[t] && !this.#z(this.#f[t]) && (yield this.#f[t]);
475
483
  }
476
484
  *rvalues() {
477
- for (let t of this.#R()) void 0 !== this.#f[t] && !this.#F(this.#f[t]) && (yield this.#f[t]);
485
+ for (let t of this.#C()) void 0 !== this.#f[t] && !this.#z(this.#f[t]) && (yield this.#f[t]);
478
486
  }
479
487
  [Symbol.iterator]() {
480
488
  return this.entries();
@@ -482,35 +490,35 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
482
490
  [Symbol.toStringTag] = "LRUCache";
483
491
  find(t, e = {}) {
484
492
  for (let i of this.#k()) {
485
- let s = this.#f[i], h = this.#F(s) ? s.__staleWhileFetching : s;
493
+ let s = this.#f[i], h = this.#z(s) ? s.__staleWhileFetching : s;
486
494
  if (void 0 !== h && t(h, this.#u[i], this)) return this.#$(this.#u[i], e);
487
495
  }
488
496
  }
489
497
  forEach(t, e = this) {
490
498
  for (let i of this.#k()) {
491
- let s = this.#f[i], h = this.#F(s) ? s.__staleWhileFetching : s;
499
+ let s = this.#f[i], h = this.#z(s) ? s.__staleWhileFetching : s;
492
500
  void 0 !== h && t.call(e, h, this.#u[i], this);
493
501
  }
494
502
  }
495
503
  rforEach(t, e = this) {
496
- for (let i of this.#R()) {
497
- let s = this.#f[i], h = this.#F(s) ? s.__staleWhileFetching : s;
504
+ for (let i of this.#C()) {
505
+ let s = this.#f[i], h = this.#z(s) ? s.__staleWhileFetching : s;
498
506
  void 0 !== h && t.call(e, h, this.#u[i], this);
499
507
  }
500
508
  }
501
509
  purgeStale() {
502
510
  let t = !1;
503
- for (let e of this.#R({ allowStale: !0 })) this.#C(e) && (this.#L(this.#u[e], "expire"), t = !0);
511
+ for (let e of this.#C({ allowStale: !0 })) this.#R(e) && (this.#j(this.#u[e], "expire"), t = !0);
504
512
  return t;
505
513
  }
506
514
  info(t) {
507
515
  let e = this.#c.get(t);
508
516
  if (void 0 === e) return;
509
- let i = this.#f[e], s = this.#F(i) ? i.__staleWhileFetching : i;
517
+ let i = this.#f[e], s = this.#z(i) ? i.__staleWhileFetching : i;
510
518
  if (void 0 === s) return;
511
519
  let h = { value: s };
512
- if (this.#y && this.#b) {
513
- let t = this.#y[e], i = this.#b[e];
520
+ if (this.#b && this.#y) {
521
+ let t = this.#b[e], i = this.#y[e];
514
522
  t && i && (h.ttl = t - (this.#o.now() - i), h.start = Date.now());
515
523
  }
516
524
  return this.#S && (h.size = this.#S[e]), h;
@@ -518,12 +526,12 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
518
526
  dump() {
519
527
  let t = [];
520
528
  for (let e of this.#k({ allowStale: !0 })) {
521
- let i = this.#u[e], s = this.#f[e], h = this.#F(s) ? s.__staleWhileFetching : s;
529
+ let i = this.#u[e], s = this.#f[e], h = this.#z(s) ? s.__staleWhileFetching : s;
522
530
  if (void 0 === h || void 0 === i) continue;
523
531
  let n = { value: h };
524
- if (this.#y && this.#b) {
525
- n.ttl = this.#y[e];
526
- let t = this.#o.now() - this.#b[e];
532
+ if (this.#b && this.#y) {
533
+ n.ttl = this.#b[e];
534
+ let t = this.#o.now() - this.#y[e];
527
535
  n.start = Math.floor(Date.now() - t);
528
536
  }
529
537
  this.#S && (n.size = this.#S[e]), t.unshift([i, n]);
@@ -541,45 +549,45 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
541
549
  }
542
550
  }
543
551
  set(t, e, i = {}) {
544
- let { status: s = y.hasSubscribers ? {} : void 0 } = i;
552
+ let { status: s = _.hasSubscribers ? {} : void 0 } = i;
545
553
  i.status = s, s && (s.op = "set", s.key = t, void 0 !== e && (s.value = e), s.cache = this);
546
554
  let h = this.#B(t, e, i);
547
- return s && y.hasSubscribers && y.publish(s), h;
555
+ return s && _.hasSubscribers && _.publish(s), h;
548
556
  }
549
557
  #B(t, e, i, s) {
550
- let { ttl: h = this.ttl, start: n, noDisposeOnSet: r = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: a } = i, l = this.#F(e);
558
+ let { ttl: h = this.ttl, start: n, noDisposeOnSet: r = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: a } = i, l = this.#z(e);
551
559
  if (void 0 === e) return a && (a.set = "deleted"), this.delete(t), this;
552
560
  let { noUpdateTTL: c = this.noUpdateTTL } = i;
553
561
  a && !l && (a.value = e);
554
562
  let u = this.#P(t, e, i.size || 0, o, a);
555
- if (this.maxEntrySize && u > this.maxEntrySize) return this.#L(t, "set"), a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this;
563
+ if (this.maxEntrySize && u > this.maxEntrySize) return this.#j(t, "set"), a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this;
556
564
  let f = 0 === this.#a ? void 0 : this.#c.get(t);
557
- if (void 0 === f) f = 0 === this.#a ? this.#v : 0 !== this.#m.length ? this.#m.pop() : this.#a === this.#t ? this.#I(!1) : this.#a, this.#u[f] = t, this.#f[f] = e, this.#c.set(t, f), this.#d[this.#v] = f, this.#p[f] = this.#v, this.#v = f, this.#a++, this.#N(f, u, a), a && (a.set = "add"), c = !1, this.#A && !l && this.#s?.(e, t, "add");
565
+ if (void 0 === f) f = 0 === this.#a ? this.#v : 0 !== this.#w.length ? this.#w.pop() : this.#a === this.#t ? this.#I(!1) : this.#a, this.#u[f] = t, this.#f[f] = e, this.#c.set(t, f), this.#d[this.#v] = f, this.#p[f] = this.#v, this.#v = f, this.#a++, this.#N(f, u, a), a && (a.set = "add"), c = !1, this.#A && !l && this.#s?.(e, t, "add");
558
566
  else {
559
567
  this.#x(f);
560
568
  let i = this.#f[f];
561
569
  if (e !== i) {
562
- if (!r) if (this.#F(i)) {
570
+ if (!r) if (this.#z(i)) {
563
571
  i !== s && i.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
564
572
  let { __staleWhileFetching: h } = i;
565
- void 0 !== h && h !== e && (this.#_ && this.#i?.(h, t, "set"), this.#O && this.#w?.push([
573
+ void 0 !== h && h !== e && (this.#E && this.#i?.(h, t, "set"), this.#O && this.#m?.push([
566
574
  h,
567
575
  t,
568
576
  "set"
569
577
  ]));
570
- } else this.#_ && this.#i?.(i, t, "set"), this.#O && this.#w?.push([
578
+ } else this.#E && this.#i?.(i, t, "set"), this.#O && this.#m?.push([
571
579
  i,
572
580
  t,
573
581
  "set"
574
582
  ]);
575
583
  if (this.#U(f), this.#N(f, u, a), this.#f[f] = e, !l) {
576
- let s = i && this.#F(i) ? i.__staleWhileFetching : i, h = void 0 === s ? "add" : e !== s ? "replace" : "update";
584
+ let s = i && this.#z(i) ? i.__staleWhileFetching : i, h = void 0 === s ? "add" : e !== s ? "replace" : "update";
577
585
  a && (a.set = h, void 0 !== s && (a.oldValue = s)), this.#A && this.onInsert?.(e, t, h);
578
586
  }
579
587
  } else l || (a && (a.set = "update"), this.#A && this.onInsert?.(e, t, "update"));
580
588
  }
581
- if (0 !== h && !this.#y && this.#D(), this.#y && (c || this.#W(f, h, n), a && this.#G(a, f)), !r && this.#O && this.#w) {
582
- let t, e = this.#w;
589
+ if (0 !== h && !this.#b && this.#D(), this.#b && (c || this.#L(f, h, n), a && this.#G(a, f)), !r && this.#O && this.#m) {
590
+ let t, e = this.#m;
583
591
  for (; t = e?.shift();) this.#h?.(...t);
584
592
  }
585
593
  return this;
@@ -588,58 +596,58 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
588
596
  try {
589
597
  for (; this.#a;) {
590
598
  let t = this.#f[this.#g];
591
- if (this.#I(!0), this.#F(t)) {
599
+ if (this.#I(!0), this.#z(t)) {
592
600
  if (t.__staleWhileFetching) return t.__staleWhileFetching;
593
601
  } else if (void 0 !== t) return t;
594
602
  }
595
603
  } finally {
596
- if (this.#O && this.#w) {
597
- let t, e = this.#w;
604
+ if (this.#O && this.#m) {
605
+ let t, e = this.#m;
598
606
  for (; t = e?.shift();) this.#h?.(...t);
599
607
  }
600
608
  }
601
609
  }
602
610
  #I(t) {
603
- let e = this.#g, i = this.#u[e], s = this.#f[e], h = this.#F(s);
611
+ let e = this.#g, i = this.#u[e], s = this.#f[e], h = this.#z(s);
604
612
  h && s.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
605
613
  let n = h ? s.__staleWhileFetching : s;
606
- return (this.#_ || this.#O) && void 0 !== n && (this.#_ && this.#i?.(n, i, "evict"), this.#O && this.#w?.push([
614
+ return (this.#E || this.#O) && void 0 !== n && (this.#E && this.#i?.(n, i, "evict"), this.#O && this.#m?.push([
607
615
  n,
608
616
  i,
609
617
  "evict"
610
- ])), this.#U(e), this.#z?.[e] && (clearTimeout(this.#z[e]), this.#z[e] = void 0), t && (this.#u[e] = void 0, this.#f[e] = void 0, this.#m.push(e)), 1 === this.#a ? (this.#g = this.#v = 0, this.#m.length = 0) : this.#g = this.#d[e], this.#c.delete(i), this.#a--, e;
618
+ ])), this.#U(e), this.#_?.[e] && (clearTimeout(this.#_[e]), this.#_[e] = void 0), t && (this.#u[e] = void 0, this.#f[e] = void 0, this.#w.push(e)), 1 === this.#a ? (this.#g = this.#v = 0, this.#w.length = 0) : this.#g = this.#d[e], this.#c.delete(i), this.#a--, e;
611
619
  }
612
620
  has(t, e = {}) {
613
- let { status: i = y.hasSubscribers ? {} : void 0 } = e;
621
+ let { status: i = _.hasSubscribers ? {} : void 0 } = e;
614
622
  e.status = i, i && (i.op = "has", i.key = t, i.cache = this);
615
- let s = this.#X(t, e);
616
- return y.hasSubscribers && y.publish(i), s;
623
+ let s = this.#q(t, e);
624
+ return _.hasSubscribers && _.publish(i), s;
617
625
  }
618
- #X(t, e = {}) {
626
+ #q(t, e = {}) {
619
627
  let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, h = this.#c.get(t);
620
628
  if (void 0 !== h) {
621
629
  let t = this.#f[h];
622
- if (this.#F(t) && void 0 === t.__staleWhileFetching) return !1;
623
- if (!this.#C(h)) return i && this.#M(h), s && (s.has = "hit", this.#G(s, h)), !0;
630
+ if (this.#z(t) && void 0 === t.__staleWhileFetching) return !1;
631
+ if (!this.#R(h)) return i && this.#M(h), s && (s.has = "hit", this.#G(s, h)), !0;
624
632
  s && (s.has = "stale", this.#G(s, h));
625
633
  } else s && (s.has = "miss");
626
634
  return !1;
627
635
  }
628
636
  peek(t, e = {}) {
629
- let { status: i = E() ? {} : void 0 } = e;
637
+ let { status: i = O() ? {} : void 0 } = e;
630
638
  i && (i.op = "peek", i.key = t, i.cache = this), e.status = i;
631
- let s = this.#Y(t, e);
632
- return y.hasSubscribers && y.publish(i), s;
639
+ let s = this.#V(t, e);
640
+ return _.hasSubscribers && _.publish(i), s;
633
641
  }
634
- #Y(t, e) {
642
+ #V(t, e) {
635
643
  let { status: i, allowStale: s = this.allowStale } = e, h = this.#c.get(t);
636
- if (void 0 === h || !s && this.#C(h)) return void (i && (i.peek = void 0 === h ? "miss" : "stale"));
637
- let n = this.#f[h], r = this.#F(n) ? n.__staleWhileFetching : n;
644
+ if (void 0 === h || !s && this.#R(h)) return void (i && (i.peek = void 0 === h ? "miss" : "stale"));
645
+ let n = this.#f[h], r = this.#z(n) ? n.__staleWhileFetching : n;
638
646
  return i && (void 0 !== r ? (i.peek = "hit", i.value = r) : i.peek = "miss"), r;
639
647
  }
640
648
  #T(t, e, i, s) {
641
649
  let h = void 0 === e ? void 0 : this.#f[e];
642
- if (this.#F(h)) return h;
650
+ if (this.#z(h)) return h;
643
651
  let n = new AbortController(), { signal: r } = i;
644
652
  r?.addEventListener("abort", () => n.abort(r.reason), { signal: n.signal });
645
653
  let o = {
@@ -650,10 +658,10 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
650
658
  let { aborted: r } = n.signal, a = i.ignoreFetchAbort && void 0 !== s, u = i.ignoreFetchAbort || !(!i.allowStaleOnFetchAbort || void 0 === s);
651
659
  if (i.status && (r && !h ? (i.status.fetchAborted = !0, i.status.fetchError = n.signal.reason, a && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), r && !a && !h) return l(n.signal.reason, u);
652
660
  let f = c, d = this.#f[e];
653
- return (d === c || void 0 === d && a && h) && (void 0 === s ? void 0 !== f.__staleWhileFetching ? this.#f[e] = f.__staleWhileFetching : this.#L(t, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.#B(t, s, o.options, f))), s;
661
+ return (d === c || void 0 === d && a && h) && (void 0 === s ? void 0 !== f.__staleWhileFetching ? this.#f[e] = f.__staleWhileFetching : this.#j(t, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.#B(t, s, o.options, f))), s;
654
662
  }, l = (s, h) => {
655
663
  let { aborted: r } = n.signal, o = r && i.allowStaleOnFetchAbort, a = o || i.allowStaleOnFetchRejection, l = a || i.noDeleteOnFetchRejection, u = c;
656
- if (this.#f[e] === c && (!l || !h && void 0 === u.__staleWhileFetching ? this.#L(t, "fetch") : o || (this.#f[e] = u.__staleWhileFetching)), a) return i.status && void 0 !== u.__staleWhileFetching && (i.status.returnedStale = !0), u.__staleWhileFetching;
664
+ if (this.#f[e] === c && (!l || !h && void 0 === u.__staleWhileFetching ? this.#j(t, "fetch") : o || (this.#f[e] = u.__staleWhileFetching)), a) return i.status && void 0 !== u.__staleWhileFetching && (i.status.returnedStale = !0), u.__staleWhileFetching;
657
665
  if (u.__returned === u) throw s;
658
666
  };
659
667
  i.status && (i.status.fetchDispatched = !0);
@@ -672,26 +680,26 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
672
680
  status: void 0
673
681
  }), e = this.#c.get(t)) : this.#f[e] = u, u;
674
682
  }
675
- #F(t) {
676
- if (!this.#E) return !1;
683
+ #z(t) {
684
+ if (!this.#F) return !1;
677
685
  let e = t;
678
686
  return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
679
687
  }
680
688
  fetch(t, e = {}) {
681
- let i = z.hasSubscribers, { status: s = E() ? {} : void 0 } = e;
689
+ let i = E.hasSubscribers, { status: s = O() ? {} : void 0 } = e;
682
690
  e.status = s, s && e.context && (s.context = e.context);
683
- let h = this.#q(t, e);
684
- return s && i && (s.trace = !0, z.tracePromise(() => h, s).catch(() => {})), h;
691
+ let h = this.#X(t, e);
692
+ return s && i && (s.trace = !0, E.tracePromise(() => h, s).catch(() => {})), h;
685
693
  }
686
- async #q(t, e = {}) {
687
- let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: h = this.noDeleteOnStaleGet, ttl: n = this.ttl, noDisposeOnSet: r = this.noDisposeOnSet, size: o = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: d = this.allowStaleOnFetchAbort, context: p, forceRefresh: g = !1, status: v, signal: m } = e;
688
- if (v && (v.op = "fetch", v.key = t, g && (v.forceRefresh = !0), v.cache = this), !this.#E) return v && (v.fetch = "get"), this.#$(t, {
694
+ async #X(t, e = {}) {
695
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: h = this.noDeleteOnStaleGet, ttl: n = this.ttl, noDisposeOnSet: r = this.noDisposeOnSet, size: o = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: d = this.allowStaleOnFetchAbort, context: p, forceRefresh: g = !1, status: v, signal: w } = e;
696
+ if (v && (v.op = "fetch", v.key = t, g && (v.forceRefresh = !0), v.cache = this), !this.#F) return v && (v.fetch = "get"), this.#$(t, {
689
697
  allowStale: i,
690
698
  updateAgeOnGet: s,
691
699
  noDeleteOnStaleGet: h,
692
700
  status: v
693
701
  });
694
- let w = {
702
+ let m = {
695
703
  allowStale: i,
696
704
  updateAgeOnGet: s,
697
705
  noDeleteOnStaleGet: h,
@@ -705,43 +713,43 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
705
713
  allowStaleOnFetchAbort: d,
706
714
  ignoreFetchAbort: f,
707
715
  status: v,
708
- signal: m
716
+ signal: w
709
717
  }, S = this.#c.get(t);
710
718
  if (void 0 === S) {
711
719
  v && (v.fetch = "miss");
712
- let e = this.#T(t, S, w, p);
720
+ let e = this.#T(t, S, m, p);
713
721
  return e.__returned = e;
714
722
  }
715
723
  {
716
724
  let e = this.#f[S];
717
- if (this.#F(e)) {
725
+ if (this.#z(e)) {
718
726
  let t = i && void 0 !== e.__staleWhileFetching;
719
727
  return v && (v.fetch = "inflight", t && (v.returnedStale = !0)), t ? e.__staleWhileFetching : e.__returned = e;
720
728
  }
721
- let h = this.#C(S);
729
+ let h = this.#R(S);
722
730
  if (!g && !h) return v && (v.fetch = "hit"), this.#x(S), s && this.#M(S), v && this.#G(v, S), e;
723
- let n = this.#T(t, S, w, p), r = void 0 !== n.__staleWhileFetching && i;
731
+ let n = this.#T(t, S, m, p), r = void 0 !== n.__staleWhileFetching && i;
724
732
  return v && (v.fetch = h ? "stale" : "refresh", r && h && (v.returnedStale = !0)), r ? n.__staleWhileFetching : n.__returned = n;
725
733
  }
726
734
  }
727
735
  forceFetch(t, e = {}) {
728
- let i = z.hasSubscribers, { status: s = E() ? {} : void 0 } = e;
736
+ let i = E.hasSubscribers, { status: s = O() ? {} : void 0 } = e;
729
737
  e.status = s, s && e.context && (s.context = e.context);
730
- let h = this.#K(t, e);
731
- return s && i && (s.trace = !0, z.tracePromise(() => h, s).catch(() => {})), h;
738
+ let h = this.#Y(t, e);
739
+ return s && i && (s.trace = !0, E.tracePromise(() => h, s).catch(() => {})), h;
732
740
  }
733
- async #K(t, e = {}) {
734
- let i = await this.#q(t, e);
741
+ async #Y(t, e = {}) {
742
+ let i = await this.#X(t, e);
735
743
  if (void 0 === i) throw new Error("fetch() returned undefined");
736
744
  return i;
737
745
  }
738
746
  memo(t, e = {}) {
739
- let { status: i = y.hasSubscribers ? {} : void 0 } = e;
747
+ let { status: i = _.hasSubscribers ? {} : void 0 } = e;
740
748
  e.status = i, i && (i.op = "memo", i.key = t, e.context && (i.context = e.context), i.cache = this);
741
- let s = this.#Q(t, e);
742
- return i && (i.value = s), y.hasSubscribers && y.publish(i), s;
749
+ let s = this.#J(t, e);
750
+ return i && (i.value = s), _.hasSubscribers && _.publish(i), s;
743
751
  }
744
- #Q(t, e = {}) {
752
+ #J(t, e = {}) {
745
753
  let i = this.#r;
746
754
  if (!i) throw new Error("no memoMethod provided to constructor");
747
755
  let { context: s, status: h, forceRefresh: n, ...r } = e;
@@ -755,28 +763,28 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
755
763
  return h && (h.value = l), this.#B(t, l, r), l;
756
764
  }
757
765
  get(t, e = {}) {
758
- let { status: i = y.hasSubscribers ? {} : void 0 } = e;
766
+ let { status: i = _.hasSubscribers ? {} : void 0 } = e;
759
767
  e.status = i, i && (i.op = "get", i.key = t, i.cache = this);
760
768
  let s = this.#$(t, e);
761
- return i && (void 0 !== s && (i.value = s), y.hasSubscribers && y.publish(i)), s;
769
+ return i && (void 0 !== s && (i.value = s), _.hasSubscribers && _.publish(i)), s;
762
770
  }
763
771
  #$(t, e = {}) {
764
772
  let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: h = this.noDeleteOnStaleGet, status: n } = e, r = this.#c.get(t);
765
773
  if (void 0 === r) return void (n && (n.get = "miss"));
766
- let o = this.#f[r], a = this.#F(o);
767
- return n && this.#G(n, r), this.#C(r) ? a ? (n && (n.get = "stale-fetching"), i && void 0 !== o.__staleWhileFetching ? (n && (n.returnedStale = !0), o.__staleWhileFetching) : void 0) : (h || this.#L(t, "expire"), n && (n.get = "stale"), i ? (n && (n.returnedStale = !0), o) : void 0) : (n && (n.get = a ? "fetching" : "hit"), this.#x(r), s && this.#M(r), a ? o.__staleWhileFetching : o);
774
+ let o = this.#f[r], a = this.#z(o);
775
+ return n && this.#G(n, r), this.#R(r) ? a ? (n && (n.get = "stale-fetching"), i && void 0 !== o.__staleWhileFetching ? (n && (n.returnedStale = !0), o.__staleWhileFetching) : void 0) : (h || this.#j(t, "expire"), n && (n.get = "stale"), i ? (n && (n.returnedStale = !0), o) : void 0) : (n && (n.get = a ? "fetching" : "hit"), this.#x(r), s && this.#M(r), a ? o.__staleWhileFetching : o);
768
776
  }
769
- #V(t, e) {
777
+ #K(t, e) {
770
778
  this.#p[e] = t, this.#d[t] = e;
771
779
  }
772
780
  #x(t) {
773
- t !== this.#v && (t === this.#g ? this.#g = this.#d[t] : this.#V(this.#p[t], this.#d[t]), this.#V(this.#v, t), this.#v = t);
781
+ t !== this.#v && (t === this.#g ? this.#g = this.#d[t] : this.#K(this.#p[t], this.#d[t]), this.#K(this.#v, t), this.#v = t);
774
782
  }
775
783
  delete(t) {
776
- return this.#L(t, "delete");
784
+ return this.#j(t, "delete");
777
785
  }
778
- #L(t, e) {
779
- y.hasSubscribers && y.publish({
786
+ #j(t, e) {
787
+ _.hasSubscribers && _.publish({
780
788
  op: "delete",
781
789
  delete: e,
782
790
  key: t,
@@ -785,11 +793,11 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
785
793
  let i = !1;
786
794
  if (0 !== this.#a) {
787
795
  let s = this.#c.get(t);
788
- if (void 0 !== s) if (this.#z?.[s] && (clearTimeout(this.#z[s]), this.#z[s] = void 0), i = !0, 1 === this.#a) this.#J(e);
796
+ if (void 0 !== s) if (this.#_?.[s] && (clearTimeout(this.#_[s]), this.#_[s] = void 0), i = !0, 1 === this.#a) this.#Q(e);
789
797
  else {
790
798
  this.#U(s);
791
799
  let i = this.#f[s];
792
- if (this.#F(i) ? i.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#_ || this.#O) && (this.#_ && this.#i?.(i, t, e), this.#O && this.#w?.push([
800
+ if (this.#z(i) ? i.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#E || this.#O) && (this.#E && this.#i?.(i, t, e), this.#O && this.#m?.push([
793
801
  i,
794
802
  t,
795
803
  e
@@ -801,42 +809,42 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
801
809
  let e = this.#d[s];
802
810
  this.#p[e] = this.#p[s];
803
811
  }
804
- this.#a--, this.#m.push(s);
812
+ this.#a--, this.#w.push(s);
805
813
  }
806
814
  }
807
- if (this.#O && this.#w?.length) {
808
- let t, e = this.#w;
815
+ if (this.#O && this.#m?.length) {
816
+ let t, e = this.#m;
809
817
  for (; t = e?.shift();) this.#h?.(...t);
810
818
  }
811
819
  return i;
812
820
  }
813
821
  clear() {
814
- return this.#J("delete");
822
+ return this.#Q("delete");
815
823
  }
816
- #J(t) {
817
- for (let e of this.#R({ allowStale: !0 })) {
824
+ #Q(t) {
825
+ for (let e of this.#C({ allowStale: !0 })) {
818
826
  let i = this.#f[e];
819
- if (this.#F(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
827
+ if (this.#z(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
820
828
  else {
821
829
  let s = this.#u[e];
822
- this.#_ && this.#i?.(i, s, t), this.#O && this.#w?.push([
830
+ this.#E && this.#i?.(i, s, t), this.#O && this.#m?.push([
823
831
  i,
824
832
  s,
825
833
  t
826
834
  ]);
827
835
  }
828
836
  }
829
- if (this.#c.clear(), this.#f.fill(void 0), this.#u.fill(void 0), this.#y && this.#b) {
830
- this.#y.fill(0), this.#b.fill(0);
831
- for (let t of this.#z ?? []) void 0 !== t && clearTimeout(t);
832
- this.#z?.fill(void 0);
837
+ if (this.#c.clear(), this.#f.fill(void 0), this.#u.fill(void 0), this.#b && this.#y) {
838
+ this.#b.fill(0), this.#y.fill(0);
839
+ for (let t of this.#_ ?? []) void 0 !== t && clearTimeout(t);
840
+ this.#_?.fill(void 0);
833
841
  }
834
- if (this.#S && this.#S.fill(0), this.#g = 0, this.#v = 0, this.#m.length = 0, this.#l = 0, this.#a = 0, this.#O && this.#w) {
835
- let t, e = this.#w;
842
+ if (this.#S && this.#S.fill(0), this.#g = 0, this.#v = 0, this.#w.length = 0, this.#l = 0, this.#a = 0, this.#O && this.#m) {
843
+ let t, e = this.#m;
836
844
  for (; t = e?.shift();) this.#h?.(...t);
837
845
  }
838
846
  }
839
- }, C = class {
847
+ }, W = class {
840
848
  static defaultOptions = {
841
849
  max: 1e3,
842
850
  ttl: 18e5
@@ -881,28 +889,21 @@ var b = { hasSubscribers: !1 }, y = b, z = b, _ = "object" == typeof performance
881
889
  let e = t;
882
890
  e || (e = this.cache), e.clear();
883
891
  }
884
- }, j = ((e, i) => {
885
- let s = {};
886
- for (var h in e) t(s, h, {
887
- get: e[h],
888
- enumerable: !0
889
- });
890
- return i || t(s, Symbol.toStringTag, { value: "Module" }), s;
891
- })({
892
- clear: () => $,
893
- count: () => N,
894
- createCache: () => W,
895
- get: () => G,
896
- getCacheObject: () => M,
897
- has: () => P,
898
- keys: () => B,
899
- maxSize: () => I,
900
- peek: () => H,
901
- remove: () => U,
902
- set: () => L
892
+ }, D = /* @__PURE__ */ e({
893
+ clear: () => B,
894
+ count: () => I,
895
+ createCache: () => M,
896
+ get: () => U,
897
+ getCacheObject: () => j,
898
+ has: () => N,
899
+ keys: () => q,
900
+ maxSize: () => H,
901
+ peek: () => $,
902
+ remove: () => P,
903
+ set: () => G
903
904
  });
904
- const D = /* @__PURE__ */ new Map();
905
- async function W(t, e = void 0) {
905
+ const L = /* @__PURE__ */ new Map();
906
+ async function M(t, e = void 0) {
906
907
  const i = {
907
908
  max: 1e3,
908
909
  ttl: 18e5
@@ -912,47 +913,47 @@ async function W(t, e = void 0) {
912
913
  ...i,
913
914
  ...e
914
915
  });
915
- const h = C.createCache(s);
916
- return D.set(t, h), h;
916
+ const h = W.createCache(s);
917
+ return L.set(t, h), h;
917
918
  }
918
- async function M(t = "") {
919
+ async function j(t = "") {
919
920
  let e;
920
- return e = D.has(t) ? D.get(t) : await W(t), e;
921
- }
922
- async function L(t, e, i = "") {
923
- const s = await M(i);
924
- return !!s && (C.set(t, e, s), !0);
921
+ return e = L.has(t) ? L.get(t) : await M(t), e;
925
922
  }
926
- async function G(t, e = "") {
927
- const i = await M(e);
928
- if (i) return C.get(t, i);
923
+ async function G(t, e, i = "") {
924
+ const s = await j(i);
925
+ return !!s && (W.set(t, e, s), !0);
929
926
  }
930
927
  async function U(t, e = "") {
931
- const i = await M(e);
932
- if (i) return C.remove(t, i);
928
+ const i = await j(e);
929
+ if (i) return W.get(t, i);
933
930
  }
934
931
  async function P(t, e = "") {
935
- const i = await M(e);
936
- return !!i && C.has(t, i);
932
+ const i = await j(e);
933
+ if (i) return W.remove(t, i);
937
934
  }
938
- async function N(t = "") {
939
- const e = await M(t);
940
- return e ? C.count(e) : 0;
935
+ async function N(t, e = "") {
936
+ const i = await j(e);
937
+ return !!i && W.has(t, i);
941
938
  }
942
939
  async function I(t = "") {
943
- const e = await M(t);
944
- return e ? C.maxSize(e) : 0;
940
+ const e = await j(t);
941
+ return e ? W.count(e) : 0;
945
942
  }
946
- async function H(t, e = "") {
947
- const i = await M(e);
948
- return !!i && C.peek(t, i);
943
+ async function H(t = "") {
944
+ const e = await j(t);
945
+ return e ? W.maxSize(e) : 0;
949
946
  }
950
- async function $(t = "") {
951
- const e = await M(t);
952
- return e && C.clear(e), !1;
947
+ async function $(t, e = "") {
948
+ const i = await j(e);
949
+ return !!i && W.peek(t, i);
953
950
  }
954
951
  async function B(t = "") {
955
- const e = await M(t);
956
- if (e) return C.keys(e);
952
+ const e = await j(t);
953
+ return e && W.clear(e), !1;
954
+ }
955
+ async function q(t = "") {
956
+ const e = await j(t);
957
+ if (e) return W.keys(e);
957
958
  }
958
- a(j);
959
+ l(D);