@unicom-cloud/utils 0.1.4 → 0.1.5

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,117 +1,94 @@
1
- var k = (i) => {
2
- throw TypeError(i);
3
- };
4
- var _ = (i, n, t) => n.has(i) || k("Cannot " + t);
5
- var e = (i, n, t) => (_(i, n, "read from private field"), t ? t.call(i) : n.get(i)), c = (i, n, t) => n.has(i) ? k("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(i) : n.set(i, t), r = (i, n, t, h) => (_(i, n, "write to private field"), h ? h.call(i, t) : n.set(i, t), t);
6
- var O = (i, n, t, h) => ({
7
- set _(s) {
8
- r(i, n, s, t);
9
- },
10
- get _() {
11
- return e(i, n, h);
12
- }
13
- });
14
1
  import "../is/index.js";
15
- import b from "lodash/isRegExp";
16
- import U from "lodash/isString";
17
- const E = window.WebSocket, C = {};
18
- function x(i = {}) {
19
- var n;
20
- for (const t in C) {
21
- const h = C[t];
22
- let s = h == null ? void 0 : h.url, o = !1;
23
- if (b(s) && (o = (n = s == null ? void 0 : s.test) == null ? void 0 : n.call(s, i.url)), U(s) && (s === "*" ? o = !0 : o = s === i.url), o)
24
- return h;
2
+ import r from "lodash/isRegExp";
3
+ import c from "lodash/isString";
4
+ const n = window.WebSocket, o = {};
5
+ function u(a = {}) {
6
+ for (const e in o) {
7
+ const s = o[e];
8
+ let t = s?.url, i = !1;
9
+ if (r(t) && (i = t?.test?.(a.url)), c(t) && (t === "*" ? i = !0 : i = t === a.url), i)
10
+ return s;
25
11
  }
26
12
  }
27
- var g, w, v, l, S, p, d, y;
28
- const I = class I extends EventTarget {
29
- constructor(t, h) {
30
- var s, o;
31
- super();
32
- c(this, g, -1);
33
- c(this, w, -1);
34
- c(this, v, E.CONNECTING);
35
- c(this, l, null);
36
- c(this, S, null);
37
- c(this, p, 0);
38
- c(this, d, []);
39
- c(this, y, null);
40
- if (r(this, l, x({ url: t })), e(this, l))
41
- r(this, v, E.OPEN), r(this, g, setTimeout(
13
+ class l extends EventTarget {
14
+ constructor(e, s) {
15
+ if (super(), this.#t = u({ url: e }), this.#t)
16
+ this.#n = n.OPEN, this.#i = setTimeout(
42
17
  () => {
43
- var a;
44
- let u = new CustomEvent("open", {});
45
- this.dispatchEvent(u), (a = this.onopen) == null || a.call(this, u), clearTimeout(e(this, g));
18
+ let t = new CustomEvent("open", {});
19
+ this.dispatchEvent(t), this.onopen?.(t), clearTimeout(this.#i);
46
20
  },
47
- ((s = e(this, l)) == null ? void 0 : s.openTimeout) ?? Math.random() * 27
48
- )), r(this, w, setInterval(
21
+ this.#t?.openTimeout ?? Math.random() * 27
22
+ ), this.#a = setInterval(
49
23
  () => {
50
- this.readyState === E.OPEN && e(this, d).length && (this.send(e(this, y)), O(this, p)._++);
24
+ this.readyState === n.OPEN && this.#e.length && (this.send(this.#h), this.#s++);
51
25
  },
52
- ((o = e(this, l)) == null ? void 0 : o.messageTimeInterval) ?? 3e3
53
- ));
26
+ this.#t?.messageTimeInterval ?? 3e3
27
+ );
54
28
  else
55
- return r(this, S, new E(t, h));
29
+ return this.#o = new n(e, s);
56
30
  }
31
+ #i = -1;
32
+ #a = -1;
33
+ #n = n.CONNECTING;
57
34
  get readyState() {
58
- return e(this, l) ? e(this, v) : super.readyState;
35
+ return this.#t ? this.#n : super.readyState;
59
36
  }
60
- close(t, h) {
61
- var s, o, u;
62
- if (e(this, l)) {
63
- if (this.readyState !== E.CLOSED) {
64
- r(this, v, E.CLOSED);
65
- let a = new CloseEvent("close");
66
- this.dispatchEvent(a), (s = this.onclose) == null || s.call(this, a);
37
+ #t = null;
38
+ #o = null;
39
+ #s = 0;
40
+ close(e, s) {
41
+ if (this.#t) {
42
+ if (this.readyState !== n.CLOSED) {
43
+ this.#n = n.CLOSED;
44
+ let t = new CloseEvent("close");
45
+ this.dispatchEvent(t), this.onclose?.(t);
67
46
  }
68
- clearTimeout(e(this, g)), clearInterval(e(this, w)), r(this, p, 0), r(this, d, []);
47
+ clearTimeout(this.#i), clearInterval(this.#a), this.#s = 0, this.#e = [];
69
48
  } else
70
- (u = (o = e(this, S)) == null ? void 0 : o.close) == null || u.call(o, t, h);
49
+ this.#o?.close?.(e, s);
71
50
  }
72
- send(t) {
73
- var h, s, o, u;
74
- if (e(this, l)) {
75
- r(this, y, t);
76
- let a = null;
51
+ #e = [];
52
+ #h = null;
53
+ send(e) {
54
+ if (this.#t) {
55
+ this.#h = e;
56
+ let s = null;
77
57
  try {
78
- a = t && JSON.parse(t);
79
- } catch (m) {
80
- console.error(m);
58
+ s = e && JSON.parse(e);
59
+ } catch (i) {
60
+ console.error(i);
81
61
  }
82
- a != null && a.mockAutoUpdateKey && !e(this, d).find(
83
- (m) => m.mockAutoUpdateKey === a.mockAutoUpdateKey
84
- ) && e(this, d).push(a);
85
- const f = (h = e(this, l)) == null ? void 0 : h.template;
86
- if (e(this, d).length)
87
- e(this, d).forEach((m, A, K) => {
88
- var T;
89
- let N = new MessageEvent("message", {
90
- data: (f == null ? void 0 : f({ ...m, sendCount: e(this, p) })) ?? f
62
+ s?.mockAutoUpdateKey && !this.#e.find(
63
+ (i) => i.mockAutoUpdateKey === s.mockAutoUpdateKey
64
+ ) && this.#e.push(s);
65
+ const t = this.#t?.template;
66
+ if (this.#e.length)
67
+ this.#e.forEach((i, d, m) => {
68
+ let h = new MessageEvent("message", {
69
+ data: t?.({ ...i, sendCount: this.#s }) ?? t
91
70
  });
92
- this.dispatchEvent(N), (T = this.onmessage) == null || T.call(this, N);
71
+ this.dispatchEvent(h), this.onmessage?.(h);
93
72
  });
94
73
  else {
95
- let m = new MessageEvent("message", {
96
- data: (f == null ? void 0 : f({ ...a, sendCount: e(this, p) })) ?? f
74
+ let i = new MessageEvent("message", {
75
+ data: t?.({ ...s, sendCount: this.#s }) ?? t
97
76
  });
98
- this.dispatchEvent(m), (s = this.onmessage) == null || s.call(this, m);
77
+ this.dispatchEvent(i), this.onmessage?.(i);
99
78
  }
100
79
  } else
101
- (u = (o = e(this, S)) == null ? void 0 : o.send) == null || u.call(o, t);
80
+ this.#o?.send?.(e);
102
81
  }
103
- static add(t, h, s) {
104
- t && (window.WebSocket = I, C[t.toString()] = {
105
- url: t,
106
- template: h,
107
- ...s
82
+ static add(e, s, t) {
83
+ e && (window.WebSocket = l, o[e.toString()] = {
84
+ url: e,
85
+ template: s,
86
+ ...t
108
87
  });
109
88
  }
110
- };
111
- g = new WeakMap(), w = new WeakMap(), v = new WeakMap(), l = new WeakMap(), S = new WeakMap(), p = new WeakMap(), d = new WeakMap(), y = new WeakMap();
112
- let D = I;
89
+ }
113
90
  export {
114
- D as MockWebSocket,
115
- E as WebSocketNative,
116
- D as default
91
+ l as MockWebSocket,
92
+ n as WebSocketNative,
93
+ l as default
117
94
  };
@@ -1,94 +1,84 @@
1
- var q = (e) => {
2
- throw TypeError(e);
3
- };
4
- var T = (e, n, t) => n.has(e) || q("Cannot " + t);
5
- var i = (e, n, t) => (T(e, n, "read from private field"), t ? t.call(e) : n.get(e)), a = (e, n, t) => n.has(e) ? q("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), h = (e, n, t, s) => (T(e, n, "write to private field"), s ? s.call(e, t) : n.set(e, t), t), y = (e, n, t) => (T(e, n, "access private method"), t);
6
1
  import "../is/index.js";
7
- import D from "lodash/isRegExp";
8
- import L from "lodash/isString";
9
- const E = window.XMLHttpRequest, R = {};
10
- function M(e = {}) {
11
- var t, s, r, c, m;
12
- const n = (s = (t = e.method) == null ? void 0 : t.toLowerCase) == null ? void 0 : s.call(t);
13
- for (const _ in R) {
14
- const d = R[_];
15
- let u = d == null ? void 0 : d.url, f = ((c = (r = d == null ? void 0 : d.method) == null ? void 0 : r.toLowerCase) == null ? void 0 : c.call(r)) === n;
16
- if (f && (D(u) && (f = (m = u == null ? void 0 : u.test) == null ? void 0 : m.call(u, e.url)), L(u) && (u === "*" ? f = !0 : f = u === e.url)), f)
17
- return d;
2
+ import a from "lodash/isRegExp";
3
+ import p from "lodash/isString";
4
+ const r = window.XMLHttpRequest, o = {};
5
+ function c(u = {}) {
6
+ const t = u.method?.toLowerCase?.();
7
+ for (const e in o) {
8
+ const n = o[e];
9
+ let s = n?.url, i = n?.method?.toLowerCase?.() === t;
10
+ if (i && (a(s) && (i = s?.test?.(u.url)), p(s) && (s === "*" ? i = !0 : i = s === u.url)), i)
11
+ return n;
18
12
  }
19
13
  }
20
- var o, l, g, w, p, v, C, x;
21
- const N = class N extends E {
14
+ class h extends r {
22
15
  constructor(t) {
23
16
  super(t);
24
- a(this, C);
25
- a(this, o, null);
26
- a(this, l, {
27
- method: "",
28
- url: "",
29
- async: !0,
30
- username: null,
31
- password: null
32
- });
33
- a(this, g, E.UNSENT);
34
- a(this, w, "");
35
- a(this, p, E.UNSENT);
36
- a(this, v, null);
37
17
  }
38
- open(t, s, r = !0, c = null, m = null) {
39
- h(this, l, { method: t, url: s, async: r, username: c, password: m }), h(this, o, M(i(this, l))), super.open(t, s, r, c, m), i(this, o) && (h(this, p, E.OPENED), this.dispatchEvent(new CustomEvent("readystatechange", {})));
18
+ #t = null;
19
+ #s = {
20
+ method: "",
21
+ url: "",
22
+ async: !0,
23
+ username: null,
24
+ password: null
25
+ };
26
+ open(t, e, n = !0, s = null, i = null) {
27
+ this.#s = { method: t, url: e, async: n, username: s, password: i }, this.#t = c(this.#s), super.open(t, e, n, s, i), this.#t && (this.#e = r.OPENED, this.dispatchEvent(new CustomEvent("readystatechange", {})));
40
28
  }
29
+ #n = r.UNSENT;
41
30
  get status() {
42
- return i(this, o) ? i(this, g) : super.status;
31
+ return this.#t ? this.#n : super.status;
43
32
  }
33
+ #i = "";
44
34
  get statusText() {
45
- return i(this, o) ? i(this, w) : super.statusText;
35
+ return this.#t ? this.#i : super.statusText;
46
36
  }
37
+ #e = r.UNSENT;
47
38
  get readyState() {
48
- return i(this, o) ? i(this, p) : super.readyState;
39
+ return this.#t ? this.#e : super.readyState;
49
40
  }
41
+ #r = null;
50
42
  get response() {
51
- return i(this, o) ? i(this, v) : super.response;
43
+ return this.#t ? this.#r : super.response;
52
44
  }
53
45
  get responseText() {
54
46
  let t = super.responseText;
55
- if (i(this, o))
47
+ if (this.#t)
56
48
  try {
57
49
  t = JSON.stringify(this.response) ?? t;
58
- } catch (s) {
59
- t = super.responseText, console.error(s);
50
+ } catch (e) {
51
+ t = super.responseText, console.error(e);
60
52
  }
61
53
  return t;
62
54
  }
63
55
  send(t) {
64
- if (i(this, o))
65
- if (i(this, l).async) {
66
- const s = setTimeout(() => {
67
- y(this, C, x).call(this, t), clearTimeout(s);
56
+ if (this.#t)
57
+ if (this.#s.async) {
58
+ const e = setTimeout(() => {
59
+ this.#u(t), clearTimeout(e);
68
60
  }, Math.random() * 227);
69
61
  } else
70
- y(this, C, x).call(this, t);
62
+ this.#u(t);
71
63
  else
72
64
  super.send(t);
73
65
  }
74
- static add(t, s = "", r, c) {
75
- t && (window.XMLHttpRequest = N, R[t + s] = {
66
+ #u(t) {
67
+ this.setRequestHeader("X-Requested-With", "PqbMockXMLHttpRequest"), this.dispatchEvent(new CustomEvent("loadstart", {})), this.#e = r.HEADERS_RECEIVED, this.dispatchEvent(new CustomEvent("readystatechange", {})), this.#e = r.LOADING, this.dispatchEvent(new CustomEvent("readystatechange", {})), this.#n = 200, this.#i = "OK";
68
+ const e = this.#t?.template;
69
+ this.#r = e?.({ ...this.#s, body: t }) ?? e, this.#e = r.DONE, this.dispatchEvent(new CustomEvent("readystatechange", {})), this.dispatchEvent(new CustomEvent("load", {})), this.dispatchEvent(new CustomEvent("loadend", {}));
70
+ }
71
+ static add(t, e = "", n, s) {
72
+ t && (window.XMLHttpRequest = h, o[t + e] = {
76
73
  url: t,
77
- method: s,
78
- template: r,
79
- ...c
74
+ method: e,
75
+ template: n,
76
+ ...s
80
77
  });
81
78
  }
82
- };
83
- o = new WeakMap(), l = new WeakMap(), g = new WeakMap(), w = new WeakMap(), p = new WeakMap(), v = new WeakMap(), C = new WeakSet(), x = function(t) {
84
- var r;
85
- this.setRequestHeader("X-Requested-With", "PqbMockXMLHttpRequest"), this.dispatchEvent(new CustomEvent("loadstart", {})), h(this, p, E.HEADERS_RECEIVED), this.dispatchEvent(new CustomEvent("readystatechange", {})), h(this, p, E.LOADING), this.dispatchEvent(new CustomEvent("readystatechange", {})), h(this, g, 200), h(this, w, "OK");
86
- const s = (r = i(this, o)) == null ? void 0 : r.template;
87
- h(this, v, (s == null ? void 0 : s({ ...i(this, l), body: t })) ?? s), h(this, p, E.DONE), this.dispatchEvent(new CustomEvent("readystatechange", {})), this.dispatchEvent(new CustomEvent("load", {})), this.dispatchEvent(new CustomEvent("loadend", {}));
88
- };
89
- let S = N;
79
+ }
90
80
  export {
91
- S as MockXMLHttpRequest,
92
- E as XMLHttpRequestNative,
93
- S as default
81
+ h as MockXMLHttpRequest,
82
+ r as XMLHttpRequestNative,
83
+ h as default
94
84
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/utils","version":"0.1.4","dependencies":{},"peerDependencies":{"lodash":"^4.17.21"},"main":"./index.js","type":"module","types":"types/*","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/utils","version":"0.1.5","dependencies":{},"peerDependencies":{"lodash":"^4.17.21"},"main":"./index.js","type":"module","types":"types/*","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
package/random/address.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import e from "lodash/sample";
2
- import m, { REGION as a } from "../constant/address.js";
3
- import i from "./number.js";
4
- const l = {
2
+ import o, { REGION as c } from "../constant/address.js";
3
+ import m from "./number.js";
4
+ const s = {
5
5
  region() {
6
- return e(a);
6
+ return e(c);
7
7
  },
8
8
  // 随机生成一个(中国)省(或直辖市、自治区、特别行政区)。
9
9
  province() {
10
- return e(m).name;
10
+ return e(o).name;
11
11
  },
12
12
  // 随机生成一个(中国)市。
13
13
  city(t) {
14
- const n = e(m), r = e(n == null ? void 0 : n.children);
14
+ const n = e(o), r = e(n?.children);
15
15
  return t ? `${n.name} ${r.name}` : r.name;
16
16
  },
17
17
  // 随机生成一个(中国)县。
18
18
  county(t) {
19
- const n = e(m), r = e(n == null ? void 0 : n.children), o = e(r == null ? void 0 : r.children);
20
- return t ? `${n.name} ${r.name} ${o.name}` : o.name;
19
+ const n = e(o), r = e(n?.children), i = e(r?.children);
20
+ return t ? `${n.name} ${r.name} ${i.name}` : i.name;
21
21
  },
22
22
  // 随机生成一个邮政编码(六位数字)。
23
23
  zip(t) {
24
24
  let n = "";
25
25
  for (let r = 0; r < (t || 6); r++)
26
- n += i.natural(0, 9);
26
+ n += m.natural(0, 9);
27
27
  return n;
28
28
  }
29
29
  };
30
30
  export {
31
- l as default
31
+ s as default
32
32
  };
@@ -1,4 +1,4 @@
1
- const o = [
1
+ const u = [
2
2
  [
3
3
  "requestFullscreen",
4
4
  "exitFullscreen",
@@ -41,79 +41,79 @@ const o = [
41
41
  // 'MSFullscreenChange',
42
42
  // 'MSFullscreenError',
43
43
  // ],
44
- ], e = Reflect.apply(
44
+ ], l = Reflect.apply(
45
45
  () => {
46
46
  if (typeof document > "u")
47
47
  return !1;
48
- const r = o[0], l = {};
49
- for (const n of o)
50
- if ((n == null ? void 0 : n[1]) in document) {
51
- for (const [s, u] of n.entries())
52
- l[r[s]] = u;
53
- return l;
48
+ const n = u[0], t = {};
49
+ for (const e of u)
50
+ if (e?.[1] in document) {
51
+ for (const [c, o] of e.entries())
52
+ t[n[c]] = o;
53
+ return t;
54
54
  }
55
55
  return !1;
56
56
  },
57
57
  void 0,
58
58
  []
59
- ), f = {
60
- change: e == null ? void 0 : e.fullscreenchange,
61
- error: e == null ? void 0 : e.fullscreenerror
59
+ ), i = {
60
+ change: l?.fullscreenchange,
61
+ error: l?.fullscreenerror
62
62
  };
63
- let t = {
64
- request(r = document.documentElement, l) {
65
- return new Promise((n, c) => {
66
- const s = () => {
67
- t.off("change", s), n();
63
+ let r = {
64
+ request(n = document.documentElement, t) {
65
+ return new Promise((e, s) => {
66
+ const c = () => {
67
+ r.off("change", c), e();
68
68
  };
69
- t.on("change", s);
70
- const u = r[e == null ? void 0 : e.requestFullscreen](l);
71
- u instanceof Promise && u.then(s).catch(c);
69
+ r.on("change", c);
70
+ const o = n[l?.requestFullscreen](t);
71
+ o instanceof Promise && o.then(c).catch(s);
72
72
  });
73
73
  },
74
74
  exit() {
75
- return new Promise((r, l) => {
76
- if (!t.isFullscreen) {
77
- r();
75
+ return new Promise((n, t) => {
76
+ if (!r.isFullscreen) {
77
+ n();
78
78
  return;
79
79
  }
80
- const n = () => {
81
- t.off("change", n), r();
80
+ const e = () => {
81
+ r.off("change", e), n();
82
82
  };
83
- t.on("change", n);
84
- const c = document[e == null ? void 0 : e.exitFullscreen]();
85
- c instanceof Promise && c.then(n).catch(l);
83
+ r.on("change", e);
84
+ const s = document[l?.exitFullscreen]();
85
+ s instanceof Promise && s.then(e).catch(t);
86
86
  });
87
87
  },
88
- toggle(r, l) {
89
- return t.isFullscreen ? t.exit() : t.request(r, l);
88
+ toggle(n, t) {
89
+ return r.isFullscreen ? r.exit() : r.request(n, t);
90
90
  },
91
- on(r, l) {
92
- const n = f[r];
93
- n && document.addEventListener(n, l, !1);
91
+ on(n, t) {
92
+ const e = i[n];
93
+ e && document.addEventListener(e, t, !1);
94
94
  },
95
- off(r, l) {
96
- const n = f[r];
97
- n && document.removeEventListener(n, l, !1);
95
+ off(n, t) {
96
+ const e = i[n];
97
+ e && document.removeEventListener(e, t, !1);
98
98
  },
99
- raw: e
99
+ raw: l
100
100
  };
101
- Object.defineProperties(t, {
101
+ Object.defineProperties(r, {
102
102
  isFullscreen: {
103
- get: () => !!document[e == null ? void 0 : e.fullscreenElement]
103
+ get: () => !!document[l?.fullscreenElement]
104
104
  },
105
105
  element: {
106
106
  enumerable: !0,
107
- get: () => document[e == null ? void 0 : e.fullscreenElement] ?? void 0
107
+ get: () => document[l?.fullscreenElement] ?? void 0
108
108
  },
109
109
  isEnabled: {
110
110
  enumerable: !0,
111
111
  // Coerce to boolean in case of old WebKit.
112
- get: () => !!document[e == null ? void 0 : e.fullscreenEnabled]
112
+ get: () => !!document[l?.fullscreenEnabled]
113
113
  }
114
114
  });
115
- e || (t = { isEnabled: !1 });
116
- const d = t;
115
+ l || (r = { isEnabled: !1 });
116
+ const f = r;
117
117
  export {
118
- d as default
118
+ f as default
119
119
  };
@@ -1,32 +1,42 @@
1
- import { imageCache as s, bgCache as o, resourceCache as p, baseCSSCache as g, computedStyleCache as C } from "../core/cache.js";
2
- import { embedCustomFonts as d } from "../modules/fonts.js";
3
- import { precacheCommonTags as y } from "../utils/cssTools.js";
4
- import { fetchImage as i, extractUrl as S } from "../utils/helpers.js";
5
- async function I(r = document, f = {}) {
6
- const { embedFonts: m = !0, reset: u = !1, preWarm: b = !0 } = f;
7
- if (u) {
8
- s.clear(), o.clear(), p.clear(), g.clear(), C.clear();
1
+ import { imageCache as n, bgCache as m, resourceCache as y, baseCSSCache as C, computedStyleCache as d } from "../core/cache.js";
2
+ import { embedCustomFonts as S } from "../modules/fonts.js";
3
+ import { precacheCommonTags as b } from "../utils/cssTools.js";
4
+ import { fetchImage as u, extractURL as A } from "../utils/helpers.js";
5
+ async function I(c = document, h = {}) {
6
+ const {
7
+ embedFonts: i = !0,
8
+ reset: g = !1,
9
+ crossOrigin: o
10
+ } = h;
11
+ if (g) {
12
+ n.clear(), m.clear(), y.clear(), C.clear(), d.clear();
9
13
  return;
10
14
  }
11
- await document.fonts.ready, y();
12
- let l = [], n = [];
13
- r != null && r.querySelectorAll && (l = Array.from(r.querySelectorAll("img[src]")), n = Array.from(r.querySelectorAll("*")));
15
+ await document.fonts.ready, b();
16
+ let l = [], f = [];
17
+ c?.querySelectorAll && (l = Array.from(c.querySelectorAll("img[src]")), f = Array.from(c.querySelectorAll("*")));
14
18
  const t = [];
15
- for (const a of l) {
16
- const c = a.src;
17
- s.has(c) || t.push(
18
- i(c).then((e) => s.set(c, e)).catch(() => {
19
- })
20
- );
19
+ for (const s of l) {
20
+ const r = s.src;
21
+ if (!n.has(r)) {
22
+ const e = o ? o(r) : "anonymous";
23
+ t.push(
24
+ u(r, 3e3, e).then((a) => n.set(r, a)).catch(() => {
25
+ })
26
+ );
27
+ }
21
28
  }
22
- for (const a of n) {
23
- const c = getComputedStyle(a).backgroundImage, e = S(c);
24
- e && !o.has(e) && t.push(
25
- i(e).then((h) => o.set(e, h)).catch(() => {
26
- })
27
- );
29
+ for (const s of f) {
30
+ const r = getComputedStyle(s).backgroundImage, e = A(r);
31
+ if (e && !m.has(e)) {
32
+ const a = o ? o(e) : "anonymous";
33
+ t.push(
34
+ u(e, 3e3, a).then((p) => m.set(e, p)).catch(() => {
35
+ })
36
+ );
37
+ }
28
38
  }
29
- m && await d({ ignoreIconFonts: !m, preCached: !0 }), await Promise.all(t);
39
+ i && await S({ ignoreIconFonts: !i, preCached: !0 }), await Promise.all(t);
30
40
  }
31
41
  export {
32
42
  I as preCache