@vtj/utils 0.13.13 → 0.13.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -15,12 +15,12 @@ export * from "@vtj/base";
15
15
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
16
16
  * @name @vtj/utils
17
17
  * @author CHC chenhuachun1549@dingtalk.com
18
- * @version 0.13.13
18
+ * @version 0.13.14
19
19
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
20
20
  */
21
- const Qs = "0.13.13";
21
+ const Qs = "0.13.14";
22
22
  /**
23
- * @vue/shared v3.5.19
23
+ * @vue/shared v3.5.20
24
24
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
25
25
  * @license MIT
26
26
  **/
@@ -133,11 +133,11 @@ function D(e, t, n, r, s, o) {
133
133
  Xe();
134
134
  }
135
135
  function $(e) {
136
- const t = R(e);
136
+ const t = E(e);
137
137
  return t === e ? t : (x(t, "iterate", ee), B(e) ? t : t.map(A));
138
138
  }
139
139
  function Ye(e) {
140
- return x(e = R(e), "iterate", ee), e;
140
+ return x(e = E(e), "iterate", ee), e;
141
141
  }
142
142
  const xn = {
143
143
  __proto__: null,
@@ -183,7 +183,7 @@ const xn = {
183
183
  join(e) {
184
184
  return $(this).join(e);
185
185
  },
186
- // keys() iterator only reads `length`, no optimisation required
186
+ // keys() iterator only reads `length`, no optimization required
187
187
  lastIndexOf(...e) {
188
188
  return Ce(this, "lastIndexOf", e);
189
189
  },
@@ -261,14 +261,14 @@ function nt(e, t, n, r) {
261
261
  }), s[t](o, ...r);
262
262
  }
263
263
  function Ce(e, t, n) {
264
- const r = R(e);
264
+ const r = E(e);
265
265
  x(r, "iterate", ee);
266
266
  const s = r[t](...n);
267
- return (s === -1 || s === !1) && $n(n[0]) ? (n[0] = R(n[0]), r[t](...n)) : s;
267
+ return (s === -1 || s === !1) && $n(n[0]) ? (n[0] = E(n[0]), r[t](...n)) : s;
268
268
  }
269
269
  function X(e, t, n = []) {
270
270
  Tn(), Ve();
271
- const r = R(e)[t].apply(e, n);
271
+ const r = E(e)[t].apply(e, n);
272
272
  return Xe(), An(), r;
273
273
  }
