xframelib 1.2.2 → 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.
- package/dist/assets/worker-iconv-BSz95ymC.js +5454 -0
- package/dist/assets/{worker-webcache-C19JH-z-.js → worker-webcache-Cn8ZqKeY.js} +275 -274
- package/dist/assets/{worker-xmath-qvisRwvn.js → worker-xmath-CfyCnEAw.js} +144 -142
- package/dist/controls/layoutcontainer/LayoutManager.d.ts +4 -0
- package/dist/controls/layoutcontainer/layout.vue.d.ts +8 -8
- package/dist/controls/splitpanes/pane.vue.d.ts +7 -0
- package/dist/controls/splitpanes/splitpanes.vue.d.ts +3 -0
- package/dist/controls-CUpF2Uye.js +2 -0
- package/dist/entries/controls.d.ts +4 -0
- package/dist/entries/controls.js +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/AxiosHelper.d.ts +97 -1
- package/dist/utils/FetchHelper.d.ts +1 -1
- package/dist/utils/FileUpload.d.ts +11 -2
- package/dist/utils/index.js +1 -0
- package/dist/utils-BbwKxKXj.js +1 -0
- package/dist/workers/index.js +1 -0
- package/dist/workers-KrixIhH4.js +1 -0
- package/dist/workerservice/frontWorker.d.ts +7 -3
- package/dist/workerservice/index.d.ts +4 -3
- package/dist/workerservice/index.js +1 -0
- package/dist/workerservice-BInFtqH4.js +1 -0
- package/package.json +44 -16
- package/dist/assets/worker-iconv-CDoMtJO_.js +0 -5418
- package/dist/index.js.js +0 -1
|
@@ -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
|
-
*/
|
|
7
|
-
|
|
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
|
|
18
|
+
return l(t, e), [i, [i]];
|
|
11
19
|
},
|
|
12
|
-
deserialize: (t) => (t.start(), function(t) {
|
|
13
|
-
const
|
|
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:
|
|
16
|
-
if (!
|
|
17
|
-
const s =
|
|
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(
|
|
27
|
+
s(e);
|
|
20
28
|
} finally {
|
|
21
|
-
|
|
29
|
+
i.delete(e.id);
|
|
22
30
|
}
|
|
23
|
-
}),
|
|
31
|
+
}), g(t, i, [], e);
|
|
24
32
|
}(t))
|
|
25
33
|
}], ["throw", {
|
|
26
|
-
canHandle: (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
|
|
47
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
73
|
+
e[f.slice(-1)[0]] = S(o.data.value), p = !0;
|
|
66
74
|
break;
|
|
67
75
|
case "APPLY":
|
|
68
|
-
p = s.apply(
|
|
76
|
+
p = s.apply(e, d);
|
|
69
77
|
break;
|
|
70
78
|
case "CONSTRUCT":
|
|
71
79
|
p = function(t) {
|
|
72
|
-
return Object.assign(t, { [
|
|
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
|
-
|
|
79
|
-
return
|
|
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 (
|
|
96
|
+
} catch (g) {
|
|
89
97
|
p = {
|
|
90
|
-
value:
|
|
91
|
-
[
|
|
98
|
+
value: g,
|
|
99
|
+
[r]: 0
|
|
92
100
|
};
|
|
93
101
|
}
|
|
94
102
|
Promise.resolve(p).catch((t) => ({
|
|
95
103
|
value: t,
|
|
96
|
-
[
|
|
97
|
-
})).then((
|
|
98
|
-
const [s,
|
|
99
|
-
|
|
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 [
|
|
109
|
+
const [i, s] = m({
|
|
102
110
|
value: /* @__PURE__ */ new TypeError("Unserializable return value"),
|
|
103
|
-
[
|
|
111
|
+
[r]: 0
|
|
104
112
|
});
|
|
105
|
-
|
|
113
|
+
e.postMessage(Object.assign(Object.assign({}, i), { id: a }), s);
|
|
106
114
|
});
|
|
107
|
-
}),
|
|
115
|
+
}), e.start && e.start();
|
|
108
116
|
}
|
|
109
|
-
function
|
|
117
|
+
function c(t) {
|
|
110
118
|
(function(t) {
|
|
111
119
|
return "MessagePort" === t.constructor.name;
|
|
112
120
|
})(t) && t.close();
|
|
113
121
|
}
|
|
114
|
-
function
|
|
122
|
+
function u(t) {
|
|
115
123
|
if (t) throw new Error("Proxy has been released and is not useable");
|
|
116
124
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
119
|
-
|
|
125
|
+
function f(t) {
|
|
126
|
+
return y(t, /* @__PURE__ */ new Map(), { type: "RELEASE" }).then(() => {
|
|
127
|
+
c(t);
|
|
120
128
|
});
|
|
121
129
|
}
|
|
122
|
-
const
|
|
123
|
-
const e = (
|
|
124
|
-
|
|
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
|
|
134
|
+
function g(t, e, i = [], n = function() {}) {
|
|
127
135
|
let r = !1;
|
|
128
136
|
const o = new Proxy(n, {
|
|
129
|
-
get(
|
|
130
|
-
if (
|
|
137
|
+
get(s, n) {
|
|
138
|
+
if (u(r), n === h) return () => {
|
|
131
139
|
(function(t) {
|
|
132
|
-
|
|
133
|
-
})(o),
|
|
140
|
+
p && p.unregister(t);
|
|
141
|
+
})(o), f(t), e.clear(), r = !0;
|
|
134
142
|
};
|
|
135
143
|
if ("then" === n) {
|
|
136
|
-
if (0 ===
|
|
137
|
-
const
|
|
144
|
+
if (0 === i.length) return { then: () => o };
|
|
145
|
+
const s = y(t, e, {
|
|
138
146
|
type: "GET",
|
|
139
|
-
path:
|
|
140
|
-
}).then(
|
|
141
|
-
return
|
|
147
|
+
path: i.map((t) => t.toString())
|
|
148
|
+
}).then(S);
|
|
149
|
+
return s.then.bind(s);
|
|
142
150
|
}
|
|
143
|
-
return
|
|
151
|
+
return g(t, e, [...i, n]);
|
|
144
152
|
},
|
|
145
|
-
set(
|
|
146
|
-
|
|
153
|
+
set(s, h, n) {
|
|
154
|
+
u(r);
|
|
147
155
|
const [o, a] = m(n);
|
|
148
|
-
return
|
|
156
|
+
return y(t, e, {
|
|
149
157
|
type: "SET",
|
|
150
|
-
path: [...
|
|
158
|
+
path: [...i, h].map((t) => t.toString()),
|
|
151
159
|
value: o
|
|
152
|
-
}, a).then(
|
|
160
|
+
}, a).then(S);
|
|
153
161
|
},
|
|
154
|
-
apply(
|
|
155
|
-
|
|
156
|
-
const a =
|
|
157
|
-
if (a ===
|
|
158
|
-
if ("bind" === a) return
|
|
159
|
-
const [l,
|
|
160
|
-
return
|
|
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:
|
|
170
|
+
path: i.map((t) => t.toString()),
|
|
163
171
|
argumentList: l
|
|
164
|
-
},
|
|
172
|
+
}, c).then(S);
|
|
165
173
|
},
|
|
166
|
-
construct(
|
|
167
|
-
|
|
168
|
-
const [n, o] =
|
|
169
|
-
return
|
|
174
|
+
construct(s, h) {
|
|
175
|
+
u(r);
|
|
176
|
+
const [n, o] = v(h);
|
|
177
|
+
return y(t, e, {
|
|
170
178
|
type: "CONSTRUCT",
|
|
171
|
-
path:
|
|
179
|
+
path: i.map((t) => t.toString()),
|
|
172
180
|
argumentList: n
|
|
173
|
-
}, o).then(
|
|
181
|
+
}, o).then(S);
|
|
174
182
|
}
|
|
175
183
|
});
|
|
176
184
|
return function(t, e) {
|
|
177
|
-
const i = (
|
|
178
|
-
|
|
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
|
|
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
|
|
194
|
+
const w = /* @__PURE__ */ new WeakMap();
|
|
187
195
|
function m(t) {
|
|
188
|
-
for (const [e, i] of
|
|
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
|
-
},
|
|
207
|
+
}, w.get(t) || []];
|
|
200
208
|
}
|
|
201
|
-
function
|
|
209
|
+
function S(t) {
|
|
202
210
|
switch (t.type) {
|
|
203
|
-
case "HANDLER": return
|
|
211
|
+
case "HANDLER": return a.get(t.name).deserialize(t.value);
|
|
204
212
|
case "RAW": return t.value;
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
|
-
function
|
|
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 },
|
|
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
|
-
},
|
|
225
|
+
}, C = class t {
|
|
218
226
|
heap;
|
|
219
227
|
length;
|
|
220
228
|
static #t = !1;
|
|
221
229
|
static create(e) {
|
|
222
|
-
let i =
|
|
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
|
-
#
|
|
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.#
|
|
288
|
-
ttls: t.#
|
|
289
|
-
autopurgeTimers: t.#
|
|
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.#
|
|
303
|
-
isBackgroundFetch: (e) => t.#
|
|
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.#
|
|
308
|
-
isStale: (e) => t.#
|
|
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:
|
|
340
|
-
if (this.backgroundFetchSize =
|
|
341
|
-
if (this.#o =
|
|
342
|
-
let
|
|
343
|
-
if (!
|
|
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 !==
|
|
349
|
-
if (this.#r =
|
|
350
|
-
if (this.#n =
|
|
351
|
-
if (0 !== this.#e && !
|
|
352
|
-
if (!
|
|
353
|
-
this.#
|
|
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 = !!
|
|
356
|
-
if (!
|
|
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) => !
|
|
363
|
-
"function" == typeof
|
|
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
|
|
372
|
-
this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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
|
-
#
|
|
419
|
-
#
|
|
420
|
-
#
|
|
421
|
-
let t = new
|
|
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 (!
|
|
426
|
-
if (this.#
|
|
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), !
|
|
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.#
|
|
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
|
-
*#
|
|
450
|
-
if (this.#a) for (let e = this.#g; this.#H(e) && ((t || !this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
472
|
+
void 0 !== e && !this.#z(this.#f[t]) && (yield e);
|
|
465
473
|
}
|
|
466
474
|
}
|
|
467
475
|
*rkeys() {
|
|
468
|
-
for (let t of this.#
|
|
476
|
+
for (let t of this.#C()) {
|
|
469
477
|
let e = this.#u[t];
|
|
470
|
-
void 0 !== e && !this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
497
|
-
let s = this.#f[i], h = this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
513
|
-
let t = this.#
|
|
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.#
|
|
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.#
|
|
525
|
-
n.ttl = this.#
|
|
526
|
-
let t = this.#o.now() - this.#
|
|
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 =
|
|
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 &&
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
582
|
-
let t, e = this.#
|
|
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.#
|
|
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.#
|
|
597
|
-
let t, e = this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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 =
|
|
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.#
|
|
616
|
-
return
|
|
623
|
+
let s = this.#q(t, e);
|
|
624
|
+
return _.hasSubscribers && _.publish(i), s;
|
|
617
625
|
}
|
|
618
|
-
#
|
|
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.#
|
|
623
|
-
if (!this.#
|
|
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 =
|
|
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.#
|
|
632
|
-
return
|
|
639
|
+
let s = this.#V(t, e);
|
|
640
|
+
return _.hasSubscribers && _.publish(i), s;
|
|
633
641
|
}
|
|
634
|
-
#
|
|
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.#
|
|
637
|
-
let n = this.#f[h], r = this.#
|
|
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.#
|
|
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.#
|
|
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.#
|
|
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
|
-
#
|
|
676
|
-
if (!this.#
|
|
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 =
|
|
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.#
|
|
684
|
-
return s && i && (s.trace = !0,
|
|
691
|
+
let h = this.#X(t, e);
|
|
692
|
+
return s && i && (s.trace = !0, E.tracePromise(() => h, s).catch(() => {})), h;
|
|
685
693
|
}
|
|
686
|
-
async #
|
|
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:
|
|
688
|
-
if (v && (v.op = "fetch", v.key = t, g && (v.forceRefresh = !0), v.cache = this), !this.#
|
|
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
|
|
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:
|
|
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,
|
|
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.#
|
|
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.#
|
|
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,
|
|
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 =
|
|
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.#
|
|
731
|
-
return s && i && (s.trace = !0,
|
|
738
|
+
let h = this.#Y(t, e);
|
|
739
|
+
return s && i && (s.trace = !0, E.tracePromise(() => h, s).catch(() => {})), h;
|
|
732
740
|
}
|
|
733
|
-
async #
|
|
734
|
-
let i = await this.#
|
|
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 =
|
|
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.#
|
|
742
|
-
return i && (i.value = s),
|
|
749
|
+
let s = this.#J(t, e);
|
|
750
|
+
return i && (i.value = s), _.hasSubscribers && _.publish(i), s;
|
|
743
751
|
}
|
|
744
|
-
#
|
|
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 =
|
|
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),
|
|
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.#
|
|
767
|
-
return n && this.#G(n, r), this.#
|
|
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
|
-
#
|
|
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.#
|
|
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.#
|
|
784
|
+
return this.#j(t, "delete");
|
|
777
785
|
}
|
|
778
|
-
#
|
|
779
|
-
|
|
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.#
|
|
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.#
|
|
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.#
|
|
812
|
+
this.#a--, this.#w.push(s);
|
|
805
813
|
}
|
|
806
814
|
}
|
|
807
|
-
if (this.#O && this.#
|
|
808
|
-
let t, e = this.#
|
|
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.#
|
|
822
|
+
return this.#Q("delete");
|
|
815
823
|
}
|
|
816
|
-
#
|
|
817
|
-
for (let e of this.#
|
|
824
|
+
#Q(t) {
|
|
825
|
+
for (let e of this.#C({ allowStale: !0 })) {
|
|
818
826
|
let i = this.#f[e];
|
|
819
|
-
if (this.#
|
|
827
|
+
if (this.#z(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
|
|
820
828
|
else {
|
|
821
829
|
let s = this.#u[e];
|
|
822
|
-
this.#
|
|
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.#
|
|
830
|
-
this.#
|
|
831
|
-
for (let t of this.#
|
|
832
|
-
this.#
|
|
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.#
|
|
835
|
-
let t, e = this.#
|
|
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
|
-
},
|
|
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
|
-
},
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
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
|
|
905
|
-
async function
|
|
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 =
|
|
916
|
-
return
|
|
916
|
+
const h = W.createCache(s);
|
|
917
|
+
return L.set(t, h), h;
|
|
917
918
|
}
|
|
918
|
-
async function
|
|
919
|
+
async function j(t = "") {
|
|
919
920
|
let e;
|
|
920
|
-
return 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
|
|
928
|
-
|
|
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
|
|
932
|
-
if (i) return
|
|
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
|
|
936
|
-
|
|
932
|
+
const i = await j(e);
|
|
933
|
+
if (i) return W.remove(t, i);
|
|
937
934
|
}
|
|
938
|
-
async function N(t = "") {
|
|
939
|
-
const
|
|
940
|
-
return
|
|
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
|
|
944
|
-
return e ?
|
|
940
|
+
const e = await j(t);
|
|
941
|
+
return e ? W.count(e) : 0;
|
|
945
942
|
}
|
|
946
|
-
async function H(t
|
|
947
|
-
const
|
|
948
|
-
return
|
|
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
|
|
952
|
-
return
|
|
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
|
|
956
|
-
|
|
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
|
-
|
|
959
|
+
l(D);
|