@stonecrop/stonecrop 0.4.0 → 0.4.2

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/stonecrop.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var Ct = Object.defineProperty;
2
2
  var Lt = (e, t, r) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var y = (e, t, r) => Lt(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { effectScope as qe, ref as R, markRaw as A, toRaw as Y, watch as we, unref as At, hasInjectionContext as jt, inject as Xe, getCurrentInstance as Rt, reactive as Vt, isRef as q, isReactive as Ee, toRef as ue, nextTick as Ce, computed as Ke, getCurrentScope as Bt, onScopeDispose as xt, toRefs as Le, onBeforeMount as Ut } from "vue";
4
+ import { effectScope as qe, ref as G, markRaw as A, toRaw as Y, watch as we, unref as At, hasInjectionContext as jt, inject as Xe, getCurrentInstance as Vt, reactive as Rt, isRef as q, isReactive as Ee, toRef as ue, nextTick as Ce, computed as Ke, getCurrentScope as Bt, onScopeDispose as xt, toRefs as Le, onMounted as Ut } from "vue";
5
5
  function ge(e) {
6
6
  this.message = e || "";
7
7
  }
@@ -14,7 +14,7 @@ ge.prototype = Object.create(Error.prototype, {
14
14
  }
15
15
  }
16
16
  });