274
274
  const Pn = /* @__PURE__ */ wn("__proto__,__v_isRef,__isVue"), Ot = new Set(
@@ -276,7 +276,7 @@ const Pn = /* @__PURE__ */ wn("__proto__,__v_isRef,__isVue"), Ot = new Set(
276
276
  );
277
277
  function jn(e) {
278
278
  re(e) || (e = String(e));
279
- const t = R(this);
279
+ const t = E(this);
280
280
  return x(t, "has", e), t.hasOwnProperty(e);
281
281
  }
282
282
  class Tt {
@@ -323,7 +323,7 @@ class vn extends Tt {
323
323
  let o = t[n];
324
324
  if (!this._isShallow) {
325
325
  const u = z(o);
326
- if (!B(r) && !z(r) && (o = R(o), r = R(r)), !J(t) && W(o) && !W(r))
326
+ if (!B(r) && !z(r) && (o = E(o), r = E(r)), !J(t) && W(o) && !W(r))
327
327
  return u || (o.value = r), !0;
328
328
  }
329
329
  const i = J(t) && Ke(n) ? Number(n) < t.length : Ue(t, n), a = Reflect.set(
@@ -332,7 +332,7 @@ class vn extends Tt {
332
332
  r,
333
333
  W(t) ? t : s
334
334
  );
335
- return t === R(s) && (i ? Z(r, o) && D(t, "set", n, r) : D(t, "add", n, r)), a;
335
+ return t === E(s) && (i ? Z(r, o) && D(t, "set", n, r) : D(t, "add", n, r)), a;
336
336
  }
337
337
  deleteProperty(t, n) {
338
338
  const r = Ue(t, n);
@@ -366,7 +366,7 @@ class Ln extends Tt {
366
366
  const Nn = /* @__PURE__ */ new vn(), Un = /* @__PURE__ */ new Ln(), Be = (e) => e, ae = (e) => Reflect.getPrototypeOf(e);
367
367
  function Fn(e, t, n) {
368
368
  return function(...r) {
369
- const s = this.__v_raw, o = R(s), i = ue(o), a = e === "entries" || e === Symbol.iterator && i, u = e === "keys" && i, c = s[e](...r), f = n ? Be : t ? Me : A;
369
+ const s = this.__v_raw, o = E(s), i = ue(o), a = e === "entries" || e === Symbol.iterator && i, u = e === "keys" && i, c = s[e](...r), f = n ? Be : t ? Me : A;
370
370
  return !t && x(
371
371
  o,
372
372
  "iterate",
@@ -395,7 +395,7 @@ function ce(e) {
395
395
  function Dn(e, t) {
396
396
  const n = {
397
397
  get(s) {
398
- const o = this.__v_raw, i = R(o), a = R(s);
398
+ const o = this.__v_raw, i = E(o), a = E(s);
399
399
  e || (Z(s, a) && x(i, "get", s), x(i, "get", a));
400
400
  const { has: u } = ae(i), c = t ? Be : e ? Me : A;
401
401
  if (u.call(i, s))
@@ -406,14 +406,14 @@ function Dn(e, t) {
406
406
  },
407
407
  get size() {
408
408
  const s = this.__v_raw;
409
- return !e && x(R(s), "iterate", k), Reflect.get(s, "size", s);
409
+ return !e && x(E(s), "iterate", k), s.size;
410
410
  },
411
411
  has(s) {
412
- const o = this.__v_raw, i = R(o), a = R(s);
412
+ const o = this.__v_raw, i = E(o), a = E(s);
413
413
  return e || (Z(s, a) && x(i, "has", s), x(i, "has", a)), s === a ? o.has(s) : o.has(s) || o.has(a);
414
414
  },
415
415
  forEach(s, o) {
416
- const i = this, a = i.__v_raw, u = R(a), c = t ? Be : e ? Me : A;
416
+ const i = this, a = i.__v_raw, u = E(a), c = t ? Be : e ? Me : A;
417
417
  return !e && x(u, "iterate", k), a.forEach((f, d) => s.call(o, c(f), c(d), i));
418
418
  }
419
419
  };
@@ -426,27 +426,27 @@ function Dn(e, t) {
426
426
  clear: ce("clear")
427
427
  } : {
428
428
  add(s) {
429
- !t && !B(s) && !z(s) && (s = R(s));
430
- const o = R(this);
429
+ !t && !B(s) && !z(s) && (s = E(s));
430
+ const o = E(this);
431
431
  return ae(o).has.call(o, s) || (o.add(s), D(o, "add", s, s)), this;
432
432
  },
433
433
  set(s, o) {
434
- !t && !B(o) && !z(o) && (o = R(o));
435
- const i = R(this), { has: a, get: u } = ae(i);
434
+ !t && !B(o) && !z(o) && (o = E(o));
435
+ const i = E(this), { has: a, get: u } = ae(i);
436
436
  let c = a.call(i, s);
437
- c || (s = R(s), c = a.call(i, s));
437
+ c || (s = E(s), c = a.call(i, s));
438
438
  const f = u.call(i, s);
439
439
  return i.set(s, o), c ? Z(o, f) && D(i, "set", s, o) : D(i, "add", s, o), this;
440
440
  },
441
441
  delete(s) {
442
- const o = R(this), { has: i, get: a } = ae(o);
442
+ const o = E(this), { has: i, get: a } = ae(o);
443
443
  let u = i.call(o, s);
444
- u || (s = R(s), u = i.call(o, s)), a && a.call(o, s);
444
+ u || (s = E(s), u = i.call(o, s)), a && a.call(o, s);
445
445
  const c = o.delete(s);
446
446
  return u && D(o, "delete", s, void 0), c;
447
447
  },
448
448
  clear() {
449
- const s = R(this), o = s.size !== 0, i = s.clear();
449
+ const s = E(this), o = s.size !== 0, i = s.clear();
450
450
  return o && D(
451
451
  s,
452
452
  "clear",
@@ -536,9 +536,9 @@ function B(e) {
536
536
  function $n(e) {
537
537
  return e ? !!e.__v_raw : !1;
538
538
  }
539
- function R(e) {
539
+ function E(e) {
540
540
  const t = e && e.__v_raw;
541
- return t ? R(t) : e;
541
+ return t ? E(t) : e;
542
542
  }
543
543
  const A = (e) => we(e) ? Pt(e) : e, Me = (e) => we(e) ? jt(e) : e;
544
544
  function W(e) {
@@ -552,14 +552,14 @@ function Jn(e, t) {
552
552
  }
553
553
  class Wn {
554
554
  constructor(t, n) {
555
- this.dep = new _t(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = n ? t : R(t), this._value = n ? t : A(t), this.__v_isShallow = n;
555
+ this.dep = new _t(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = n ? t : E(t), this._value = n ? t : A(t), this.__v_isShallow = n;
556
556
  }
557
557
  get value() {
558
558
  return this.dep.track(), this._value;
559
559
  }
560
560
  set value(t) {
561
561
  const n = this._rawValue, r = this.__v_isShallow || B(t) || z(t);
562
- t = r ? t : R(t), Z(t, n) && (this._rawValue = t, this._value = r ? t : A(t), this.dep.trigger());
562
+ t = r ? t : E(t), Z(t, n) && (this._rawValue = t, this._value = r ? t : A(t), this.dep.trigger());
563
563
  }
564
564
  }
565
565
  function Lt(e, t) {
@@ -882,11 +882,11 @@ function Se(e, t, n) {
882
882
  if (l.endsWith(g, "{}"))
883
883
  g = r ? g : g.slice(0, -2), h = JSON.stringify(h);
884
884
  else if (l.isArray(h) && Lr(h) || (l.isFileList(h) || l.endsWith(g, "[]")) && (y = l.toArray(h)))
885
- return g = Ht(g), y.forEach(function(b, v) {
886
- !(l.isUndefined(b) || b === null) && t.append(
885
+ return g = Ht(g), y.forEach(function(R, v) {
886
+ !(l.isUndefined(R) || R === null) && t.append(
887
887
  // eslint-disable-next-line no-nested-ternary
888
888
  i === !0 ? st([g], v, o) : i === null ? g : g + "[]",
889
- c(b)
889
+ c(R)
890
890
  );
891
891
  }), !1;
892
892
  }
@@ -897,7 +897,7 @@ function Se(e, t, n) {
897
897
  convertValue: c,
898
898
  isVisitable: ke
899
899
  });
900
- function E(h, g) {
900
+ function b(h, g) {
901
901
  if (!l.isUndefined(h)) {
902
902
  if (d.indexOf(h) !== -1)
903
903
  throw Error("Circular reference detected in " + g.join("."));
@@ -908,13 +908,13 @@ function Se(e, t, n) {
908
908
  l.isString(S) ? S.trim() : S,
909
909
  g,
910
910
  m
911
- )) === !0 && E(y, g ? g.concat(S) : [S]);
911
+ )) === !0 && b(y, g ? g.concat(S) : [S]);
912
912
  }), d.pop();
913
913
  }
914
914
  }
915
915
  if (!l.isObject(e))
916
916
  throw new TypeError("data must be an object");
917
- return E(e), t;
917
+ return b(e), t;
918
918
  }
919
919
  function ot(e) {
920
920
  const t = {
@@ -1397,8 +1397,8 @@ function es(e, t) {
1397
1397
  m += n[d++], d = d % e;
1398
1398
  if (s = (s + 1) % e, s === o && (o = (o + 1) % e), c - i < t)
1399
1399
  return;
1400
- const E = f && c - f;
1401
- return E ? Math.round(m * 1e3 / E) : void 0;
1400
+ const b = f && c - f;
1401
+ return b ? Math.round(m * 1e3 / b) : void 0;
1402
1402
  };
1403
1403
  }
1404
1404
  function ts(e, t) {
@@ -1570,22 +1570,22 @@ const Yt = (e) => {
1570
1570
  const s = Yt(e);
1571
1571
  let o = s.data;
1572
1572
  const i = P.from(s.headers).normalize();
1573
- let { responseType: a, onUploadProgress: u, onDownloadProgress: c } = s, f, d, m, E, h;
1573
+ let { responseType: a, onUploadProgress: u, onDownloadProgress: c } = s, f, d, m, b, h;
1574
1574
  function g() {
1575
- E && E(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(f), s.signal && s.signal.removeEventListener("abort", f);
1575
+ b && b(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(f), s.signal && s.signal.removeEventListener("abort", f);
1576
1576
  }
1577
1577
  let p = new XMLHttpRequest();
1578
1578
  p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
1579
1579
  function y() {
1580
1580
  if (!p)
1581
1581
  return;
1582
- const b = P.from(
1582
+ const R = P.from(
1583
1583
  "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1584
1584
  ), T = {
1585
1585
  data: !a || a === "text" || a === "json" ? p.responseText : p.response,
1586
1586
  status: p.status,
1587
1587
  statusText: p.statusText,
1588
- headers: b,
1588
+ headers: R,
1589
1589
  config: e,
1590
1590
  request: p
1591
1591
  };
@@ -1612,8 +1612,8 @@ const Yt = (e) => {
1612
1612
  )), p = null;
1613
1613
  }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && l.forEach(i.toJSON(), function(v, T) {
1614
1614
  p.setRequestHeader(T, v);
1615
- }), l.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), a && a !== "json" && (p.responseType = s.responseType), c && ([m, h] = me(c, !0), p.addEventListener("progress", m)), u && p.upload && ([d, E] = me(u), p.upload.addEventListener("progress", d), p.upload.addEventListener("loadend", E)), (s.cancelToken || s.signal) && (f = (b) => {
1616
- p && (r(!b || b.type ? new V(null, e, p) : b), p.abort(), p = null);
1615
+ }), l.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), a && a !== "json" && (p.responseType = s.responseType), c && ([m, h] = me(c, !0), p.addEventListener("progress", m)), u && p.upload && ([d, b] = me(u), p.upload.addEventListener("progress", d), p.upload.addEventListener("loadend", b)), (s.cancelToken || s.signal) && (f = (R) => {
1616
+ p && (r(!R || R.type ? new V(null, e, p) : R), p.abort(), p = null);
1617
1617
  }, s.cancelToken && s.cancelToken.subscribe(f), s.signal && (s.signal.aborted ? f() : s.signal.addEventListener("abort", f)));
1618
1618
  const S = Zr(s.url);
1619
1619
  if (S && O.protocols.indexOf(S) === -1) {
@@ -1761,9 +1761,9 @@ const ps = async (e) => {
1761
1761
  fetchOptions: m
1762
1762
  } = Yt(e);
1763
1763
  c = c ? (c + "").toLowerCase() : "text";
1764
- let E = cs([s, o && o.toAbortSignal()], i), h;
1765
- const g = E && E.unsubscribe && (() => {
1766
- E.unsubscribe();
1764
+ let b = cs([s, o && o.toAbortSignal()], i), h;
1765
+ const g = b && b.unsubscribe && (() => {
1766
+ b.unsubscribe();
1767
1767
  });
1768
1768
  let p;
1769
1769
  try {
@@ -1785,7 +1785,7 @@ const ps = async (e) => {
1785
1785
  const y = "credentials" in Request.prototype;
1786
1786
  h = new Request(t, {
1787
1787
  ...m,
1788
- signal: E,
1788
+ signal: b,
1789
1789
  method: n.toUpperCase(),
1790
1790
  headers: f.normalize().toJSON(),
1791
1791
  body: r,
@@ -1793,8 +1793,8 @@ const ps = async (e) => {
1793
1793
  credentials: y ? d : void 0
1794
1794
  });
1795
1795
  let S = await fetch(h, m);
1796
- const b = He && (c === "stream" || c === "response");
1797
- if (He && (a || b && g)) {
1796
+ const R = He && (c === "stream" || c === "response");
1797
+ if (He && (a || R && g)) {
1798
1798
  const T = {};
1799
1799
  ["status", "statusText", "headers"].forEach((tt) => {
1800
1800
  T[tt] = S[tt];
@@ -1812,7 +1812,7 @@ const ps = async (e) => {
1812
1812
  }
1813
1813
  c = c || "text";
1814
1814
  let v = await ge[l.findKey(ge, c) || "text"](S, e);
1815
- return !b && g && g(), await new Promise((T, F) => {
1815
+ return !R && g && g(), await new Promise((T, F) => {
1816
1816
  Vt(T, F, {
1817
1817
  data: v,
1818
1818
  headers: P.from(S.headers),
@@ -2021,18 +2021,18 @@ let q = class {
2021
2021
  return f;
2022
2022
  }
2023
2023
  m = a.length;
2024
- let E = n;
2024
+ let b = n;
2025
2025
  for (d = 0; d < m; ) {
2026
2026
  const h = a[d++], g = a[d++];
2027
2027
  try {
2028
- E = h(E);
2028
+ b = h(b);
2029
2029
  } catch (p) {
2030
2030
  g.call(this, p);
2031
2031
  break;
2032
2032
  }
2033
2033
  }
2034
2034
  try {
2035
- f = pt.call(this, E);
2035
+ f = pt.call(this, b);
2036
2036
  } catch (h) {
2037
2037
  return Promise.reject(h);
2038
2038
  }
@@ -2404,7 +2404,7 @@ let As = class {
2404
2404
  n,
2405
2405
  s
2406
2406
  );
2407
- return this.showLoading(r), new Promise((m, E) => {
2407
+ return this.showLoading(r), new Promise((m, b) => {
2408
2408
  this.axios({
2409
2409
  cancelToken: a.token,
2410
2410
  ...o,
@@ -2412,7 +2412,7 @@ let As = class {
2412
2412
  headers: c,
2413
2413
  data: f,
2414
2414
  params: d
2415
- }).then((h) => this.isSkipWarnResponse(h) ? m(h.promise) : this.validResponse(r, h) ? m(r.originResponse ? h : h.data?.data) : (this.showError(r, h.data), E(h.data))).catch((h) => (this.showError(r, h), E(h))).finally(() => {
2415
+ }).then((h) => this.isSkipWarnResponse(h) ? m(h.promise) : this.validResponse(r, h) ? m(r.originResponse ? h : h.data?.data) : (this.showError(r, h.data), b(h.data))).catch((h) => (this.showError(r, h), b(h))).finally(() => {
2416
2416
  delete this.records[i], this.closeLoading(r);
2417
2417
  });
2418
2418
  });
@@ -2553,7 +2553,12 @@ class js {
2553
2553
  a = i[o];
2554
2554
  else {
2555
2555
  const m = i.getItem(o);
2556
- m && (a = JSON.parse(m));
2556
+ if (m)
2557
+ try {
2558
+ a = JSON.parse(m);
2559
+ } catch (b) {
2560
+ console.warn("[Storage] JSON.parse", b);
2561
+ }
2557
2562
  }
2558
2563
  if (!a) return null;
2559
2564
  const { value: u, timestamp: c, expired: f } = a;
@@ -2597,9 +2602,9 @@ function Ls() {
2597
2602
  f && document.getElementsByTagName("head")[0].removeChild(f);
2598
2603
  }
2599
2604
  function u(c) {
2600
- var f = arguments.length <= 1 || arguments[1] === void 0 ? {} : arguments[1], d = c, m = f.timeout || s.timeout, E = f.jsonpCallback || s.jsonpCallback, h = void 0;
2605
+ var f = arguments.length <= 1 || arguments[1] === void 0 ? {} : arguments[1], d = c, m = f.timeout || s.timeout, b = f.jsonpCallback || s.jsonpCallback, h = void 0;
2601
2606
  return new Promise(function(g, p) {
2602
- var y = f.jsonpCallbackFunction || o(), S = E + "_" + y;
2607
+ var y = f.jsonpCallbackFunction || o(), S = b + "_" + y;
2603
2608
  window[y] = function(v) {
2604
2609
  g({
2605
2610
  ok: !0,
@@ -2609,12 +2614,12 @@ function Ls() {
2609
2614
  }
2610
2615
  }), h && clearTimeout(h), a(S), i(y);
2611
2616
  }, d += d.indexOf("?") === -1 ? "?" : "&";
2612
- var b = document.createElement("script");
2613
- b.setAttribute("src", "" + d + E + "=" + y), f.charset && b.setAttribute("charset", f.charset), f.nonce && b.setAttribute("nonce", f.nonce), f.referrerPolicy && b.setAttribute("referrerPolicy", f.referrerPolicy), f.crossorigin && b.setAttribute("crossorigin", "true"), b.id = S, document.getElementsByTagName("head")[0].appendChild(b), h = setTimeout(function() {
2617
+ var R = document.createElement("script");
2618
+ R.setAttribute("src", "" + d + b + "=" + y), f.charset && R.setAttribute("charset", f.charset), f.nonce && R.setAttribute("nonce", f.nonce), f.referrerPolicy && R.setAttribute("referrerPolicy", f.referrerPolicy), f.crossorigin && R.setAttribute("crossorigin", "true"), R.id = S, document.getElementsByTagName("head")[0].appendChild(R), h = setTimeout(function() {
2614
2619
  p(new Error("JSONP request to " + c + " timed out")), i(y), a(S), window[y] = function() {
2615
2620
  i(y);
2616
2621
  };
2617
- }, m), b.onerror = function() {
2622
+ }, m), R.onerror = function() {
2618
2623
  p(new Error("JSONP request to " + c + " failed")), i(y), a(S), h && clearTimeout(h);
2619
2624
  };
2620
2625
  });