@pinia/colada-devtools 0.0.2 → 0.0.3

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as $, ref as R, onMounted as L, renderSlot as ne, createCommentVNode as M, toValue as C, getCurrentScope as J, onScopeDispose as Q, useTemplateRef as oe, shallowRef as N, watch as P, onBeforeUnmount as ie, createBlock as W, openBlock as x, Teleport as re, createElementVNode as se, nextTick as G, readonly as K, getCurrentInstance as ae, toRef as le, customRef as ue, computed as U, unref as F, withCtx as ce, createElementBlock as de } from "vue";
1
+ import { defineComponent as $, ref as R, onMounted as L, renderSlot as ne, createCommentVNode as M, toValue as A, getCurrentScope as J, onScopeDispose as Q, useTemplateRef as oe, shallowRef as N, watch as P, onBeforeUnmount as ie, createBlock as W, openBlock as x, Teleport as se, createElementVNode as re, nextTick as G, readonly as K, getCurrentInstance as ae, toRef as le, customRef as ue, computed as U, unref as F, withCtx as ce, createElementBlock as de } from "vue";
2
2
  import { useQueryCache as fe } from "@pinia/colada";
3
3
  import { DEVTOOLS_INFO_KEY as p, DuplexChannel as pe } from "@pinia/colada-devtools/shared";