17
- const J = class J {
17
+ const H = class H {
18
18
  /**
19
19
  * @param registry - The immutable registry
20
20
  * @param store - The mutable Pinia store
@@ -87,9 +87,9 @@ const J = class J {
87
87
  * The actions are a subset of the registry
88
88
  */
89
89
  y(this, "actions");
90
- if (J._root)
91
- return J._root;
92
- J._root = this, this.registry = t, this.store = r, this.schema = n, this.workflow = o, this.actions = s;
90
+ if (H._root)
91
+ return H._root;
92
+ H._root = this, this.registry = t, this.store = r, this.schema = n, this.workflow = o, this.actions = s;
93
93
  }
94
94
  /**
95
95
  * Sets up the Stonecrop instance with the given doctype
@@ -220,8 +220,8 @@ const J = class J {
220
220
  /**
221
221
  * The root Stonecrop instance
222
222
  */
223
- y(J, "_root");
224
- let me = J;
223
+ y(H, "_root");
224
+ let me = H;
225
225
  var Ze = !1;
226
226
  function Z(e, t, r) {
227
227
  return Array.isArray(e) ? (e.length = Math.max(e.length, t), e.splice(t, 1, r), r) : (e[t] = r, r);
@@ -240,10 +240,10 @@ function et() {
240
240
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
241
241
  }
242
242
  const Ht = typeof Proxy == "function", Jt = "devtools-plugin:setup", Gt = "plugin:settings:set";
243
- let x, ve;
243
+ let B, ve;
244
244
  function Wt() {
245
245
  var e;
246
- return x !== void 0 || (typeof window < "u" && window.performance ? (x = !0, ve = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (x = !0, ve = globalThis.perf_hooks.performance) : x = !1), x;
246
+ return B !== void 0 || (typeof window < "u" && window.performance ? (B = !0, ve = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (B = !0, ve = globalThis.perf_hooks.performance) : B = !1), B;
247
247
  }
248
248
  function zt() {
249
249
  return Wt() ? ve.now() : Date.now();
@@ -574,7 +574,7 @@ function cn(e) {
574
574
  return "unknown";
575
575
  }
576
576
  }
577
- let F = !0;
577
+ let U = !0;
578
578
  const re = [], L = "pinia:mutations", b = "pinia", { assign: un } = Object, oe = (e) => "🍍 " + e;
579
579
  function ln(e, t) {
580
580
  tt({
@@ -666,8 +666,8 @@ function ln(e, t) {
666
666
  value: i._getters.reduce((u, c) => {
667
667
  try {
668
668
  u[c] = i[c];
669
- } catch (d) {
670
- u[c] = d;
669
+ } catch (p) {
670
+ u[c] = p;
671
671
  }
672
672
  return u;
673
673
  }, {})
@@ -692,7 +692,7 @@ function ln(e, t) {
692
692
  if (!s)
693
693
  return _(`store "${n.nodeId}" not found`, "error");
694
694
  const { path: a } = n;
695
- Oe(s) ? a.unshift("state") : (a.length !== 1 || !s._customProperties.has(a[0]) || a[0] in s.$state) && a.unshift("$state"), F = !1, n.set(s, a, n.state.value), F = !0;
695
+ Oe(s) ? a.unshift("state") : (a.length !== 1 || !s._customProperties.has(a[0]) || a[0] in s.$state) && a.unshift("$state"), U = !1, n.set(s, a, n.state.value), U = !0;
696
696
  }
697
697
  }), r.on.editComponentState((n) => {
698
698
  if (n.type.startsWith("🍍")) {
@@ -704,7 +704,7 @@ function ln(e, t) {
704
704
  return _(`Invalid path for store "${o}":
705
705
  ${a}
706
706
  Only state can be modified.`);
707
- a[0] = "$state", F = !1, n.set(s, a, n.state.value), F = !0;
707
+ a[0] = "$state", U = !1, n.set(s, a, n.state.value), U = !0;
708
708
  }
709
709
  });
710
710
  });
@@ -733,7 +733,7 @@ function fn(e, t) {
733
733
  }, (r) => {
734
734
  const n = typeof r.now == "function" ? r.now.bind(r) : Date.now;
735
735
  t.$onAction(({ after: a, onError: i, name: u, args: c }) => {
736
- const d = lt++;
736
+ const p = lt++;
737
737
  r.addTimelineEvent({
738
738
  layerId: L,
739
739
  event: {
@@ -745,9 +745,9 @@ function fn(e, t) {
745
745
  action: N(u),
746
746
  args: c
747
747
  },
748
- groupId: d
748
+ groupId: p
749
749
  }
750
- }), a((p) => {
750
+ }), a((d) => {
751
751
  C = void 0, r.addTimelineEvent({
752
752
  layerId: L,
753
753
  event: {
@@ -758,12 +758,12 @@ function fn(e, t) {
758
758
  store: N(t.$id),
759
759
  action: N(u),
760
760
  args: c,
761
- result: p
761
+ result: d
762
762
  },
763
- groupId: d
763
+ groupId: p
764
764
  }
765
765
  });
766
- }), i((p) => {
766
+ }), i((d) => {
767
767
  C = void 0, r.addTimelineEvent({
768
768
  layerId: L,
769
769
  event: {
@@ -775,15 +775,15 @@ function fn(e, t) {
775
775
  store: N(t.$id),
776
776
  action: N(u),
777
777
  args: c,
778
- error: p
778
+ error: d
779
779
  },
780
- groupId: d
780
+ groupId: p
781
781
  }
782
782
  });
783
783
  });
784
784
  }, !0), t._customProperties.forEach((a) => {
785
785
  we(() => At(t[a]), (i, u) => {
786
- r.notifyComponentUpdate(), r.sendInspectorState(b), F && r.addTimelineEvent({
786
+ r.notifyComponentUpdate(), r.sendInspectorState(b), U && r.addTimelineEvent({
787
787
  layerId: L,
788
788
  event: {
789
789
  time: n(),
@@ -798,7 +798,7 @@ function fn(e, t) {
798
798
  });
799
799
  }, { deep: !0 });
800
800
  }), t.$subscribe(({ events: a, type: i }, u) => {
801
- if (r.notifyComponentUpdate(), r.sendInspectorState(b), !F)
801
+ if (r.notifyComponentUpdate(), r.sendInspectorState(b), !U)
802
802
  return;
803
803
  const c = {
804
804
  time: n(),
@@ -874,7 +874,7 @@ function dn({ app: e, store: t, options: r }) {
874
874
  }
875
875
  }
876
876
  function pn() {
877
- const e = qe(!0), t = e.run(() => R({}));
877
+ const e = qe(!0), t = e.run(() => G({}));
878
878
  let r = [], n = [];
879
879
  const o = A({
880
880
  install(s) {
@@ -905,7 +905,7 @@ function ft(e, t) {
905
905
  }
906
906
  const dt = () => {
907
907
  };
908
- function Re(e, t, r, n = dt) {
908
+ function Ve(e, t, r, n = dt) {
909
909
  e.push(t);
910
910
  const o = () => {
911
911
  const s = e.indexOf(t);
@@ -913,12 +913,12 @@ function Re(e, t, r, n = dt) {
913
913
  };
914
914
  return !r && Bt() && xt(o), o;
915
915
  }
916
- function U(e, ...t) {
916
+ function x(e, ...t) {
917
917
  e.slice().forEach((r) => {
918
918
  r(...t);
919
919
  });
920
920
  }
921
- const hn = (e) => e(), Ve = Symbol(), fe = Symbol();
921
+ const hn = (e) => e(), Re = Symbol(), fe = Symbol();
922
922
  function ye(e, t) {
923
923
  e instanceof Map && t instanceof Map ? t.forEach((r, n) => e.set(n, r)) : e instanceof Set && t instanceof Set && t.forEach(e.add, e);
924
924
  for (const r in t) {
@@ -945,15 +945,15 @@ function xe(e, t, r, n) {
945
945
  let u;
946
946
  function c() {
947
947
  !i && (process.env.NODE_ENV === "production" || !n) && (r.state.value[e] = o ? o() : {});
948
- const d = process.env.NODE_ENV !== "production" && n ? (
948
+ const p = process.env.NODE_ENV !== "production" && n ? (
949
949
  // use ref() to unwrap refs inside state TODO: check if this is still necessary
950
- Le(R(o ? o() : {}).value)
950
+ Le(G(o ? o() : {}).value)
951
951
  ) : Le(r.state.value[e]);
952
- return I(d, s, Object.keys(a || {}).reduce((p, g) => (process.env.NODE_ENV !== "production" && g in d && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${g}" in store "${e}".`), p[g] = A(Ke(() => {
952
+ return I(p, s, Object.keys(a || {}).reduce((d, g) => (process.env.NODE_ENV !== "production" && g in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${g}" in store "${e}".`), d[g] = A(Ke(() => {
953
953
  X(r);
954
954
  const w = r._s.get(e);
955
955
  return a[g].call(w, w);
956
- })), p), {}));
956
+ })), d), {}));
957
957
  }
958
958
  return u = _e(e, c, t, r, n, !0), u;
959
959
  }
@@ -966,14 +966,14 @@ function _e(e, t, r = {}, n, o, s) {
966
966
  process.env.NODE_ENV !== "production" && !Ze && (u.onTrigger = (f) => {
967
967
  c ? w = f : c == !1 && !h._hotUpdating && (Array.isArray(w) ? w.push(f) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
968
968
  });
969
- let c, d, p = [], g = [], w;
969
+ let c, p, d = [], g = [], w;
970
970
  const E = n.state.value[e];
971
971
  !s && !E && (process.env.NODE_ENV === "production" || !o) && (n.state.value[e] = {});
972
- const B = R({});
972
+ const R = G({});
973
973
  let v;
974
974
  function T(f) {
975
975
  let l;
976
- c = d = !1, process.env.NODE_ENV !== "production" && (w = []), typeof f == "function" ? (f(n.state.value[e]), l = {
976
+ c = p = !1, process.env.NODE_ENV !== "production" && (w = []), typeof f == "function" ? (f(n.state.value[e]), l = {
977
977
  type: P.patchFunction,
978
978
  storeId: e,
979
979
  events: w
@@ -986,7 +986,7 @@ function _e(e, t, r = {}, n, o, s) {
986
986
  const m = v = Symbol();
987
987
  Ce().then(() => {
988
988
  v === m && (c = !0);
989
- }), d = !0, U(p, l, n.state.value[e]);
989
+ }), p = !0, x(d, l, n.state.value[e]);
990
990
  }
991
991
  const $t = s ? function() {
992
992
  const { state: l } = r, m = l ? l() : {};
@@ -1000,10 +1000,10 @@ function _e(e, t, r = {}, n, o, s) {
1000
1000
  } : dt
1001
1001
  );
1002
1002
  function Tt() {
1003
- a.stop(), p = [], g = [], n._s.delete(e);
1003
+ a.stop(), d = [], g = [], n._s.delete(e);
1004
1004
  }
1005
1005
  const ae = (f, l = "") => {
1006
- if (Ve in f)
1006
+ if (Re in f)
1007
1007
  return f[fe] = l, f;
1008
1008
  const m = function() {
1009
1009
  X(n);
@@ -1014,7 +1014,7 @@ function _e(e, t, r = {}, n, o, s) {
1014
1014
  function Mt(O) {
1015
1015
  ce.push(O);
1016
1016
  }
1017
- U(g, {
1017
+ x(g, {
1018
1018
  args: S,
1019
1019
  name: m[fe],
1020
1020
  store: h,
@@ -1025,26 +1025,26 @@ function _e(e, t, r = {}, n, o, s) {
1025
1025
  try {
1026
1026
  z = f.apply(this && this.$id === e ? this : h, S);
1027
1027
  } catch (O) {
1028
- throw U(ce, O), O;
1028
+ throw x(ce, O), O;
1029
1029
  }
1030
- return z instanceof Promise ? z.then((O) => (U(W, O), O)).catch((O) => (U(ce, O), Promise.reject(O))) : (U(W, z), z);
1030
+ return z instanceof Promise ? z.then((O) => (x(W, O), O)).catch((O) => (x(ce, O), Promise.reject(O))) : (x(W, z), z);
1031
1031
  };
1032
- return m[Ve] = !0, m[fe] = l, m;
1032
+ return m[Re] = !0, m[fe] = l, m;
1033
1033
  }, K = /* @__PURE__ */ A({
1034
1034
  actions: {},
1035
1035
  getters: {},
1036
1036
  state: [],
1037
- hotState: B
1037
+ hotState: R
1038
1038
  }), Me = {
1039
1039
  _p: n,
1040
1040
  // _s: scope,
1041
1041
  $id: e,
1042
- $onAction: Re.bind(null, g),
1042
+ $onAction: Ve.bind(null, g),
1043
1043
  $patch: T,
1044
1044
  $reset: $t,
1045
1045
  $subscribe(f, l = {}) {
1046
- const m = Re(p, f, l.detached, () => S()), S = a.run(() => we(() => n.state.value[e], (W) => {
1047
- (l.flush === "sync" ? d : c) && f({
1046
+ const m = Ve(d, f, l.detached, () => S()), S = a.run(() => we(() => n.state.value[e], (W) => {
1047
+ (l.flush === "sync" ? p : c) && f({
1048
1048
  storeId: e,
1049
1049
  type: P.direct,
1050
1050
  events: w
@@ -1053,7 +1053,7 @@ function _e(e, t, r = {}, n, o, s) {
1053
1053
  return m;
1054
1054
  },
1055
1055
  $dispose: Tt
1056
- }, h = Vt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && M ? I(
1056
+ }, h = Rt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && M ? I(
1057
1057
  {
1058
1058
  _hmrPayload: K,
1059
1059
  _customProperties: A(/* @__PURE__ */ new Set())
@@ -1068,7 +1068,7 @@ function _e(e, t, r = {}, n, o, s) {
1068
1068
  for (const f in D) {
1069
1069
  const l = D[f];
1070
1070
  if (q(l) && !Be(l) || Ee(l))
1071
- process.env.NODE_ENV !== "production" && o ? Z(B.value, f, ue(D, f)) : s || (E && mn(l) && (q(l) ? l.value = E[f] : ye(l, E[f])), n.state.value[e][f] = l), process.env.NODE_ENV !== "production" && K.state.push(f);
1071
+ process.env.NODE_ENV !== "production" && o ? Z(R.value, f, ue(D, f)) : s || (E && mn(l) && (q(l) ? l.value = E[f] : ye(l, E[f])), n.state.value[e][f] = l), process.env.NODE_ENV !== "production" && K.state.push(f);
1072
1072
  else if (typeof l == "function") {
1073
1073
  const m = process.env.NODE_ENV !== "production" && o ? l : ae(l, f);
1074
1074
  D[f] = m, process.env.NODE_ENV !== "production" && (K.actions[f] = l), i.actions[f] = l;
@@ -1079,7 +1079,7 @@ function _e(e, t, r = {}, n, o, s) {
1079
1079
  (D._getters = A([]))).push(f));
1080
1080
  }
1081
1081
  if (I(h, D), I(Y(h), D), Object.defineProperty(h, "$state", {
1082
- get: () => process.env.NODE_ENV !== "production" && o ? B.value : n.state.value[e],
1082
+ get: () => process.env.NODE_ENV !== "production" && o ? R.value : n.state.value[e],
1083
1083
  set: (f) => {
1084
1084
  if (process.env.NODE_ENV !== "production" && o)
1085
1085
  throw new Error("cannot set hotState");
@@ -1096,7 +1096,7 @@ function _e(e, t, r = {}, n, o, s) {
1096
1096
  Z(h, l, ue(f.$state, l));
1097
1097
  }), Object.keys(h.$state).forEach((l) => {
1098
1098
  l in f.$state || le(h, l);
1099
- }), c = !1, d = !1, n.state.value[e] = ue(f._hmrPayload, "hotState"), d = !0, Ce().then(() => {
1099
+ }), c = !1, p = !1, n.state.value[e] = ue(f._hmrPayload, "hotState"), p = !0, Ce().then(() => {
1100
1100
  c = !0;
1101
1101
  });
1102
1102
  for (const l in f._hmrPayload.actions) {
@@ -1144,7 +1144,7 @@ function _e(e, t, r = {}, n, o, s) {
1144
1144
  })));
1145
1145
  }), process.env.NODE_ENV !== "production" && h.$state && typeof h.$state == "object" && typeof h.$state.constructor == "function" && !h.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
1146
1146
  state: () => new MyClass()
1147
- Found in store "${h.$id}".`), E && s && r.hydrate && r.hydrate(h.$state, E), c = !0, d = !0, h;
1147
+ Found in store "${h.$id}".`), E && s && r.hydrate && r.hydrate(h.$state, E), c = !0, p = !0, h;
1148
1148
  }
1149
1149
  /*! #__NO_SIDE_EFFECTS__ */
1150
1150
  // @__NO_SIDE_EFFECTS__
@@ -1161,45 +1161,45 @@ function vn(e, t, r) {
1161
1161
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
1162
1162
  This will fail in production.`);
1163
1163
  i = Q, i._s.has(n) || (s ? _e(n, t, o, i) : xe(n, o, i), process.env.NODE_ENV !== "production" && (a._pinia = i));
1164
- const d = i._s.get(n);
1164
+ const p = i._s.get(n);
1165
1165
  if (process.env.NODE_ENV !== "production" && u) {
1166
- const p = "__hot:" + n, g = s ? _e(p, t, o, i, !0) : xe(p, I({}, o), i, !0);
1167
- u._hotUpdate(g), delete i.state.value[p], i._s.delete(p);
1166
+ const d = "__hot:" + n, g = s ? _e(d, t, o, i, !0) : xe(d, I({}, o), i, !0);
1167
+ u._hotUpdate(g), delete i.state.value[d], i._s.delete(d);
1168
1168
  }
1169
1169
  if (process.env.NODE_ENV !== "production" && M) {
1170
- const p = Rt();
1171
- if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
1170
+ const d = Vt();
1171
+ if (d && d.proxy && // avoid adding stores that are just built for hot module replacement
1172
1172
  !u) {
1173
- const g = p.proxy, w = "_pStores" in g ? g._pStores : g._pStores = {};
1174
- w[n] = d;
1173
+ const g = d.proxy, w = "_pStores" in g ? g._pStores : g._pStores = {};
1174
+ w[n] = p;
1175
1175
  }
1176
1176
  }
1177
- return d;
1177
+ return p;
1178
1178
  }
1179
1179
  return a.$id = n, a;
1180
1180
  }
1181
1181
  const yn = /* @__PURE__ */ vn("data", () => {
1182
- const e = R([]), t = R({});
1182
+ const e = G([]), t = G({});
1183
1183
  return { records: e, record: t };
1184
1184
  });
1185
1185
  function Tr(e) {
1186
- e || (e = Xe("$registry"));
1187
- let t;
1188
- try {
1189
- t = yn();
1190
- } catch {
1191
- throw new Error("Please enable the Stonecrop plugin before using the Stonecrop composable");
1192
- }
1193
- const r = R(new me(e, t)), n = R(!1);
1186
+ const t = G();
1194
1187
  return Ut(async () => {
1195
- var u, c, d;
1196
- if (!e || !e.router) return;
1197
- const o = e.router.currentRoute.value, s = (u = o.params.records) == null ? void 0 : u.toString().toLowerCase(), a = (c = o.params.record) == null ? void 0 : c.toString().toLowerCase();
1198
- if (!s && !a)
1188
+ var i, u, c;
1189
+ e || (e = Xe("$registry"));
1190
+ let r;
1191
+ try {
1192
+ r = yn();
1193
+ } catch {
1194
+ throw new Error("Please enable the Stonecrop plugin before using the Stonecrop composable");
1195
+ }
1196
+ if (t.value = new me(e, r), !e || !e.router) return;
1197
+ const n = e.router.currentRoute.value, o = (i = n.params.records) == null ? void 0 : i.toString().toLowerCase(), s = (u = n.params.record) == null ? void 0 : u.toString().toLowerCase();
1198
+ if (!o && !s)
1199
1199
  return;
1200
- const i = await ((d = e.getMeta) == null ? void 0 : d.call(e, s));
1201
- i && (e.addDoctype(i), r.value.setup(i), s && (a ? await r.value.getRecord(i, a) : await r.value.getRecords(i)), r.value.runAction(i, "LOAD", a ? [a] : void 0)), n.value = !0;
1202
- }), { stonecrop: r, isReady: n };
1200
+ const a = await ((c = e.getMeta) == null ? void 0 : c.call(e, o));
1201
+ a && (e.addDoctype(a), t.value.setup(a), o && (s ? await t.value.getRecord(a, s) : await t.value.getRecords(a)), t.value.runAction(a, "LOAD", s ? [s] : void 0));
1202
+ }), { stonecrop: t };
1203
1203
  }
1204
1204
  class Dr {
1205
1205
  // TODO: allow different components for different views; probably
@@ -1246,7 +1246,7 @@ class Dr {
1246
1246
  return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
1247
1247
  }
1248
1248
  }
1249
- const G = class G {
1249
+ const J = class J {
1250
1250
  constructor(t, r) {
1251
1251
  /**
1252
1252
  * The name of the Registry instance
@@ -1269,9 +1269,9 @@ const G = class G {
1269
1269
  * @see {@link DoctypeMeta}
1270
1270
  */
1271
1271
  y(this, "getMeta");
1272
- if (G._root)
1273
- return G._root;
1274
- G._root = this, this.name = "Registry", this.registry = {}, this.router = t, this.getMeta = r;
1272
+ if (J._root)
1273
+ return J._root;
1274
+ J._root = this, this.name = "Registry", this.registry = {}, this.router = t, this.getMeta = r;
1275
1275
  }
1276
1276
  /**
1277
1277
  * Get doctype metadata
@@ -1290,8 +1290,8 @@ const G = class G {
1290
1290
  /**
1291
1291
  * The root Registry instance
1292
1292
  */
1293
- y(G, "_root");
1294
- let be = G;
1293
+ y(J, "_root");
1294
+ let be = J;
1295
1295
  function _n(e) {
1296
1296
  return e && typeof e.then == "function";
1297
1297
  }
@@ -1452,10 +1452,10 @@ function jn(e, t) {
1452
1452
  if (n.getAll) {
1453
1453
  var a = n.getAll(s);
1454
1454
  return new Promise(function(u, c) {
1455
- a.onerror = function(d) {
1456
- return c(d);
1457
- }, a.onsuccess = function(d) {
1458
- u(d.target.result);
1455
+ a.onerror = function(p) {
1456
+ return c(p);
1457
+ }, a.onsuccess = function(p) {
1458
+ u(p.target.result);
1459
1459
  };
1460
1460
  });
1461
1461
  }
@@ -1467,16 +1467,16 @@ function jn(e, t) {
1467
1467
  }
1468
1468
  }
1469
1469
  return new Promise(function(u, c) {
1470
- var d = i();
1471
- d.onerror = function(p) {
1472
- return c(p);
1473
- }, d.onsuccess = function(p) {
1474
- var g = p.target.result;
1470
+ var p = i();
1471
+ p.onerror = function(d) {
1472
+ return c(d);
1473
+ }, p.onsuccess = function(d) {
1474
+ var g = d.target.result;
1475
1475
  g ? g.value.id < t + 1 ? g.continue(t + 1) : (o.push(g.value), g.continue()) : (Pe(r), u(o));
1476
1476
  };
1477
1477
  });
1478
1478
  }
1479
- function Rn(e, t) {
1479
+ function Vn(e, t) {
1480
1480
  if (e.closed)
1481
1481
  return Promise.resolve([]);
1482
1482
  var r = e.db.transaction($, "readwrite", ie), n = r.objectStore($);
@@ -1489,7 +1489,7 @@ function Rn(e, t) {
1489
1489
  });
1490
1490
  }));
1491
1491
  }
1492
- function Vn(e, t) {
1492
+ function Rn(e, t) {
1493
1493
  var r = (/* @__PURE__ */ new Date()).getTime() - t, n = e.transaction($, "readonly", ie), o = n.objectStore($), s = [];
1494
1494
  return new Promise(function(a) {
1495
1495
  o.openCursor().onsuccess = function(i) {
@@ -1503,8 +1503,8 @@ function Vn(e, t) {
1503
1503
  });
1504
1504
  }
1505
1505
  function Bn(e) {
1506
- return Vn(e.db, e.options.idb.ttl).then(function(t) {
1507
- return Rn(e, t.map(function(r) {
1506
+ return Rn(e.db, e.options.idb.ttl).then(function(t) {
1507
+ return Vn(e, t.map(function(r) {
1508
1508
  return r.id;
1509
1509
  }));
1510
1510
  });
@@ -1905,7 +1905,7 @@ function Er(e) {
1905
1905
  return e < " " ? `\\u${e.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
1906
1906
  }
1907
1907
  }
1908
- function H(e) {
1908
+ function F(e) {
1909
1909
  let t = "", r = 0;
1910
1910
  const n = e.length;
1911
1911
  for (let o = 0; o < n; o += 1) {
@@ -1951,10 +1951,10 @@ function Sr(e, t) {
1951
1951
  c.add(o(i[g]));
1952
1952
  break;
1953
1953
  case "Map":
1954
- const d = /* @__PURE__ */ new Map();
1955
- n[s] = d;
1954
+ const p = /* @__PURE__ */ new Map();
1955
+ n[s] = p;
1956
1956
  for (let g = 1; g < i.length; g += 2)
1957
- d.set(o(i[g]), o(i[g + 1]));
1957
+ p.set(o(i[g]), o(i[g + 1]));
1958
1958
  break;
1959
1959
  case "RegExp":
1960
1960
  n[s] = new RegExp(i[1], i[2]);
@@ -1966,10 +1966,10 @@ function Sr(e, t) {
1966
1966
  n[s] = BigInt(i[1]);
1967
1967
  break;
1968
1968
  case "null":
1969
- const p = /* @__PURE__ */ Object.create(null);
1970
- n[s] = p;
1969
+ const d = /* @__PURE__ */ Object.create(null);
1970
+ n[s] = d;
1971
1971
  for (let g = 1; g < i.length; g += 2)
1972
- p[i[g]] = o(i[g + 1]);
1972
+ d[i[g]] = o(i[g + 1]);
1973
1973
  break;
1974
1974
  default:
1975
1975
  throw new Error(`Unknown type ${u}`);
@@ -1978,16 +1978,16 @@ function Sr(e, t) {
1978
1978
  const u = new Array(i.length);
1979
1979
  n[s] = u;
1980
1980
  for (let c = 0; c < i.length; c += 1) {
1981
- const d = i[c];
1982
- d !== Ot && (u[c] = o(d));
1981
+ const p = i[c];
1982
+ p !== Ot && (u[c] = o(p));
1983
1983
  }
1984
1984
  }
1985
1985
  else {
1986
1986
  const u = {};
1987
1987
  n[s] = u;
1988
1988
  for (const c in i) {
1989
- const d = i[c];
1990
- u[c] = o(d);
1989
+ const p = i[c];
1990
+ u[c] = o(p);
1991
1991
  }
1992
1992
  }
1993
1993
  return n[s];
@@ -2009,52 +2009,52 @@ function Ye(e, t) {
2009
2009
  if (c === 1 / 0) return Nt;
2010
2010
  if (c === -1 / 0) return Pt;
2011
2011
  if (c === 0 && 1 / c < 0) return De;
2012
- const d = a++;
2013
- n.set(c, d);
2012
+ const p = a++;
2013
+ n.set(c, p);
2014
2014
  for (const { key: g, fn: w } of o) {
2015
2015
  const E = w(c);
2016
2016
  if (E)
2017
- return r[d] = `["${g}",${i(E)}]`, d;
2017
+ return r[p] = `["${g}",${i(E)}]`, p;
2018
2018
  }
2019
- let p = "";
2019
+ let d = "";
2020
2020
  if (ze(c))
2021
- p = he(c);
2021
+ d = he(c);
2022
2022
  else
2023
2023
  switch (wr(c)) {
2024
2024
  case "Number":
2025
2025
  case "String":
2026
2026
  case "Boolean":
2027
- p = `["Object",${he(c)}]`;
2027
+ d = `["Object",${he(c)}]`;
2028
2028
  break;
2029
2029
  case "BigInt":
2030
- p = `["BigInt",${c}]`;
2030
+ d = `["BigInt",${c}]`;
2031
2031
  break;
2032
2032
  case "Date":
2033
- p = `["Date","${!isNaN(c.getDate()) ? c.toISOString() : ""}"]`;
2033
+ d = `["Date","${!isNaN(c.getDate()) ? c.toISOString() : ""}"]`;
2034
2034
  break;
2035
2035
  case "RegExp":
2036
- const { source: E, flags: B } = c;
2037
- p = B ? `["RegExp",${H(E)},"${B}"]` : `["RegExp",${H(E)}]`;
2036
+ const { source: E, flags: R } = c;
2037
+ d = R ? `["RegExp",${F(E)},"${R}"]` : `["RegExp",${F(E)}]`;
2038
2038
  break;
2039
2039
  case "Array":
2040
- p = "[";
2040
+ d = "[";
2041
2041
  for (let v = 0; v < c.length; v += 1)
2042
- v > 0 && (p += ","), v in c ? (s.push(`[${v}]`), p += i(c[v]), s.pop()) : p += Ot;
2043
- p += "]";
2042
+ v > 0 && (d += ","), v in c ? (s.push(`[${v}]`), d += i(c[v]), s.pop()) : d += Ot;
2043
+ d += "]";
2044
2044
  break;
2045
2045
  case "Set":
2046
- p = '["Set"';
2046
+ d = '["Set"';
2047
2047
  for (const v of c)
2048
- p += `,${i(v)}`;
2049
- p += "]";
2048
+ d += `,${i(v)}`;
2049
+ d += "]";
2050
2050
  break;
2051
2051
  case "Map":
2052
- p = '["Map"';
2052
+ d = '["Map"';
2053
2053
  for (const [v, T] of c)
2054
2054
  s.push(
2055
2055
  `.get(${ze(v) ? he(v) : "..."})`
2056
- ), p += `,${i(v)},${i(T)}`, s.pop();
2057
- p += "]";
2056
+ ), d += `,${i(v)},${i(T)}`, s.pop();
2057
+ d += "]";
2058
2058
  break;
2059
2059
  default:
2060
2060
  if (!br(c))
@@ -2068,37 +2068,37 @@ function Ye(e, t) {
2068
2068
  s
2069
2069
  );
2070
2070
  if (Object.getPrototypeOf(c) === null) {
2071
- p = '["null"';
2071
+ d = '["null"';
2072
2072
  for (const v in c)
2073
- s.push(`.${v}`), p += `,${H(v)},${i(c[v])}`, s.pop();
2074
- p += "]";
2073
+ s.push(`.${v}`), d += `,${F(v)},${i(c[v])}`, s.pop();
2074
+ d += "]";
2075
2075
  } else {
2076
- p = "{";
2076
+ d = "{";
2077
2077
  let v = !1;
2078
2078
  for (const T in c)
2079
- v && (p += ","), v = !0, s.push(`.${T}`), p += `${H(T)}:${i(c[T])}`, s.pop();
2080
- p += "}";
2079
+ v && (d += ","), v = !0, s.push(`.${T}`), d += `${F(T)}:${i(c[T])}`, s.pop();
2080
+ d += "}";
2081
2081
  }
2082
2082
  }
2083
- return r[d] = p, d;
2083
+ return r[p] = d, p;
2084
2084
  }
2085
2085
  const u = i(e);
2086
2086
  return u < 0 ? `${u}` : `[${r.join(",")}]`;
2087
2087
  }
2088
2088
  function he(e) {
2089
2089
  const t = typeof e;
2090
- return t === "string" ? H(e) : e instanceof String ? H(e.toString()) : e === void 0 ? Te.toString() : e === 0 && 1 / e < 0 ? De.toString() : t === "bigint" ? `["BigInt","${e}"]` : String(e);
2090
+ return t === "string" ? F(e) : e instanceof String ? F(e.toString()) : e === void 0 ? Te.toString() : e === 0 && 1 / e < 0 ? De.toString() : t === "bigint" ? `["BigInt","${e}"]` : String(e);
2091
2091
  }
2092
2092
  function Or(e, t, { initialize: r, type: n }) {
2093
2093
  let o = `${t.$id}-${e.toString()}`, s = new $e(o, { type: n }), a = !1, i = 0;
2094
- we(() => t[e], (d) => {
2095
- a || (i = Date.now(), s.postMessage({ timestamp: i, state: Qe(Ye(d)) })), a = !1;
2096
- }, { deep: !0 }), s.onmessage = (d) => {
2097
- if (d === void 0) {
2094
+ we(() => t[e], (p) => {
2095
+ a || (i = Date.now(), s.postMessage({ timestamp: i, state: Qe(Ye(p)) })), a = !1;
2096
+ }, { deep: !0 }), s.onmessage = (p) => {
2097
+ if (p === void 0) {
2098
2098
  s.postMessage({ timestamp: i, state: Qe(Ye(t[e])) });
2099
2099
  return;
2100
2100
  }
2101
- d.timestamp <= i || (a = !0, i = d.timestamp, t[e] = d.state);
2101
+ p.timestamp <= i || (a = !0, i = p.timestamp, t[e] = p.state);
2102
2102
  };
2103
2103
  let u = () => s.postMessage(void 0), c = () => s.close();
2104
2104
  return r && u(), { sync: u, unshare: c };
@@ -2107,8 +2107,8 @@ var Ir = (e, t) => Object.keys(t).includes(e), Nr = ({ initialize: e = !0, enabl
2107
2107
  var i, u;
2108
2108
  let s = ((i = o == null ? void 0 : o.share) == null ? void 0 : i.enable) ?? t, a = ((u = o == null ? void 0 : o.share) == null ? void 0 : u.omit) ?? [];
2109
2109
  !s || Object.keys(n.$state).forEach((c) => {
2110
- var d;
2111
- a.includes(c) || !Ir(c, n.$state) || Or(c, n, { initialize: ((d = o == null ? void 0 : o.share) == null ? void 0 : d.initialize) ?? e, type: r });
2110
+ var p;
2111
+ a.includes(c) || !Ir(c, n.$state) || Or(c, n, { initialize: ((p = o == null ? void 0 : o.share) == null ? void 0 : p.initialize) ?? e, type: r });
2112
2112
  });
2113
2113
  };
2114
2114
  const kt = pn();