4
4
  const ve = /* @__PURE__ */ $({
@@ -9,66 +9,83 @@ const ve = /* @__PURE__ */ $({
9
9
  t.value = !0;
10
10
  }), (o, l) => t.value ? ne(o.$slots, "default", { key: 0 }) : M("", !0);
11
11
  }
12
- }), b = () => performance.timeOrigin + performance.now();
12
+ }), S = () => performance.timeOrigin + performance.now();
13
13
  function me(e) {
14
- I.has(e) || (I.set(e, !0), e.$onAction(({ name: t, args: o, after: l, onError: s }) => {
15
- var c, y;
16
- if (t === "create")
17
- l((r) => {
18
- r[p] = {
19
- count: {
20
- total: 0,
21
- succeed: 0,
22
- errored: 0,
23
- cancelled: 0
24
- },
25
- updatedAt: b(),
26
- inactiveAt: 0,
27
- simulate: null,
28
- history: []
29
- };
30
- });
31
- else if (t === "fetch") {
32
- const [r] = o;
33
- r[p].count.total++, r[p].updatedAt = b();
34
- const u = b(), f = {
35
- id: (((c = r[p].history.at(0)) == null ? void 0 : c.id) ?? -1) + 1,
36
- key: r.key,
37
- state: r.state.value,
38
- updatedAt: u,
39
- createdAt: u,
40
- fetchTime: null
41
- }, h = C((y = r.options) == null ? void 0 : y.enabled) ?? !0;
42
- h && (f.fetchTime = {
43
- start: u,
44
- end: null
45
- }), r[p].history.unshift(f), r[p].history = r[p].history.slice(0, 10), l(() => {
46
- h && (f.fetchTime.end = b(), r[p].count.succeed++, f.state = r.state.value, f.updatedAt = b());
47
- }), s(() => {
48
- h && (f.fetchTime.end = b(), r[p].count.errored++, f.state = r.state.value, f.updatedAt = b());
49
- });
50
- } else if (t === "cancel") {
51
- const [r] = o;
52
- r.pending && r[p].count.cancelled++;
53
- } else if (t === "setEntryState") {
54
- const [r] = o;
55
- let u = r[p].history[0];
56
- l(() => {
57
- r[p].updatedAt = b(), u ?? (u = r[p].history[0]), u && (u.state = r.state.value, u.updatedAt = b());
58
- });
59
- } else if (t === "untrack") {
60
- const [r] = o;
61
- l(() => {
62
- r.active || (r[p].inactiveAt = b());
63
- });
64
- } else if (t === "setQueryData") {
65
- const [r] = o;
66
- l(() => {
67
- const u = e.getEntries({ key: r, exact: !0 })[0];
68
- u && !u.active && (u[p].inactiveAt = b());
14
+ var t;
15
+ if (!I.has(e)) {
16
+ I.set(e, !0);
17
+ for (const o of e.getEntries())
18
+ o[t = p] ?? (o[t] = {
19
+ count: {
20
+ total: 0,
21
+ succeed: 0,
22
+ errored: 0,
23
+ cancelled: 0
24
+ },
25
+ updatedAt: S(),
26
+ inactiveAt: 0,
27
+ simulate: null,
28
+ history: []
69
29
  });
70
- }
71
- }));
30
+ e.$onAction(({ name: o, args: l, after: s, onError: d }) => {
31
+ var h, f;
32
+ if (o === "create")
33
+ s((r) => {
34
+ r[p] = {
35
+ count: {
36
+ total: 0,
37
+ succeed: 0,
38
+ errored: 0,
39
+ cancelled: 0
40
+ },
41
+ updatedAt: S(),
42
+ inactiveAt: 0,
43
+ simulate: null,
44
+ history: []
45
+ };
46
+ });
47
+ else if (o === "fetch") {
48
+ const [r] = l;
49
+ r[p].count.total++, r[p].updatedAt = S();
50
+ const u = S(), v = {
51
+ id: (((h = r[p].history.at(0)) == null ? void 0 : h.id) ?? -1) + 1,
52
+ key: r.key,
53
+ state: r.state.value,
54
+ updatedAt: u,
55
+ createdAt: u,
56
+ fetchTime: null
57
+ }, n = A((f = r.options) == null ? void 0 : f.enabled) ?? !0;
58
+ n && (v.fetchTime = {
59
+ start: u,
60
+ end: null
61
+ }), r[p].history.unshift(v), r[p].history = r[p].history.slice(0, 10), s(() => {
62
+ n && (v.fetchTime.end = S(), r[p].count.succeed++, v.state = r.state.value, v.updatedAt = S());
63
+ }), d(() => {
64
+ n && (v.fetchTime.end = S(), r[p].count.errored++, v.state = r.state.value, v.updatedAt = S());
65
+ });
66
+ } else if (o === "cancel") {
67
+ const [r] = l;
68
+ r.pending && r[p].count.cancelled++;
69
+ } else if (o === "setEntryState") {
70
+ const [r] = l;
71
+ let u = r[p].history[0];
72
+ s(() => {
73
+ r[p].updatedAt = S(), u ?? (u = r[p].history[0]), u && (u.state = r.state.value, u.updatedAt = S());
74
+ });
75
+ } else if (o === "untrack") {
76
+ const [r] = l;
77
+ s(() => {
78
+ r.active || (r[p].inactiveAt = S());
79
+ });
80
+ } else if (o === "setQueryData") {
81
+ const [r] = l;
82
+ s(() => {
83
+ const u = e.getEntries({ key: r, exact: !0 })[0];
84
+ u && !u.active && (u[p].inactiveAt = S());
85
+ });
86
+ }
87
+ });
88
+ }
72
89
  }
73
90
  function w(e) {
74
91
  return {
@@ -82,10 +99,10 @@ function w(e) {
82
99
  options: e.options && {
83
100
  staleTime: e.options.staleTime,
84
101
  gcTime: e.options.gcTime,
85
- refetchOnMount: C(e.options.refetchOnMount),
86
- refetchOnReconnect: C(e.options.refetchOnReconnect),
87
- refetchOnWindowFocus: C(e.options.refetchOnWindowFocus),
88
- enabled: C(e.options.enabled)
102
+ refetchOnMount: A(e.options.refetchOnMount),
103
+ refetchOnReconnect: A(e.options.refetchOnReconnect),
104
+ refetchOnWindowFocus: A(e.options.refetchOnWindowFocus),
105
+ enabled: A(e.options.enabled)
89
106
  },
90
107
  deps: Array.from(e.deps).map(
91
108
  (t) => "uid" in t ? {
@@ -112,24 +129,24 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
112
129
  __name: "PiniaColadaDevtools",
113
130
  setup(e) {
114
131
  const t = fe();
115
- me(t), t.$onAction(({ name: n, after: i, onError: v, args: S }) => {
132
+ me(t), t.$onAction(({ name: n, after: i, onError: m, args: E }) => {
116
133
  if (n === "remove") {
117
- const [a] = S;
134
+ const [a] = E;
118
135
  i(() => {
119
136
  s.emit("queries:delete", w(a));
120
137
  });
121
138
  } else if (n === "track" || n === "untrack" || n === "cancel" || n === "invalidate" || n === "fetch" || n === "setEntryState") {
122
- const [a] = S;
139
+ const [a] = E;
123
140
  if (n === "fetch") {
124
- const m = w(a);
125
- m.asyncStatus = "loading", s.emit("queries:update", m);
141
+ const y = w(a);
142
+ y.asyncStatus = "loading", s.emit("queries:update", y);
126
143
  }
127
144
  i(() => {
128
- var m;
129
- a[p].simulate = null, s.emit("queries:update", w(a)), n === "fetch" && ((m = a.options) == null ? void 0 : m.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
145
+ var y;
146
+ a[p].simulate = null, s.emit("queries:update", w(a)), n === "fetch" && ((y = a.options) == null ? void 0 : y.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
130
147
  s.emit("queries:update", w(a));
131
148
  }, a.options.staleTime);
132
- }), v(() => {
149
+ }), m(() => {
133
150
  s.emit("queries:update", w(a));
134
151
  });
135
152
  } else if (n === "create")
@@ -137,10 +154,10 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
137
154
  s.emit("queries:update", w(a));
138
155
  });
139
156
  else if (n === "setQueryData") {
140
- const [a] = S;
157
+ const [a] = E;
141
158
  i(() => {
142
- const m = t.getEntries({ key: a, exact: !0 })[0];
143
- m && s.emit("queries:update", w(m));
159
+ const y = t.getEntries({ key: a, exact: !0 })[0];
160
+ y && s.emit("queries:update", w(y));
144
161
  });
145
162
  }
146
163
  });
@@ -167,8 +184,8 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
167
184
  error: null
168
185
  }));
169
186
  }), s.on("queries:set:state", (n, i) => {
170
- const v = t.getEntries({ key: n, exact: !0 })[0];
171
- v && (t.setEntryState(v, i), s.emit("queries:update", w(v)));
187
+ const m = t.getEntries({ key: n, exact: !0 })[0];
188
+ m && (t.setEntryState(m, i), s.emit("queries:update", w(m)));
172
189
  }), s.on("queries:simulate:loading", (n) => {
173
190
  const i = t.getEntries({ key: n, exact: !0 })[0];
174
191
  i && (i.asyncStatus.value = "loading", i[p].simulate = "loading", s.emit("queries:update", w(i)));
@@ -190,74 +207,74 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
190
207
  error: null
191
208
  }), i[p].simulate = null, s.emit("queries:update", w(i)));
192
209
  });
193
- const c = N(null);
194
- P(c, () => {
210
+ const d = N(null);
211
+ P(d, () => {
195
212
  l.value = new MessageChannel();
196
213
  }), ye(
197
214
  window,
198
215
  "unload",
199
216
  () => {
200
217
  var n;
201
- (n = c.value) == null || n.close();
218
+ (n = d.value) == null || n.close();
202
219
  },
203
220
  { passive: !0 }
204
221
  ), ie(() => {
205
222
  var n;
206
- (n = c.value) == null || n.close();
223
+ (n = d.value) == null || n.close();
207
224
  });
208
- function y() {
225
+ function h() {
209
226
  var n;
210
- (n = c.value) == null || n.close(), c.value = null;
227
+ (n = d.value) == null || n.close(), d.value = null;
211
228
  }
212
- function r() {
229
+ function f() {
213
230
  const n = o.value;
214
231
  if (!n || !n.shadowRoot)
215
232
  throw new Error("No devtools elemnt found for Pinia Colada devtools");
216
233
  const i = n.shadowRoot.getElementById("root");
217
234
  if (!i)
218
235
  throw new Error("No devtools root element found for Pinia Colada devtools");
219
- const v = Math.max(i.offsetWidth, 400), S = Math.max(i.offsetHeight, 400), a = window.open(
236
+ const m = Math.max(i.offsetWidth, 400), E = Math.max(i.offsetHeight, 400), a = window.open(
220
237
  "",
221
238
  "pinia-colada-devtools",
222
- `popup,width=${v},height=${S}`
239
+ `popup,width=${m},height=${E}`
223
240
  );
224
241
  if (!a)
225
242
  throw new Error("Failed to open PiP window for Pinia Colada devtools");
226
- c.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", u(n, a.document), a.addEventListener(
243
+ d.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", r(n, a.document), a.addEventListener(
227
244
  "unload",
228
245
  () => {
229
- c.value = null;
246
+ d.value = null;
230
247
  },
231
248
  { passive: !0 }
232
249
  );
233
250
  }
234
- function u(n, i = document) {
251
+ function r(n, i = document) {
235
252
  if (!n || !n.shadowRoot)
236
253
  throw new Error("No devtools element found for Pinia Colada devtools");
237
- const v = i.getElementById("__pc-tw-properties") ?? i.createElement("style");
238
- v.setAttribute("id", "__pc-tw-properties");
239
- const S = [...n.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
240
- v.textContent = S, i.head.appendChild(v);
254
+ const m = i.getElementById("__pc-tw-properties") ?? i.createElement("style");
255
+ m.setAttribute("id", "__pc-tw-properties");
256
+ const E = [...n.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
257
+ m.textContent = E, i.head.appendChild(m);
241
258
  }
242
- function f() {
243
- c.value ? y() : r();
259
+ function u() {
260
+ d.value ? h() : f();
244
261
  }
245
- async function h() {
246
- u(o.value), s.emit("queries:all", t.getEntries({}).map(w)), s.emit(
262
+ async function v() {
263
+ r(o.value), s.emit("queries:all", t.getEntries({}).map(w)), s.emit(
247
264
  "mutations:all",
248
265
  // FIXME: mutations
249
266
  t.getEntries({}).map(w)
250
267
  );
251
268
  }
252
- return (n, i) => (x(), W(re, {
253
- to: c.value ? c.value.document.body : "body"
269
+ return (n, i) => (x(), W(se, {
270
+ to: d.value ? d.value.document.body : "body"
254
271
  }, [
255
- se("pinia-colada-devtools-panel", {
272
+ re("pinia-colada-devtools-panel", {
256
273
  ref: "devtools",
257
- ".isPip": !!c.value,
274
+ ".isPip": !!d.value,
258
275
  ".port": l.value.port2,
259
- onTogglePip: i[0] || (i[0] = (v) => f()),
260
- onReady: i[1] || (i[1] = (v) => h())
276
+ onTogglePip: i[0] || (i[0] = (m) => u()),
277
+ onReady: i[1] || (i[1] = (m) => v())
261
278
  }, null, 40, he)
262
279
  ], 8, ["to"]));
263
280
  }
@@ -265,20 +282,20 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
265
282
  function we(e) {
266
283
  return J() ? (Q(e), !0) : !1;
267
284
  }
268
- const Se = typeof window < "u" && typeof document < "u";
285
+ const Ee = typeof window < "u" && typeof document < "u";
269
286
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
270
- const Ee = Object.prototype.toString, be = (e) => Ee.call(e) === "[object Object]", Ce = () => {
287
+ const Se = Object.prototype.toString, be = (e) => Se.call(e) === "[object Object]", Ae = () => {
271
288
  };
272
289
  function Te(...e) {
273
290
  if (e.length !== 1)
274
291
  return le(...e);
275
292
  const t = e[0];
276
- return typeof t == "function" ? K(ue(() => ({ get: t, set: Ce }))) : R(t);
293
+ return typeof t == "function" ? K(ue(() => ({ get: t, set: Ae }))) : R(t);
277
294
  }
278
- function Ae(e, t) {
295
+ function Ce(e, t) {
279
296
  function o(...l) {
280
- return new Promise((s, c) => {
281
- Promise.resolve(e(() => t.apply(this, l), { fn: t, thisArg: this, args: l })).then(s).catch(c);
297
+ return new Promise((s, d) => {
298
+ Promise.resolve(e(() => t.apply(this, l), { fn: t, thisArg: this, args: l })).then(s).catch(d);
282
299
  });
283
300
  }
284
301
  return o;
@@ -291,13 +308,13 @@ function _e(e = Y, t = {}) {
291
308
  function s() {
292
309
  l.value = !1;
293
310
  }
294
- function c() {
311
+ function d() {
295
312
  l.value = !0;
296
313
  }
297
- const y = (...r) => {
298
- l.value && e(...r);
314
+ const h = (...f) => {
315
+ l.value && e(...f);
299
316
  };
300
- return { isActive: K(l), pause: s, resume: c, eventFilter: y };
317
+ return { isActive: K(l), pause: s, resume: d, eventFilter: h };
301
318
  }
302
319
  function q(e) {
303
320
  return Array.isArray(e) ? e : [e];
@@ -312,7 +329,7 @@ function Oe(e, t, o = {}) {
312
329
  } = o;
313
330
  return P(
314
331
  e,
315
- Ae(
332
+ Ce(
316
333
  l,
317
334
  t
318
335
  ),
@@ -323,16 +340,16 @@ function ke(e, t, o = {}) {
323
340
  const {
324
341
  eventFilter: l,
325
342
  initialState: s = "active",
326
- ...c
327
- } = o, { eventFilter: y, pause: r, resume: u, isActive: f } = _e(l, { initialState: s });
343
+ ...d
344
+ } = o, { eventFilter: h, pause: f, resume: r, isActive: u } = _e(l, { initialState: s });
328
345
  return { stop: Oe(
329
346
  e,
330
347
  t,
331
348
  {
332
- ...c,
333
- eventFilter: y
349
+ ...d,
350
+ eventFilter: h
334
351
  }
335
- ), pause: r, resume: u, isActive: f };
352
+ ), pause: f, resume: r, isActive: u };
336
353
  }
337
354
  function xe(e, t = !0, o) {
338
355
  Pe() ? L(e, o) : t ? e() : G(e);
@@ -347,46 +364,46 @@ function De(e, t, o) {
347
364
  }
348
365
  );
349
366
  }
350
- const D = Se ? window : void 0;
367
+ const D = Ee ? window : void 0;
351
368
  function Re(e) {
352
369
  var t;
353
- const o = C(e);
370
+ const o = A(e);
354
371
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
355
372
  }
356
373
  function z(...e) {
357
374
  const t = [], o = () => {
358
- t.forEach((r) => r()), t.length = 0;
359
- }, l = (r, u, f, h) => (r.addEventListener(u, f, h), () => r.removeEventListener(u, f, h)), s = U(() => {
360
- const r = q(C(e[0])).filter((u) => u != null);
361
- return r.every((u) => typeof u != "string") ? r : void 0;
362
- }), c = De(
375
+ t.forEach((f) => f()), t.length = 0;
376
+ }, l = (f, r, u, v) => (f.addEventListener(r, u, v), () => f.removeEventListener(r, u, v)), s = U(() => {
377
+ const f = q(A(e[0])).filter((r) => r != null);
378
+ return f.every((r) => typeof r != "string") ? f : void 0;
379
+ }), d = De(
363
380
  () => {
364
- var r, u;
381
+ var f, r;
365
382
  return [
366
- (u = (r = s.value) == null ? void 0 : r.map((f) => Re(f))) != null ? u : [D].filter((f) => f != null),
367
- q(C(s.value ? e[1] : e[0])),
383
+ (r = (f = s.value) == null ? void 0 : f.map((u) => Re(u))) != null ? r : [D].filter((u) => u != null),
384
+ q(A(s.value ? e[1] : e[0])),
368
385
  q(F(s.value ? e[2] : e[1])),
369
386
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
370
- C(s.value ? e[3] : e[2])
387
+ A(s.value ? e[3] : e[2])
371
388
  ];
372
389
  },
373
- ([r, u, f, h]) => {
374
- if (o(), !(r != null && r.length) || !(u != null && u.length) || !(f != null && f.length))
390
+ ([f, r, u, v]) => {
391
+ if (o(), !(f != null && f.length) || !(r != null && r.length) || !(u != null && u.length))
375
392
  return;
376
- const n = be(h) ? { ...h } : h;
393
+ const n = be(v) ? { ...v } : v;
377
394
  t.push(
378
- ...r.flatMap(
379
- (i) => u.flatMap(
380
- (v) => f.map((S) => l(i, v, S, n))
395
+ ...f.flatMap(
396
+ (i) => r.flatMap(
397
+ (m) => u.map((E) => l(i, m, E, n))
381
398
  )
382
399
  )
383
400
  );
384
401
  },
385
402
  { flush: "post" }
386
- ), y = () => {
387
- c(), o();
403
+ ), h = () => {
404
+ d(), o();
388
405
  };
389
- return we(o), y;
406
+ return we(o), h;
390
407
  }
391
408
  const O = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, k = "__vueuse_ssr_handlers__", qe = /* @__PURE__ */ Me();
392
409
  function Me() {
@@ -435,93 +452,93 @@ const Fe = {
435
452
  function $e(e, t, o, l = {}) {
436
453
  var s;
437
454
  const {
438
- flush: c = "pre",
439
- deep: y = !0,
440
- listenToStorageChanges: r = !0,
441
- writeDefaults: u = !0,
442
- mergeDefaults: f = !1,
443
- shallow: h,
455
+ flush: d = "pre",
456
+ deep: h = !0,
457
+ listenToStorageChanges: f = !0,
458
+ writeDefaults: r = !0,
459
+ mergeDefaults: u = !1,
460
+ shallow: v,
444
461
  window: n = D,
445
462
  eventFilter: i,
446
- onError: v = (d) => {
447
- console.error(d);
463
+ onError: m = (c) => {
464
+ console.error(c);
448
465
  },
449
- initOnMounted: S
450
- } = l, a = (h ? N : R)(t), m = U(() => C(e));
466
+ initOnMounted: E
467
+ } = l, a = (v ? N : R)(t), y = U(() => A(e));
451
468
  if (!o)
452
469
  try {
453
470
  o = Ne("getDefaultStorage", () => {
454
- var d;
455
- return (d = D) == null ? void 0 : d.localStorage;
471
+ var c;
472
+ return (c = D) == null ? void 0 : c.localStorage;
456
473
  })();
457
- } catch (d) {
458
- v(d);
474
+ } catch (c) {
475
+ m(c);
459
476
  }
460
477
  if (!o)
461
478
  return a;
462
- const T = C(t), j = We(T), A = (s = l.serializer) != null ? s : Fe[j], { pause: X, resume: V } = ke(
479
+ const T = A(t), j = We(T), C = (s = l.serializer) != null ? s : Fe[j], { pause: X, resume: V } = ke(
463
480
  a,
464
481
  () => Z(a.value),
465
- { flush: c, deep: y, eventFilter: i }
482
+ { flush: d, deep: h, eventFilter: i }
466
483
  );
467
- P(m, () => _(), { flush: c }), n && r && xe(() => {
468
- o instanceof Storage ? z(n, "storage", _, { passive: !0 }) : z(n, B, te), S && _();
469
- }), S || _();
470
- function H(d, g) {
484
+ P(y, () => _(), { flush: d }), n && f && xe(() => {
485
+ o instanceof Storage ? z(n, "storage", _, { passive: !0 }) : z(n, B, te), E && _();
486
+ }), E || _();
487
+ function H(c, g) {
471
488
  if (n) {
472
- const E = {
473
- key: m.value,
474
- oldValue: d,
489
+ const b = {
490
+ key: y.value,
491
+ oldValue: c,
475
492
  newValue: g,
476
493
  storageArea: o
477
494
  };
478
- n.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", E) : new CustomEvent(B, {
479
- detail: E
495
+ n.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", b) : new CustomEvent(B, {
496
+ detail: b
480
497
  }));
481
498
  }
482
499
  }
483
- function Z(d) {
500
+ function Z(c) {
484
501
  try {
485
- const g = o.getItem(m.value);
486
- if (d == null)
487
- H(g, null), o.removeItem(m.value);
502
+ const g = o.getItem(y.value);
503
+ if (c == null)
504
+ H(g, null), o.removeItem(y.value);
488
505
  else {
489
- const E = A.write(d);
490
- g !== E && (o.setItem(m.value, E), H(g, E));
506
+ const b = C.write(c);
507
+ g !== b && (o.setItem(y.value, b), H(g, b));
491
508
  }
492
509
  } catch (g) {
493
- v(g);
510
+ m(g);
494
511
  }
495
512
  }
496
- function ee(d) {
497
- const g = d ? d.newValue : o.getItem(m.value);
513
+ function ee(c) {
514
+ const g = c ? c.newValue : o.getItem(y.value);
498
515
  if (g == null)
499
- return u && T != null && o.setItem(m.value, A.write(T)), T;
500
- if (!d && f) {
501
- const E = A.read(g);
502
- return typeof f == "function" ? f(E, T) : j === "object" && !Array.isArray(E) ? { ...T, ...E } : E;
503
- } else return typeof g != "string" ? g : A.read(g);
516
+ return r && T != null && o.setItem(y.value, C.write(T)), T;
517
+ if (!c && u) {
518
+ const b = C.read(g);
519
+ return typeof u == "function" ? u(b, T) : j === "object" && !Array.isArray(b) ? { ...T, ...b } : b;
520
+ } else return typeof g != "string" ? g : C.read(g);
504
521
  }
505
- function _(d) {
506
- if (!(d && d.storageArea !== o)) {
507
- if (d && d.key == null) {
522
+ function _(c) {
523
+ if (!(c && c.storageArea !== o)) {
524
+ if (c && c.key == null) {
508
525
  a.value = T;
509
526
  return;
510
527
  }
511
- if (!(d && d.key !== m.value)) {
528
+ if (!(c && c.key !== y.value)) {
512
529
  X();
513
530
  try {
514
- (d == null ? void 0 : d.newValue) !== A.write(a.value) && (a.value = ee(d));
531
+ (c == null ? void 0 : c.newValue) !== C.write(a.value) && (a.value = ee(c));
515
532
  } catch (g) {
516
- v(g);
533
+ m(g);
517
534
  } finally {
518
- d ? G(V) : V();
535
+ c ? G(V) : V();
519
536
  }
520
537
  }
521
538
  }
522
539
  }
523
- function te(d) {
524
- _(d.detail);
540
+ function te(c) {
541
+ _(c.detail);
525
542
  }
526
543
  return a;
527
544
  }
@@ -535,8 +552,8 @@ const Ie = /* @__PURE__ */ $({
535
552
  const t = R(!1), o = Le("pinia-colada-devtools-open", !1);
536
553
  async function l() {
537
554
  if (!t.value && (t.value = !0, !customElements.get("pinia-colada-devtools-panel"))) {
538
- const { DevtoolsPanel: c } = await import("@pinia/colada-devtools/panel");
539
- customElements.define("pinia-colada-devtools-panel", c);
555
+ const { DevtoolsPanel: d } = await import("@pinia/colada-devtools/panel");
556
+ customElements.define("pinia-colada-devtools-panel", d);
540
557
  }
541
558
  }
542
559
  async function s() {
@@ -546,12 +563,12 @@ const Ie = /* @__PURE__ */ $({
546
563
  requestIdleCallback(() => {
547
564
  import("@pinia/colada-devtools/panel");
548
565
  }), o.value && s();
549
- }), (c, y) => (x(), W(ve, null, {
566
+ }), (d, h) => (x(), W(ve, null, {
550
567
  default: ce(() => [
551
568
  F(o) ? M("", !0) : (x(), de("button", {
552
569
  key: 0,
553
570
  class: "fixed bottom-2 right-2 bg-primary-500 hover:cursor-pointer z-99999",
554
- onClick: y[0] || (y[0] = (r) => s())
571
+ onClick: h[0] || (h[0] = (f) => s())
555
572
  }, " 🍹 Devtools ")),
556
573
  t.value && F(o) ? (x(), W(ge, { key: 1 })) : M("", !0)
557
574
  ]),