@shane_il/pulse 0.2.0 → 0.3.0

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/devtools.js CHANGED
@@ -1,62 +1,62 @@
1
- var oe = Object.defineProperty;
2
- var se = (e, t, n) => t in e ? oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var b = (e, t, n) => se(e, typeof t != "symbol" ? t + "" : t, n);
4
- let L = !1;
5
- const A = /* @__PURE__ */ new Set();
6
- function re(e) {
7
- A.add(e), L || (L = !0, queueMicrotask(ie));
1
+ var rt = Object.defineProperty;
2
+ var it = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var S = (t, e, n) => it(t, typeof e != "symbol" ? e + "" : e, n);
4
+ let A = !1;
5
+ const R = /* @__PURE__ */ new Set();
6
+ function ct(t) {
7
+ R.add(t), A || (A = !0, queueMicrotask(lt));
8
8
  }
9
- function ie() {
10
- const e = [...A];
11
- A.clear(), L = !1;
12
- for (const t of e)
13
- t();
9
+ function lt() {
10
+ const t = [...R];
11
+ R.clear(), A = !1;
12
+ for (const e of t)
13
+ e();
14
14
  }
15
15
  const q = Symbol("PULSE_CONNECTED"), F = globalThis;
16
16
  F.__PULSE_HOOKS__ || (F.__PULSE_HOOKS__ = { onMount: null, onUnmount: null });
17
- const E = F.__PULSE_HOOKS__;
18
- function ce(e, t) {
19
- E.onMount = e, E.onUnmount = t;
17
+ const T = F.__PULSE_HOOKS__;
18
+ function at(t, e) {
19
+ T.onMount = t, T.onUnmount = e;
20
20
  }
21
- function le(e, t) {
21
+ function pt(t, e) {
22
22
  return function(o) {
23
- const s = e || {};
23
+ const s = t || {};
24
24
  function r(i) {
25
25
  const a = {};
26
- for (const u in s) {
27
- const { store: c, selector: h } = s[u];
28
- a[u] = h(c.getState());
26
+ for (const p in s) {
27
+ const { store: l, selector: h } = s[p];
28
+ a[p] = h(l.getState());
29
29
  }
30
30
  return o({ ...a, ...i });
31
31
  }
32
32
  return r[q] = !0, r._bindings = s, r._innerComponent = o, r.displayName = `Connected(${o.displayName || o.name || "Anonymous"})`, r;
33
33
  };
34
34
  }
35
- class ae {
36
- constructor(t, n) {
37
- b(this, "connectedFn");
38
- b(this, "props");
39
- b(this, "prevSelected");
40
- b(this, "unsubscribers");
41
- b(this, "lastVTree");
42
- b(this, "parentDom");
43
- b(this, "_renderCallback");
44
- b(this, "_mountCleanup");
45
- this.connectedFn = t, this.props = n, this.prevSelected = {}, this.unsubscribers = [], this.lastVTree = null, this.parentDom = null, this._renderCallback = null, this._mountCleanup = null;
35
+ class ut {
36
+ constructor(e, n) {
37
+ S(this, "connectedFn");
38
+ S(this, "props");
39
+ S(this, "prevSelected");
40
+ S(this, "unsubscribers");
41
+ S(this, "lastVTree");
42
+ S(this, "parentDom");
43
+ S(this, "_renderCallback");
44
+ S(this, "_mountCleanup");
45
+ this.connectedFn = e, this.props = n, this.prevSelected = {}, this.unsubscribers = [], this.lastVTree = null, this.parentDom = null, this._renderCallback = null, this._mountCleanup = null;
46
46
  }
47
- mount(t, n) {
47
+ mount(e, n) {
48
48
  var r;
49
- this.parentDom = t, this._renderCallback = n;
49
+ this.parentDom = e, this._renderCallback = n;
50
50
  const o = this.connectedFn._bindings;
51
51
  for (const i in o) {
52
- const { store: a, selector: u } = o[i];
53
- this.prevSelected[i] = u(a.getState());
52
+ const { store: a, selector: p } = o[i];
53
+ this.prevSelected[i] = p(a.getState());
54
54
  }
55
55
  for (const i in o) {
56
- const { store: a } = o[i], u = a.subscribe(() => {
56
+ const { store: a } = o[i], p = a.subscribe(() => {
57
57
  this._onStoreChange();
58
58
  });
59
- this.unsubscribers.push(u);
59
+ this.unsubscribers.push(p);
60
60
  }
61
61
  const s = this.connectedFn._lifecycle;
62
62
  if (s != null && s.onMount) {
@@ -66,209 +66,215 @@ class ae {
66
66
  });
67
67
  typeof i == "function" && (this._mountCleanup = i);
68
68
  }
69
- E.onMount && E.onMount(this);
69
+ T.onMount && T.onMount(this);
70
70
  }
71
71
  _onStoreChange() {
72
- const t = this.connectedFn._bindings;
72
+ const e = this.connectedFn._bindings;
73
73
  let n = !1;
74
- for (const o in t) {
75
- const { store: s, selector: r } = t[o], i = r(s.getState());
76
- if (!pe(i, this.prevSelected[o])) {
74
+ for (const o in e) {
75
+ const { store: s, selector: r } = e[o], i = r(s.getState());
76
+ if (!ft(i, this.prevSelected[o])) {
77
77
  n = !0;
78
78
  break;
79
79
  }
80
80
  }
81
- n && re(this._renderCallback);
81
+ n && ct(this._renderCallback);
82
82
  }
83
83
  updateSelected() {
84
- const t = this.connectedFn._bindings;
85
- for (const n in t) {
86
- const { store: o, selector: s } = t[n];
84
+ const e = this.connectedFn._bindings;
85
+ for (const n in e) {
86
+ const { store: o, selector: s } = e[n];
87
87
  this.prevSelected[n] = s(o.getState());
88
88
  }
89
89
  }
90
90
  unmount() {
91
- E.onUnmount && E.onUnmount(this), this._mountCleanup && (this._mountCleanup(), this._mountCleanup = null);
92
- const t = this.connectedFn._lifecycle;
93
- t != null && t.onDestroy && t.onDestroy({ props: this.props });
91
+ T.onUnmount && T.onUnmount(this), this._mountCleanup && (this._mountCleanup(), this._mountCleanup = null);
92
+ const e = this.connectedFn._lifecycle;
93
+ e != null && e.onDestroy && e.onDestroy({ props: this.props });
94
94
  for (const n of this.unsubscribers)
95
95
  n();
96
96
  this.unsubscribers = [], this._renderCallback = null;
97
97
  }
98
98
  }
99
- function pe(e, t) {
100
- if (Object.is(e, t)) return !0;
101
- if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
102
- const n = Object.keys(e), o = Object.keys(t);
99
+ function ft(t, e) {
100
+ if (Object.is(t, e)) return !0;
101
+ if (typeof t != "object" || typeof e != "object" || t === null || e === null) return !1;
102
+ const n = Object.keys(t), o = Object.keys(e);
103
103
  if (n.length !== o.length) return !1;
104
104
  for (const s of n)
105
- if (!Object.prototype.hasOwnProperty.call(t, s) || !Object.is(e[s], t[s]))
105
+ if (!Object.prototype.hasOwnProperty.call(e, s) || !Object.is(t[s], e[s]))
106
106
  return !1;
107
107
  return !0;
108
108
  }
109
- function G(e) {
110
- let t = e.state;
111
- const n = e.actions, o = /* @__PURE__ */ new Set(), s = e.middleware;
109
+ function J(t) {
110
+ let e = t.state;
111
+ const n = t.actions, o = /* @__PURE__ */ new Set(), s = t.middleware;
112
112
  function r() {
113
- return t;
113
+ return e;
114
114
  }
115
115
  function i() {
116
116
  for (const f of o)
117
- f(t);
117
+ f(e);
118
118
  }
119
- function a(f, y) {
120
- const S = n[f];
121
- if (!S)
119
+ function a(f, m) {
120
+ const b = n[f];
121
+ if (!b)
122
122
  throw new Error(`[pulse] Unknown action: "${f}"`);
123
- const x = S(t, y);
124
- x !== t && (t = x, i());
123
+ const _ = b(e, m);
124
+ _ !== e && (e = _, i());
125
125
  }
126
- function u(f, y) {
126
+ function p(f, m) {
127
127
  if (f === "__devtools_replace__") {
128
- t = y, i();
128
+ e = m, i();
129
129
  return;
130
130
  }
131
- const S = n[f];
132
- if (!S)
131
+ const b = n[f];
132
+ if (!b)
133
133
  throw new Error(`[pulse] Unknown action: "${f}"`);
134
- const x = {
135
- store: l,
134
+ const _ = {
135
+ store: c,
136
136
  actionName: f,
137
- payload: y,
138
- prevState: t,
137
+ payload: m,
138
+ prevState: e,
139
139
  nextState: void 0
140
140
  };
141
141
  let w = 0;
142
142
  function z() {
143
143
  if (w < s.length) {
144
144
  const C = s[w++];
145
- C(x, z);
145
+ C(_, z);
146
146
  } else {
147
- const C = S(x.prevState, x.payload);
148
- x.nextState = C, C !== t && (t = C, i());
147
+ const C = b(_.prevState, _.payload);
148
+ _.nextState = C, C !== e && (e = C, i());
149
149
  }
150
150
  }
151
151
  z();
152
152
  }
153
- const c = s && s.length > 0 ? u : a;
153
+ const l = s && s.length > 0 ? p : a;
154
154
  function h(f) {
155
155
  return o.add(f), () => {
156
156
  o.delete(f);
157
157
  };
158
158
  }
159
159
  function g(f) {
160
- return { store: l, selector: f };
160
+ return { store: c, selector: f };
161
161
  }
162
- const l = {
162
+ const c = {
163
163
  getState: r,
164
- dispatch: c,
164
+ dispatch: l,
165
165
  subscribe: h,
166
166
  select: g
167
167
  };
168
- return e.name && (l.name = e.name), l;
168
+ return t.name && (c.name = t.name), c;
169
169
  }
170
- function ue(e, t) {
170
+ function dt(t, e) {
171
171
  return (o, s) => {
172
- s(), e.push({
172
+ s(), t.push({
173
173
  actionName: o.actionName,
174
174
  payload: o.payload,
175
175
  prevState: o.prevState,
176
176
  nextState: o.nextState ?? o.prevState,
177
177
  timestamp: Date.now()
178
- }), e.length > 1 / 0 && e.splice(0, e.length - 1 / 0);
178
+ }), t.length > 1 / 0 && t.splice(0, t.length - 1 / 0);
179
179
  };
180
180
  }
181
- let fe = 1;
182
- class de {
181
+ let ht = 1;
182
+ class mt {
183
183
  constructor() {
184
- b(this, "stores", /* @__PURE__ */ new Map());
185
- b(this, "components", /* @__PURE__ */ new Map());
186
- b(this, "listeners", /* @__PURE__ */ new Set());
184
+ S(this, "stores", /* @__PURE__ */ new Map());
185
+ S(this, "components", /* @__PURE__ */ new Map());
186
+ S(this, "listeners", /* @__PURE__ */ new Set());
187
187
  }
188
- registerStore(t, n, o) {
189
- const s = o || t.name || `store_${this.stores.size}`;
190
- this.stores.set(s, { store: t, history: n, name: s }), t.subscribe(() => {
188
+ registerStore(e, n, o) {
189
+ const s = o || e.name || `store_${this.stores.size}`;
190
+ this.stores.set(s, { store: e, history: n, name: s }), e.subscribe(() => {
191
191
  this.emit({ type: "action-dispatched", storeName: s });
192
192
  }), this.emit({ type: "store-registered", storeName: s });
193
193
  }
194
194
  getStoreNames() {
195
195
  return Array.from(this.stores.keys());
196
196
  }
197
- getStoreState(t) {
197
+ getStoreState(e) {
198
198
  var n;
199
- return (n = this.stores.get(t)) == null ? void 0 : n.store.getState();
199
+ return (n = this.stores.get(e)) == null ? void 0 : n.store.getState();
200
200
  }
201
- getTrackedStore(t) {
202
- return this.stores.get(t);
201
+ getTrackedStore(e) {
202
+ return this.stores.get(e);
203
203
  }
204
- getHistory(t) {
204
+ getHistory(e) {
205
205
  var o;
206
- if (t)
207
- return ((o = this.stores.get(t)) == null ? void 0 : o.history) ?? [];
206
+ if (e)
207
+ return ((o = this.stores.get(e)) == null ? void 0 : o.history) ?? [];
208
208
  const n = [];
209
209
  for (const s of this.stores.values())
210
210
  n.push(...s.history);
211
211
  return n.sort((s, r) => s.timestamp - r.timestamp);
212
212
  }
213
- trackComponent(t, n) {
214
- const o = fe++;
215
- return this.components.set(o, { id: o, displayName: t, storeNames: n }), this.emit({ type: "component-mounted", data: { id: o, displayName: t, storeNames: n } }), o;
213
+ trackComponent(e, n) {
214
+ const o = ht++;
215
+ return this.components.set(o, { id: o, displayName: e, storeNames: n }), this.emit({
216
+ type: "component-mounted",
217
+ data: { id: o, displayName: e, storeNames: n }
218
+ }), o;
216
219
  }
217
- untrackComponent(t) {
218
- const n = this.components.get(t);
219
- n && (this.components.delete(t), this.emit({ type: "component-unmounted", data: { id: t, displayName: n.displayName } }));
220
+ untrackComponent(e) {
221
+ const n = this.components.get(e);
222
+ n && (this.components.delete(e), this.emit({
223
+ type: "component-unmounted",
224
+ data: { id: e, displayName: n.displayName }
225
+ }));
220
226
  }
221
227
  getComponents() {
222
228
  return Array.from(this.components.values());
223
229
  }
224
- on(t) {
225
- return this.listeners.add(t), () => {
226
- this.listeners.delete(t);
230
+ on(e) {
231
+ return this.listeners.add(e), () => {
232
+ this.listeners.delete(e);
227
233
  };
228
234
  }
229
- emit(t) {
235
+ emit(e) {
230
236
  for (const n of this.listeners)
231
- n(t);
237
+ n(e);
232
238
  }
233
239
  }
234
- function Ge(e, t) {
235
- const n = [], o = ue(n), s = G({
236
- ...t,
237
- middleware: [o, ...t.middleware || []]
240
+ function Qt(t, e) {
241
+ const n = [], o = dt(n), s = J({
242
+ ...e,
243
+ middleware: [o, ...e.middleware || []]
238
244
  });
239
- return e.registerStore(s, n, t.name), { store: s, history: n };
245
+ return t.registerStore(s, n, e.name), { store: s, history: n };
240
246
  }
241
- const B = Symbol("TEXT_NODE"), he = Symbol("FRAGMENT");
242
- function H(e) {
247
+ const D = Symbol("TEXT_NODE"), yt = Symbol("FRAGMENT");
248
+ function B(t) {
243
249
  return {
244
- type: B,
245
- props: { nodeValue: String(e) },
250
+ type: D,
251
+ props: { nodeValue: String(t) },
246
252
  children: [],
247
253
  key: null
248
254
  };
249
255
  }
250
- function ye(e) {
251
- return e == null || typeof e == "boolean" ? null : typeof e == "string" || typeof e == "number" ? H(e) : e;
256
+ function gt(t) {
257
+ return t == null || typeof t == "boolean" ? null : typeof t == "string" || typeof t == "number" ? B(t) : t;
252
258
  }
253
- function J(e) {
254
- const t = [];
255
- for (const n of e)
259
+ function Q(t) {
260
+ const e = [];
261
+ for (const n of t)
256
262
  if (Array.isArray(n))
257
- t.push(...J(n));
263
+ e.push(...Q(n));
258
264
  else {
259
- const o = ye(n);
260
- o !== null && t.push(o);
265
+ const o = gt(n);
266
+ o !== null && e.push(o);
261
267
  }
262
- return t;
268
+ return e;
263
269
  }
264
- function p(e, t, ...n) {
265
- t = t || {};
266
- const o = t.key ?? null;
267
- t.key !== void 0 && (t = { ...t }, delete t.key);
268
- const s = J(n);
269
- return { type: e, props: t, children: s, key: o };
270
+ function u(t, e, ...n) {
271
+ e = e || {};
272
+ const o = e.key ?? null;
273
+ e.key !== void 0 && (e = { ...e }, delete e.key);
274
+ const s = Q(n);
275
+ return { type: t, props: e, children: s, key: o };
270
276
  }
271
- const m = {
277
+ const y = {
272
278
  CREATE: "CREATE",
273
279
  REMOVE: "REMOVE",
274
280
  REPLACE: "REPLACE",
@@ -277,338 +283,372 @@ const m = {
277
283
  MOVE: "MOVE",
278
284
  CHILDREN: "CHILDREN"
279
285
  };
280
- function _(e, t) {
281
- if (t == null && e == null) return [];
282
- if (t == null) return [{ type: m.REMOVE, target: e }];
283
- if (e == null) return [{ type: m.CREATE, newVNode: t }];
284
- if (e.type !== t.type)
285
- return [{ type: m.REPLACE, oldVNode: e, newVNode: t }];
286
- if (t._dom = e._dom, e.type === B)
287
- return e.props.nodeValue !== t.props.nodeValue ? [{ type: m.TEXT, oldVNode: e, newVNode: t }] : [];
288
- const n = [], o = me(e.props, t.props);
289
- o && n.push({ type: m.UPDATE, target: e, propPatches: o });
290
- const s = ge(e.children, t.children);
291
- return s.length && n.push({ type: m.CHILDREN, parent: e, childPatches: s }), n;
286
+ function x(t, e) {
287
+ if (e == null && t == null) return [];
288
+ if (e == null) return [{ type: y.REMOVE, target: t }];
289
+ if (t == null) return [{ type: y.CREATE, newVNode: e }];
290
+ if (t.type !== e.type)
291
+ return [{ type: y.REPLACE, oldVNode: t, newVNode: e }];
292
+ if (e._dom = t._dom, t.type === D)
293
+ return t.props.nodeValue !== e.props.nodeValue ? [{ type: y.TEXT, oldVNode: t, newVNode: e }] : [];
294
+ const n = [], o = St(t.props, e.props);
295
+ o && n.push({ type: y.UPDATE, target: t, propPatches: o });
296
+ const s = bt(t.children, e.children);
297
+ return s.length && n.push({ type: y.CHILDREN, parent: t, childPatches: s }), n;
292
298
  }
293
- function me(e, t) {
299
+ function St(t, e) {
294
300
  const n = {}, o = [];
295
301
  let s = !1;
296
- for (const r in t)
297
- r !== "children" && e[r] !== t[r] && (n[r] = t[r], s = !0);
298
302
  for (const r in e)
299
- r !== "children" && (r in t || (o.push(r), s = !0));
303
+ r !== "children" && t[r] !== e[r] && (n[r] = e[r], s = !0);
304
+ for (const r in t)
305
+ r !== "children" && (r in e || (o.push(r), s = !0));
300
306
  return s ? { set: n, remove: o } : null;
301
307
  }
302
- function O(e, t) {
303
- return e == null || t == null ? !1 : e.type === t.type && e.key === t.key;
308
+ function P(t, e) {
309
+ return t == null || e == null ? !1 : t.type === e.type && t.key === e.key;
304
310
  }
305
- function K(e, t) {
311
+ function G(t, e) {
306
312
  const n = /* @__PURE__ */ new Set();
307
313
  let o = 0, s = 0;
308
- for (const r of e)
314
+ for (const r of t)
309
315
  r != null && (r.key != null ? (o++, n.has(r.key) && console.warn(
310
- `[pulse] Duplicate key "${String(r.key)}" in ${t} children. Keys must be unique among siblings.`
316
+ `[pulse] Duplicate key "${String(r.key)}" in ${e} children. Keys must be unique among siblings.`
311
317
  ), n.add(r.key)) : s++);
312
318
  o > 0 && s > 0 && console.warn(
313
- `[pulse] Mixed keyed and unkeyed children in ${t} list (${o} keyed, ${s} unkeyed). Either all children should have keys or none should.`
319
+ `[pulse] Mixed keyed and unkeyed children in ${e} list (${o} keyed, ${s} unkeyed). Either all children should have keys or none should.`
314
320
  );
315
321
  }
316
- function ge(e, t) {
322
+ function bt(t, e) {
317
323
  var g;
318
- process.env.NODE_ENV !== "production" && (K(e, "old"), K(t, "new"));
324
+ process.env.NODE_ENV !== "production" && (G(t, "old"), G(e, "new"));
319
325
  const n = [];
320
- let o = 0, s = e.length - 1, r = 0, i = t.length - 1, a = e[o], u = e[s], c = t[r], h = t[i];
326
+ let o = 0, s = t.length - 1, r = 0, i = e.length - 1, a = t[o], p = t[s], l = e[r], h = e[i];
321
327
  for (; o <= s && r <= i; ) {
322
328
  if (a == null) {
323
- a = e[++o];
329
+ a = t[++o];
324
330
  continue;
325
331
  }
326
- if (u == null) {
327
- u = e[--s];
332
+ if (p == null) {
333
+ p = t[--s];
328
334
  continue;
329
335
  }
330
- if (O(a, c))
331
- n.push(..._(a, c)), a = e[++o], c = t[++r];
332
- else if (O(u, h))
333
- n.push(..._(u, h)), u = e[--s], h = t[--i];
334
- else if (O(a, h))
336
+ if (P(a, l))
337
+ n.push(...x(a, l)), a = t[++o], l = e[++r];
338
+ else if (P(p, h))
339
+ n.push(...x(p, h)), p = t[--s], h = e[--i];
340
+ else if (P(a, h))
335
341
  n.push({
336
- type: m.MOVE,
342
+ type: y.MOVE,
337
343
  vnode: a,
338
- anchor: e[s + 1] || null,
339
- childPatches: _(a, h)
340
- }), a = e[++o], h = t[--i];
341
- else if (O(u, c))
344
+ anchor: t[s + 1] || null,
345
+ childPatches: x(a, h)
346
+ }), a = t[++o], h = e[--i];
347
+ else if (P(p, l))
342
348
  n.push({
343
- type: m.MOVE,
344
- vnode: u,
349
+ type: y.MOVE,
350
+ vnode: p,
345
351
  anchor: a,
346
- childPatches: _(u, c)
347
- }), u = e[--s], c = t[++r];
352
+ childPatches: x(p, l)
353
+ }), p = t[--s], l = e[++r];
348
354
  else
349
355
  break;
350
356
  }
351
357
  if (o <= s && r <= i) {
352
- const l = /* @__PURE__ */ new Map();
358
+ const c = /* @__PURE__ */ new Map();
353
359
  for (let f = o; f <= s; f++) {
354
- const y = (g = e[f]) == null ? void 0 : g.key;
355
- y != null && l.set(y, f);
360
+ const m = (g = t[f]) == null ? void 0 : g.key;
361
+ m != null && c.set(m, f);
356
362
  }
357
363
  for (; r <= i; ) {
358
- c = t[r];
359
- const f = c.key != null ? l.get(c.key) : void 0;
364
+ l = e[r];
365
+ const f = l.key != null ? c.get(l.key) : void 0;
360
366
  if (f !== void 0) {
361
- const y = e[f];
367
+ const m = t[f];
362
368
  n.push({
363
- type: m.MOVE,
364
- vnode: y,
365
- anchor: e[o] || null,
366
- childPatches: _(y, c)
367
- }), e[f] = null, l.delete(c.key);
369
+ type: y.MOVE,
370
+ vnode: m,
371
+ anchor: t[o] || null,
372
+ childPatches: x(m, l)
373
+ }), t[f] = null, c.delete(l.key);
368
374
  } else
369
375
  n.push({
370
- type: m.CREATE,
371
- newVNode: c,
372
- anchor: e[o] || null
376
+ type: y.CREATE,
377
+ newVNode: l,
378
+ anchor: t[o] || null
373
379
  });
374
380
  r++;
375
381
  }
376
382
  for (let f = o; f <= s; f++)
377
- e[f] != null && n.push({ type: m.REMOVE, target: e[f] });
383
+ t[f] != null && n.push({ type: y.REMOVE, target: t[f] });
378
384
  }
379
385
  if (o > s) {
380
- const l = t[i + 1] || null;
386
+ const c = e[i + 1] || null;
381
387
  for (let f = r; f <= i; f++)
382
- n.push({ type: m.CREATE, newVNode: t[f], anchor: l });
388
+ n.push({ type: y.CREATE, newVNode: e[f], anchor: c });
383
389
  } else if (r > i)
384
- for (let l = o; l <= s; l++)
385
- e[l] != null && n.push({ type: m.REMOVE, target: e[l] });
390
+ for (let c = o; c <= s; c++)
391
+ t[c] != null && n.push({ type: y.REMOVE, target: t[c] });
386
392
  return n;
387
393
  }
388
- function v(e) {
389
- if (e.type === B) {
390
- const n = document.createTextNode(e.props.nodeValue);
391
- return e._dom = n, n;
394
+ const Y = "http://www.w3.org/2000/svg";
395
+ function V(t, e) {
396
+ if (t.type === D) {
397
+ const o = document.createTextNode(t.props.nodeValue);
398
+ return t._dom = o, o;
392
399
  }
393
- if (e.type === he) {
394
- const n = document.createDocumentFragment();
395
- for (const o of e.children)
396
- n.appendChild(v(o));
397
- return e._dom = n, n;
400
+ if (t.type === yt) {
401
+ const o = document.createDocumentFragment();
402
+ for (const s of t.children)
403
+ o.appendChild(V(s, e));
404
+ return t._dom = o, o;
398
405
  }
399
- const t = document.createElement(e.type);
400
- be(t, {}, e.props);
401
- for (const n of e.children)
402
- t.appendChild(v(n));
403
- return e._dom = t, t;
406
+ t.type === "svg" ? e = Y : t.type === "foreignObject" && (e = void 0);
407
+ const n = e ? document.createElementNS(e, t.type) : document.createElement(t.type);
408
+ _t(n, {}, t.props);
409
+ for (const o of t.children)
410
+ n.appendChild(V(o, e));
411
+ return t._dom = n, n;
404
412
  }
405
- function be(e, t, n) {
406
- for (const o in t)
407
- o === "children" || o === "key" || o in n || Y(e, o, t[o]);
413
+ function _t(t, e, n) {
414
+ for (const o in e)
415
+ o === "children" || o === "key" || o in n || tt(t, o, e[o]);
408
416
  for (const o in n)
409
- o === "children" || o === "key" || t[o] !== n[o] && Q(e, o, n[o], t[o]);
417
+ o === "children" || o === "key" || e[o] !== n[o] && Z(t, o, n[o], e[o]);
410
418
  }
411
- function Q(e, t, n, o) {
412
- if (t.startsWith("on")) {
413
- const s = t.slice(2).toLowerCase();
414
- o && e.removeEventListener(s, o), n && e.addEventListener(s, n);
415
- } else if (t === "className")
416
- e.className = n || "";
417
- else if (t === "style" && typeof n == "object") {
419
+ function Z(t, e, n, o) {
420
+ if (e.startsWith("on")) {
421
+ const s = e.slice(2).toLowerCase();
422
+ o && t.removeEventListener(s, o), n && t.addEventListener(s, n);
423
+ } else if (e === "className" || e === "class")
424
+ t instanceof SVGElement ? t.setAttribute("class", n || "") : t.className = n || "";
425
+ else if (e === "style" && typeof n == "object") {
418
426
  if (typeof o == "object" && o)
419
427
  for (const s in o)
420
- s in n || (e.style[s] = "");
421
- Object.assign(e.style, n);
422
- } else t === "ref" ? typeof n == "function" && n(e) : n === !0 ? e.setAttribute(t, "") : n === !1 || n == null ? e.removeAttribute(t) : e.setAttribute(t, n);
428
+ s in n || (t.style[s] = "");
429
+ Object.assign(t.style, n);
430
+ } else if (e === "dangerouslySetInnerHTML")
431
+ n && typeof n.__html == "string" && (t.innerHTML = n.__html);
432
+ else if (e === "ref")
433
+ typeof n == "function" && n(t);
434
+ else if (e in t && !(t instanceof SVGElement))
435
+ try {
436
+ t[e] = n ?? "";
437
+ } catch {
438
+ t.setAttribute(e, n);
439
+ }
440
+ else n === !0 ? t.setAttribute(e, "") : n === !1 || n == null ? t.removeAttribute(e) : t.setAttribute(e, n);
423
441
  }
424
- function Y(e, t, n) {
425
- t.startsWith("on") ? e.removeEventListener(t.slice(2).toLowerCase(), n) : t === "className" ? e.className = "" : e.removeAttribute(t);
442
+ function tt(t, e, n) {
443
+ if (e.startsWith("on"))
444
+ t.removeEventListener(e.slice(2).toLowerCase(), n);
445
+ else if (e === "dangerouslySetInnerHTML")
446
+ t.innerHTML = "";
447
+ else if (e === "className" || e === "class")
448
+ t instanceof SVGElement ? t.removeAttribute("class") : t.className = "";
449
+ else if (e in t && !(t instanceof SVGElement))
450
+ try {
451
+ t[e] = "";
452
+ } catch {
453
+ t.removeAttribute(e);
454
+ }
455
+ else
456
+ t.removeAttribute(e);
426
457
  }
427
- function P(e, t) {
458
+ function K(t) {
459
+ return t instanceof SVGElement ? Y : void 0;
460
+ }
461
+ function v(t, e) {
428
462
  var n, o, s;
429
- for (const r of t)
463
+ for (const r of e)
430
464
  switch (r.type) {
431
- case m.CREATE: {
432
- const i = v(r.newVNode);
433
- (n = r.anchor) != null && n._dom ? e.insertBefore(i, r.anchor._dom) : e.appendChild(i);
465
+ case y.CREATE: {
466
+ const i = V(r.newVNode, K(t));
467
+ (n = r.anchor) != null && n._dom ? t.insertBefore(i, r.anchor._dom) : t.appendChild(i);
434
468
  break;
435
469
  }
436
- case m.REMOVE: {
470
+ case y.REMOVE: {
437
471
  const i = r.target._dom;
438
472
  i != null && i.parentNode && i.parentNode.removeChild(i);
439
473
  break;
440
474
  }
441
- case m.REPLACE: {
442
- const i = v(r.newVNode), a = r.oldVNode._dom;
443
- a != null && a.parentNode && a.parentNode.replaceChild(i, a);
475
+ case y.REPLACE: {
476
+ const i = r.oldVNode._dom, a = i == null ? void 0 : i.parentNode, p = V(
477
+ r.newVNode,
478
+ a ? K(a) : void 0
479
+ );
480
+ a && a.replaceChild(p, i);
444
481
  break;
445
482
  }
446
- case m.UPDATE: {
447
- const i = r.target._dom, { set: a, remove: u } = r.propPatches;
448
- for (const c of u)
449
- Y(i, c, r.target.props[c]);
450
- for (const c in a)
451
- Q(i, c, a[c], r.target.props[c]);
483
+ case y.UPDATE: {
484
+ const i = r.target._dom, { set: a, remove: p } = r.propPatches;
485
+ for (const l of p)
486
+ tt(i, l, r.target.props[l]);
487
+ for (const l in a)
488
+ Z(i, l, a[l], r.target.props[l]);
452
489
  break;
453
490
  }
454
- case m.TEXT: {
491
+ case y.TEXT: {
455
492
  const i = r.oldVNode._dom;
456
493
  i && (i.nodeValue = r.newVNode.props.nodeValue);
457
494
  break;
458
495
  }
459
- case m.MOVE: {
496
+ case y.MOVE: {
460
497
  const i = r.vnode._dom;
461
- i && ((o = r.anchor) != null && o._dom ? e.insertBefore(i, r.anchor._dom) : e.appendChild(i)), (s = r.childPatches) != null && s.length && i && P(i, r.childPatches);
498
+ i && ((o = r.anchor) != null && o._dom ? t.insertBefore(i, r.anchor._dom) : t.appendChild(i)), (s = r.childPatches) != null && s.length && i && v(i, r.childPatches);
462
499
  break;
463
500
  }
464
- case m.CHILDREN: {
501
+ case y.CHILDREN: {
465
502
  const i = r.parent._dom;
466
- i && r.childPatches.length && P(i, r.childPatches);
503
+ i && r.childPatches.length && v(i, r.childPatches);
467
504
  break;
468
505
  }
469
506
  }
470
507
  }
471
- const R = /* @__PURE__ */ new WeakMap();
472
- function Se(e, t) {
473
- const n = R.get(t);
508
+ const $ = /* @__PURE__ */ new WeakMap();
509
+ function xt(t, e) {
510
+ const n = $.get(e);
474
511
  if (n) {
475
- const o = k(e, t), s = [];
512
+ const o = E(t, e), s = [];
476
513
  I(n.vTree, s);
477
- const r = _(n.vTree, o);
478
- P(t, r);
514
+ const r = x(n.vTree, o);
515
+ v(e, r);
479
516
  const i = [];
480
517
  o && I(o, i);
481
518
  const a = new Set(i);
482
- for (const c of s)
483
- a.has(c) || c.unmount();
484
- const u = new Set(s);
485
- for (const c of i)
486
- u.has(c) || c.mount(t, () => U(c, t));
487
- R.set(t, { vTree: o });
519
+ for (const l of s)
520
+ a.has(l) || l.unmount();
521
+ const p = new Set(s);
522
+ for (const l of i)
523
+ p.has(l) || l.mount(e, () => U(l, e));
524
+ $.set(e, { vTree: o });
488
525
  } else {
489
- const o = k(e, t);
526
+ const o = E(t, e);
490
527
  if (!o) return;
491
- const s = v(o);
492
- t.appendChild(s);
528
+ const s = V(o);
529
+ e.appendChild(s);
493
530
  const r = [];
494
531
  I(o, r);
495
532
  for (const i of r)
496
- i.mount(t, () => U(i, t));
497
- R.set(t, { vTree: o });
533
+ i.mount(e, () => U(i, e));
534
+ $.set(e, { vTree: o });
498
535
  }
499
536
  }
500
- function k(e, t) {
537
+ function E(t, e) {
501
538
  var n;
502
- if (e == null) return null;
503
- if (typeof e.type == "function") {
504
- if (e.type[q]) {
505
- const s = e.type._lifecycle;
539
+ if (t == null) return null;
540
+ if (typeof t.type == "function") {
541
+ if (t.type[q]) {
542
+ const s = t.type._lifecycle;
506
543
  try {
507
- const r = new ae(e.type, e.props), i = e.type(e.props), u = k(i, t) ?? H("");
508
- if (u._instance) {
509
- const c = {
544
+ const r = new ut(t.type, t.props), i = t.type(t.props), p = E(i, e) ?? B("");
545
+ if (p._instance) {
546
+ const l = {
510
547
  type: "div",
511
548
  props: { style: { display: "contents" } },
512
- children: [u],
513
- key: e.key
549
+ children: [p],
550
+ key: t.key
514
551
  };
515
- return c._instance = r, r.lastVTree = c, c;
552
+ return l._instance = r, r.lastVTree = l, l;
516
553
  }
517
- return u._instance = r, r.lastVTree = u, u;
554
+ return p._instance = r, r.lastVTree = p, p;
518
555
  } catch (r) {
519
556
  if (s != null && s.onError) {
520
- const i = s.onError({ error: r, props: e.props });
521
- return k(i, t);
557
+ const i = s.onError({
558
+ error: r,
559
+ props: t.props
560
+ });
561
+ return E(i, e);
522
562
  }
523
563
  throw r;
524
564
  }
525
565
  }
526
- const o = e.type({ ...e.props, children: e.children });
527
- return k(o, t);
566
+ const o = t.type({ ...t.props, children: t.children });
567
+ return E(o, e);
528
568
  }
529
- return (n = e.children) != null && n.length && (e.children = e.children.map((o) => k(o, t)).filter((o) => o != null)), e;
569
+ return (n = t.children) != null && n.length && (t.children = t.children.map((o) => E(o, e)).filter((o) => o != null)), t;
530
570
  }
531
- function U(e, t) {
571
+ function U(t, e) {
532
572
  var s, r;
533
- if (!e._renderCallback) return;
534
- const n = e.connectedFn, o = n._lifecycle;
573
+ if (!t._renderCallback) return;
574
+ const n = t.connectedFn, o = n._lifecycle;
535
575
  try {
536
- const i = n(e.props);
537
- let u = k(i, t) ?? H(""), c;
538
- if (u._instance && u._instance !== e ? (c = {
576
+ const i = n(t.props), p = E(i, e) ?? B("");
577
+ let l;
578
+ if (p._instance && p._instance !== t ? (l = {
539
579
  type: "div",
540
580
  props: { style: { display: "contents" } },
541
- children: [u],
581
+ children: [p],
542
582
  key: null
543
- }, c._instance = e) : (u._instance = e, c = u), e.lastVTree) {
544
- D(e.lastVTree, e);
545
- const y = _(e.lastVTree, c), S = ((s = e.lastVTree._dom) == null ? void 0 : s.parentNode) || t;
546
- P(S, y), c._dom || (c._dom = e.lastVTree._dom);
583
+ }, l._instance = t) : (p._instance = t, l = p), t.lastVTree) {
584
+ H(t.lastVTree, t);
585
+ const m = x(t.lastVTree, l), b = ((s = t.lastVTree._dom) == null ? void 0 : s.parentNode) || e;
586
+ v(b, m), l._dom || (l._dom = t.lastVTree._dom);
547
587
  }
548
588
  const h = [];
549
- M(e.lastVTree, h, e);
589
+ M(t.lastVTree, h, t);
550
590
  const g = [];
551
- M(c, g, e);
552
- const l = new Set(g);
553
- for (const y of h)
554
- l.has(y) || y.unmount();
555
- e.lastVTree = c;
591
+ M(l, g, t);
592
+ const c = new Set(g);
593
+ for (const m of h)
594
+ c.has(m) || m.unmount();
595
+ t.lastVTree = l;
556
596
  const f = new Set(h);
557
- for (const y of g)
558
- f.has(y) || y.mount(t, () => U(y, t));
597
+ for (const m of g)
598
+ f.has(m) || m.mount(e, () => U(m, e));
559
599
  o != null && o.onUpdate && o.onUpdate({
560
- dom: c == null ? void 0 : c._dom,
561
- props: e.props
562
- }), e.updateSelected();
600
+ dom: l == null ? void 0 : l._dom,
601
+ props: t.props
602
+ }), t.updateSelected();
563
603
  } catch (i) {
564
604
  if (o != null && o.onError) {
565
- const a = o.onError({ error: i, props: e.props }), u = k(a, t);
566
- if (e.lastVTree && u) {
567
- D(e.lastVTree, e);
568
- const h = _(e.lastVTree, u), g = ((r = e.lastVTree._dom) == null ? void 0 : r.parentNode) || t;
569
- P(g, h), u._dom || (u._dom = e.lastVTree._dom);
605
+ const a = o.onError({ error: i, props: t.props }), p = E(a, e);
606
+ if (t.lastVTree && p) {
607
+ H(t.lastVTree, t);
608
+ const h = x(t.lastVTree, p), g = ((r = t.lastVTree._dom) == null ? void 0 : r.parentNode) || e;
609
+ v(g, h), p._dom || (p._dom = t.lastVTree._dom);
570
610
  }
571
- const c = [];
572
- M(e.lastVTree, c, e);
573
- for (const h of c) h.unmount();
574
- e.lastVTree = u, e.updateSelected();
611
+ const l = [];
612
+ M(t.lastVTree, l, t);
613
+ for (const h of l) h.unmount();
614
+ t.lastVTree = p, t.updateSelected();
575
615
  } else
576
616
  throw i;
577
617
  }
578
618
  }
579
- function D(e, t) {
580
- if (!(!e || !e.children))
581
- for (let n = 0; n < e.children.length; n++) {
582
- const o = e.children[n];
583
- o._instance && o._instance !== t && o._instance.lastVTree && o._instance.lastVTree !== o && (e.children[n] = o._instance.lastVTree), D(e.children[n], t);
619
+ function H(t, e) {
620
+ if (!(!t || !t.children))
621
+ for (let n = 0; n < t.children.length; n++) {
622
+ const o = t.children[n];
623
+ o._instance && o._instance !== e && o._instance.lastVTree && o._instance.lastVTree !== o && (t.children[n] = o._instance.lastVTree), H(t.children[n], e);
584
624
  }
585
625
  }
586
- function I(e, t) {
587
- if (e && (e._instance && t.push(e._instance), e.children))
588
- for (const n of e.children)
589
- I(n, t);
626
+ function I(t, e) {
627
+ if (t && (t._instance && e.push(t._instance), t.children))
628
+ for (const n of t.children)
629
+ I(n, e);
590
630
  }
591
- function M(e, t, n) {
592
- if (e && (e._instance && e._instance !== n && t.push(e._instance), e.children))
593
- for (const o of e.children)
594
- M(o, t, n);
631
+ function M(t, e, n) {
632
+ if (t && (t._instance && t._instance !== n && e.push(t._instance), t.children))
633
+ for (const o of t.children)
634
+ M(o, e, n);
595
635
  }
596
- function W(e, t, n) {
597
- const o = e.getTrackedStore(t);
636
+ function W(t, e, n) {
637
+ const o = t.getTrackedStore(e);
598
638
  if (!o)
599
- throw new Error(`[pulse-devtools] Unknown store: "${t}"`);
639
+ throw new Error(`[pulse-devtools] Unknown store: "${e}"`);
600
640
  const { store: s, history: r } = o;
601
641
  if (n < 0 || n >= r.length)
602
642
  throw new Error(
603
643
  `[pulse-devtools] Index ${n} out of range (0..${r.length - 1})`
604
644
  );
605
645
  const i = r[n].nextState;
606
- s.dispatch("__devtools_replace__", i), e.emit({ type: "time-travel", storeName: t, data: { entryIndex: n } });
646
+ s.dispatch("__devtools_replace__", i), t.emit({ type: "time-travel", storeName: e, data: { entryIndex: n } });
607
647
  }
608
- function Je(e, t, n) {
609
- const o = e.getTrackedStore(t);
648
+ function Yt(t, e, n) {
649
+ const o = t.getTrackedStore(e);
610
650
  if (!o)
611
- throw new Error(`[pulse-devtools] Unknown store: "${t}"`);
651
+ throw new Error(`[pulse-devtools] Unknown store: "${e}"`);
612
652
  const { store: s, history: r } = o;
613
653
  if (n < 0 || n >= r.length)
614
654
  throw new Error(
@@ -616,9 +656,13 @@ function Je(e, t, n) {
616
656
  );
617
657
  const i = r.slice(n), a = r[n].prevState;
618
658
  s.dispatch("__devtools_replace__", a);
619
- for (const u of i)
620
- s.dispatch(u.actionName, u.payload);
621
- e.emit({ type: "time-travel", storeName: t, data: { replayFrom: n } });
659
+ for (const p of i)
660
+ s.dispatch(p.actionName, p.payload);
661
+ t.emit({
662
+ type: "time-travel",
663
+ storeName: e,
664
+ data: { replayFrom: n }
665
+ });
622
666
  }
623
667
  const d = {
624
668
  base: "#1e1e2e",
@@ -633,7 +677,7 @@ const d = {
633
677
  mauve: "#cba6f7",
634
678
  teal: "#94e2d5",
635
679
  peach: "#fab387"
636
- }, xe = {
680
+ }, Et = {
637
681
  position: "fixed",
638
682
  bottom: "0",
639
683
  left: "0",
@@ -649,7 +693,7 @@ const d = {
649
693
  flexDirection: "column",
650
694
  borderTop: `2px solid ${d.mauve}`,
651
695
  overflow: "hidden"
652
- }, _e = {
696
+ }, Tt = {
653
697
  display: "flex",
654
698
  alignItems: "center",
655
699
  backgroundColor: d.surface0,
@@ -657,17 +701,17 @@ const d = {
657
701
  padding: "0 8px",
658
702
  height: "32px",
659
703
  flexShrink: "0"
660
- }, ke = (e) => ({
704
+ }, kt = (t) => ({
661
705
  background: "none",
662
706
  border: "none",
663
- color: e ? d.mauve : d.subtext0,
707
+ color: t ? d.mauve : d.subtext0,
664
708
  fontFamily: "inherit",
665
709
  fontSize: "12px",
666
710
  padding: "6px 12px",
667
711
  cursor: "pointer",
668
- borderBottom: e ? `2px solid ${d.mauve}` : "2px solid transparent",
712
+ borderBottom: t ? `2px solid ${d.mauve}` : "2px solid transparent",
669
713
  marginBottom: "-1px"
670
- }), Ee = {
714
+ }), wt = {
671
715
  background: "none",
672
716
  border: "none",
673
717
  color: d.overlay0,
@@ -676,59 +720,59 @@ const d = {
676
720
  marginLeft: "auto",
677
721
  padding: "4px 8px",
678
722
  fontFamily: "inherit"
679
- }, Te = {
723
+ }, Ct = {
680
724
  flex: "1",
681
725
  overflow: "auto",
682
726
  padding: "8px 12px"
683
- }, we = {
727
+ }, Nt = {
684
728
  display: "flex",
685
729
  height: "100%",
686
730
  gap: "1px"
687
- }, Ce = {
731
+ }, Vt = {
688
732
  width: "200px",
689
733
  flexShrink: "0",
690
734
  borderRight: `1px solid ${d.surface1}`,
691
735
  overflow: "auto",
692
736
  padding: "4px 0"
693
- }, Ne = {
737
+ }, vt = {
694
738
  flex: "1",
695
739
  overflow: "auto",
696
740
  padding: "8px"
697
- }, ve = (e) => ({
741
+ }, Pt = (t) => ({
698
742
  padding: "4px 12px",
699
743
  cursor: "pointer",
700
- backgroundColor: e ? d.surface1 : "transparent",
701
- color: e ? d.blue : d.text
744
+ backgroundColor: t ? d.surface1 : "transparent",
745
+ color: t ? d.blue : d.text
702
746
  }), X = {
703
747
  color: d.mauve
704
- }, V = {
748
+ }, O = {
705
749
  color: d.green
706
- }, Pe = {
750
+ }, Ot = {
707
751
  color: d.yellow
708
- }, Oe = {
752
+ }, It = {
709
753
  color: d.peach
710
- }, T = {
754
+ }, k = {
711
755
  color: d.overlay0,
712
756
  fontStyle: "italic"
713
- }, Ve = (e) => ({
757
+ }, Mt = (t) => ({
714
758
  padding: "4px 8px",
715
759
  cursor: "pointer",
716
- backgroundColor: e ? d.surface1 : "transparent",
717
- borderLeft: e ? `3px solid ${d.blue}` : "3px solid transparent",
760
+ backgroundColor: t ? d.surface1 : "transparent",
761
+ borderLeft: t ? `3px solid ${d.blue}` : "3px solid transparent",
718
762
  display: "flex",
719
763
  justifyContent: "space-between",
720
764
  alignItems: "center"
721
- }), Z = {
765
+ }), et = {
722
766
  color: d.blue,
723
767
  fontWeight: "bold"
724
- }, Ie = {
768
+ }, Lt = {
725
769
  color: d.overlay0,
726
770
  fontSize: "10px"
727
- }, Me = {
771
+ }, $t = {
728
772
  width: "100%",
729
773
  accentColor: d.mauve,
730
774
  margin: "4px 0 8px"
731
- }, $e = {
775
+ }, At = {
732
776
  width: "100%",
733
777
  backgroundColor: d.surface0,
734
778
  border: `1px solid ${d.surface1}`,
@@ -740,17 +784,17 @@ const d = {
740
784
  outline: "none",
741
785
  marginBottom: "8px",
742
786
  boxSizing: "border-box"
743
- }, Re = {
787
+ }, Rt = {
744
788
  padding: "4px 8px",
745
789
  borderBottom: `1px solid ${d.surface0}`
746
- }, Le = {
790
+ }, Ft = {
747
791
  color: d.teal,
748
792
  fontWeight: "bold"
749
- }, Ae = {
793
+ }, Ut = {
750
794
  color: d.overlay0,
751
795
  fontSize: "10px",
752
796
  marginLeft: "8px"
753
- }, ee = {
797
+ }, nt = {
754
798
  display: "inline-block",
755
799
  backgroundColor: d.surface1,
756
800
  color: d.subtext0,
@@ -758,194 +802,206 @@ const d = {
758
802
  borderRadius: "8px",
759
803
  fontSize: "10px",
760
804
  marginLeft: "4px"
761
- }, Fe = {
805
+ }, Ht = {
762
806
  color: d.mauve,
763
807
  fontWeight: "bold",
764
808
  fontSize: "12px",
765
809
  marginRight: "8px"
766
810
  };
767
- function j(e, t) {
768
- if (e === null)
769
- return p("span", { style: T }, "null");
770
- if (e === void 0)
771
- return p("span", { style: T }, "undefined");
772
- if (typeof e == "string")
773
- return p("span", { style: Pe }, `"${e}"`);
774
- if (typeof e == "boolean")
775
- return p("span", { style: Oe }, String(e));
776
- if (typeof e == "number")
777
- return p("span", { style: V }, String(e));
778
- if (Array.isArray(e))
779
- return e.length === 0 ? p("span", { style: V }, "[]") : t > 4 ? p("span", { style: T }, "[…]") : p(
811
+ function j(t, e) {
812
+ if (t === null)
813
+ return u("span", { style: k }, "null");
814
+ if (t === void 0)
815
+ return u("span", { style: k }, "undefined");
816
+ if (typeof t == "string")
817
+ return u("span", { style: Ot }, `"${t}"`);
818
+ if (typeof t == "boolean")
819
+ return u("span", { style: It }, String(t));
820
+ if (typeof t == "number")
821
+ return u("span", { style: O }, String(t));
822
+ if (Array.isArray(t))
823
+ return t.length === 0 ? u("span", { style: O }, "[]") : e > 4 ? u("span", { style: k }, "[…]") : u(
780
824
  "div",
781
825
  { style: { paddingLeft: "12px" } },
782
- ...e.map(
783
- (n, o) => p(
826
+ ...t.map(
827
+ (n, o) => u(
784
828
  "div",
785
829
  { key: o },
786
- p("span", { style: X }, `${o}: `),
787
- j(n, t + 1)
830
+ u("span", { style: X }, `${o}: `),
831
+ j(n, e + 1)
788
832
  )
789
833
  )
790
834
  );
791
- if (typeof e == "object") {
792
- const n = Object.keys(e);
793
- return n.length === 0 ? p("span", { style: V }, "{}") : t > 4 ? p("span", { style: T }, "{…}") : p(
835
+ if (typeof t == "object") {
836
+ const n = Object.keys(t);
837
+ return n.length === 0 ? u("span", { style: O }, "{}") : e > 4 ? u("span", { style: k }, "{…}") : u(
794
838
  "div",
795
839
  { style: { paddingLeft: "12px" } },
796
840
  ...n.map(
797
- (o) => p(
841
+ (o) => u(
798
842
  "div",
799
843
  { key: o },
800
- p("span", { style: X }, `${o}: `),
801
- j(e[o], t + 1)
844
+ u("span", { style: X }, `${o}: `),
845
+ j(t[o], e + 1)
802
846
  )
803
847
  )
804
848
  );
805
849
  }
806
- return p("span", { style: V }, String(e));
850
+ return u("span", { style: O }, String(t));
807
851
  }
808
- function Ue({
809
- storeNames: e,
810
- selectedStore: t,
852
+ function jt({
853
+ storeNames: t,
854
+ selectedStore: e,
811
855
  storeStates: n,
812
856
  onSelectStore: o
813
857
  }) {
814
- const s = t ? n[t] : null;
815
- return p(
858
+ const s = e ? n[e] : null;
859
+ return u(
816
860
  "div",
817
- { style: we },
818
- p(
861
+ { style: Nt },
862
+ u(
819
863
  "div",
820
- { style: Ce },
821
- ...e.map(
822
- (r) => p("div", {
823
- key: r,
824
- style: ve(r === t),
825
- onClick: () => o(r)
826
- }, r)
864
+ { style: Vt },
865
+ ...t.map(
866
+ (r) => u(
867
+ "div",
868
+ {
869
+ key: r,
870
+ style: Pt(r === e),
871
+ onClick: () => o(r)
872
+ },
873
+ r
874
+ )
827
875
  )
828
876
  ),
829
- p(
877
+ u(
830
878
  "div",
831
- { style: Ne },
832
- t ? p(
879
+ { style: vt },
880
+ e ? u(
833
881
  "div",
834
882
  null,
835
- p(
883
+ u(
836
884
  "div",
837
885
  { style: { marginBottom: "8px", color: d.subtext0 } },
838
886
  "State of ",
839
- p("span", { style: Z }, t)
887
+ u("span", { style: et }, e)
840
888
  ),
841
- s != null ? j(s, 0) : p("span", { style: T }, "No state")
842
- ) : p("span", { style: T }, "Select a store")
889
+ s != null ? j(s, 0) : u("span", { style: k }, "No state")
890
+ ) : u("span", { style: k }, "Select a store")
843
891
  )
844
892
  );
845
893
  }
846
- function De(e) {
847
- const t = new Date(e), n = (o) => String(o).padStart(2, "0");
848
- return `${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
894
+ function Dt(t) {
895
+ const e = new Date(t), n = (o) => String(o).padStart(2, "0");
896
+ return `${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}`;
849
897
  }
850
- function je({
851
- actionLog: e,
852
- timeTravelIndex: t,
898
+ function Bt({
899
+ actionLog: t,
900
+ timeTravelIndex: e,
853
901
  filter: n,
854
902
  onFilterChange: o,
855
903
  onTravelTo: s,
856
904
  onSliderChange: r
857
905
  }) {
858
- const i = n ? e.filter((a) => a.actionName.toLowerCase().includes(n.toLowerCase())) : e;
859
- return p(
906
+ const i = n ? t.filter(
907
+ (a) => a.actionName.toLowerCase().includes(n.toLowerCase())
908
+ ) : t;
909
+ return u(
860
910
  "div",
861
911
  { style: { height: "100%", display: "flex", flexDirection: "column" } },
862
912
  // Filter
863
- p("input", {
864
- style: $e,
913
+ u("input", {
914
+ style: At,
865
915
  placeholder: "Filter actions…",
866
916
  value: n,
867
917
  onInput: (a) => o(a.target.value)
868
918
  }),
869
919
  // Slider
870
- e.length > 0 ? p(
920
+ t.length > 0 ? u(
871
921
  "div",
872
922
  { style: { flexShrink: "0" } },
873
- p("input", {
923
+ u("input", {
874
924
  type: "range",
875
- style: Me,
925
+ style: $t,
876
926
  min: "0",
877
- max: String(e.length - 1),
878
- value: String(t),
927
+ max: String(t.length - 1),
928
+ value: String(e),
879
929
  onInput: (a) => r(Number(a.target.value))
880
930
  }),
881
- p(
931
+ u(
882
932
  "div",
883
- { style: { color: d.overlay0, fontSize: "10px", marginBottom: "4px" } },
884
- `${t + 1} / ${e.length}`
933
+ {
934
+ style: {
935
+ color: d.overlay0,
936
+ fontSize: "10px",
937
+ marginBottom: "4px"
938
+ }
939
+ },
940
+ `${e + 1} / ${t.length}`
885
941
  )
886
942
  ) : null,
887
943
  // Action list
888
- p(
944
+ u(
889
945
  "div",
890
946
  { style: { flex: "1", overflow: "auto" } },
891
- ...i.map((a, u) => {
892
- const c = e.indexOf(a);
893
- return p(
947
+ ...i.map((a) => {
948
+ const p = t.indexOf(a);
949
+ return u(
894
950
  "div",
895
951
  {
896
- key: c,
897
- style: Ve(c === t),
898
- onClick: () => s(c)
952
+ key: p,
953
+ style: Mt(p === e),
954
+ onClick: () => s(p)
899
955
  },
900
- p(
956
+ u(
901
957
  "span",
902
958
  null,
903
- p("span", { style: Z }, a.actionName),
904
- a.payload !== void 0 ? p(
959
+ u("span", { style: et }, a.actionName),
960
+ a.payload !== void 0 ? u(
905
961
  "span",
906
962
  { style: { color: d.subtext0, marginLeft: "8px" } },
907
963
  typeof a.payload == "object" ? JSON.stringify(a.payload) : String(a.payload)
908
964
  ) : null
909
965
  ),
910
- p("span", { style: Ie }, De(a.timestamp))
966
+ u("span", { style: Lt }, Dt(a.timestamp))
911
967
  );
912
968
  }),
913
- i.length === 0 ? p(
969
+ i.length === 0 ? u(
914
970
  "div",
915
971
  { style: { color: d.overlay0, padding: "8px" } },
916
- e.length === 0 ? "No actions yet" : "No matching actions"
972
+ t.length === 0 ? "No actions yet" : "No matching actions"
917
973
  ) : null
918
974
  )
919
975
  );
920
976
  }
921
- function Be({
922
- components: e
977
+ function zt({
978
+ components: t
923
979
  }) {
924
- return e.length === 0 ? p(
980
+ return t.length === 0 ? u(
925
981
  "div",
926
982
  { style: { color: d.overlay0, padding: "8px" } },
927
983
  "No connected components mounted"
928
- ) : p(
984
+ ) : u(
929
985
  "div",
930
986
  null,
931
- ...e.map(
932
- (t) => p(
987
+ ...t.map(
988
+ (e) => u(
933
989
  "div",
934
- { key: t.id, style: Re },
935
- p("span", { style: Le }, t.displayName),
936
- t.storeNames.length > 0 ? p(
990
+ { key: e.id, style: Rt },
991
+ u("span", { style: Ft }, e.displayName),
992
+ e.storeNames.length > 0 ? u(
937
993
  "span",
938
- { style: Ae },
939
- t.storeNames.map(
940
- (n) => p("span", { key: n, style: ee }, n)
994
+ { style: Ut },
995
+ e.storeNames.map(
996
+ (n) => u("span", { key: n, style: nt }, n)
941
997
  )
942
998
  ) : null
943
999
  )
944
1000
  )
945
1001
  );
946
1002
  }
947
- function He() {
948
- return G({
1003
+ function Gt() {
1004
+ return J({
949
1005
  state: {
950
1006
  open: !1,
951
1007
  activeTab: "stores",
@@ -958,190 +1014,205 @@ function He() {
958
1014
  components: []
959
1015
  },
960
1016
  actions: {
961
- toggle: (e) => ({ ...e, open: !e.open }),
962
- open: (e) => ({ ...e, open: !0 }),
963
- close: (e) => ({ ...e, open: !1 }),
964
- setTab: (e, t) => ({ ...e, activeTab: t }),
965
- selectStore: (e, t) => ({ ...e, selectedStore: t }),
966
- setFilter: (e, t) => ({ ...e, filter: t }),
967
- setTimeTravelIndex: (e, t) => ({ ...e, timeTravelIndex: t }),
968
- sync: (e, t) => ({ ...e, ...t })
1017
+ toggle: (t) => ({ ...t, open: !t.open }),
1018
+ open: (t) => ({ ...t, open: !0 }),
1019
+ close: (t) => ({ ...t, open: !1 }),
1020
+ setTab: (t, e) => ({ ...t, activeTab: e }),
1021
+ selectStore: (t, e) => ({ ...t, selectedStore: e }),
1022
+ setFilter: (t, e) => ({ ...t, filter: e }),
1023
+ setTimeTravelIndex: (t, e) => ({
1024
+ ...t,
1025
+ timeTravelIndex: e
1026
+ }),
1027
+ sync: (t, e) => ({ ...t, ...e })
969
1028
  }
970
1029
  });
971
1030
  }
972
- function ze({
973
- open: e,
974
- activeTab: t,
1031
+ function Kt({
1032
+ open: t,
1033
+ activeTab: e,
975
1034
  selectedStore: n,
976
1035
  timeTravelIndex: o,
977
1036
  storeNames: s,
978
1037
  storeStates: r,
979
1038
  actionLog: i,
980
1039
  filter: a,
981
- components: u,
982
- panelActions: c
1040
+ components: p,
1041
+ panelActions: l
983
1042
  }) {
984
- if (!e) return null;
1043
+ if (!t) return null;
985
1044
  const h = [
986
1045
  { id: "stores", label: "Stores" },
987
1046
  { id: "actions", label: "Actions" },
988
1047
  { id: "components", label: "Components" }
989
1048
  ];
990
1049
  let g;
991
- return t === "stores" ? g = Ue({
1050
+ return e === "stores" ? g = jt({
992
1051
  storeNames: s,
993
1052
  selectedStore: n,
994
1053
  storeStates: r,
995
- onSelectStore: c.selectStore
996
- }) : t === "actions" ? g = je({
1054
+ onSelectStore: l.selectStore
1055
+ }) : e === "actions" ? g = Bt({
997
1056
  actionLog: i,
998
1057
  timeTravelIndex: o,
999
1058
  filter: a,
1000
- onFilterChange: c.setFilter,
1001
- onTravelTo: c.travelTo,
1002
- onSliderChange: c.sliderChange
1003
- }) : g = Be({ components: u }), p(
1059
+ onFilterChange: l.setFilter,
1060
+ onTravelTo: l.travelTo,
1061
+ onSliderChange: l.sliderChange
1062
+ }) : g = zt({ components: p }), u(
1004
1063
  "div",
1005
- { style: xe },
1064
+ { style: Et },
1006
1065
  // Tab bar (all children keyed to avoid mixed key warnings)
1007
- p(
1066
+ u(
1008
1067
  "div",
1009
- { style: _e },
1010
- p("span", { key: "title", style: Fe }, "Pulse"),
1068
+ { style: Tt },
1069
+ u("span", { key: "title", style: Ht }, "Pulse"),
1011
1070
  ...h.map(
1012
- (l) => p("button", {
1013
- key: l.id,
1014
- style: ke(l.id === t),
1015
- onClick: () => c.setTab(l.id)
1016
- }, l.label)
1071
+ (c) => u(
1072
+ "button",
1073
+ {
1074
+ key: c.id,
1075
+ style: kt(c.id === e),
1076
+ onClick: () => l.setTab(c.id)
1077
+ },
1078
+ c.label
1079
+ )
1017
1080
  ),
1018
- p("span", { key: "badge", style: ee }, `${s.length} stores`),
1019
- p("button", {
1020
- key: "close",
1021
- style: Ee,
1022
- onClick: c.close
1023
- }, "×")
1081
+ u(
1082
+ "span",
1083
+ { key: "badge", style: nt },
1084
+ `${s.length} stores`
1085
+ ),
1086
+ u(
1087
+ "button",
1088
+ {
1089
+ key: "close",
1090
+ style: wt,
1091
+ onClick: l.close
1092
+ },
1093
+ "×"
1094
+ )
1024
1095
  ),
1025
1096
  // Content
1026
- p("div", { style: Te }, g)
1097
+ u("div", { style: Ct }, g)
1027
1098
  );
1028
1099
  }
1029
- function Ke(e, t) {
1030
- const n = He();
1031
- t && t(n);
1100
+ function Wt(t, e) {
1101
+ const n = Gt();
1102
+ e && e(n);
1032
1103
  let o = !1;
1033
1104
  function s() {
1034
1105
  if (!o) {
1035
1106
  o = !0;
1036
1107
  try {
1037
- const l = e.getStoreNames(), f = {};
1038
- for (const w of l)
1039
- f[w] = e.getStoreState(w);
1040
- const S = n.getState().selectedStore || l[0] || null, x = S ? e.getHistory(S) : [];
1108
+ const c = t.getStoreNames(), f = {};
1109
+ for (const w of c)
1110
+ f[w] = t.getStoreState(w);
1111
+ const b = n.getState().selectedStore || c[0] || null, _ = b ? t.getHistory(b) : [];
1041
1112
  n.dispatch("sync", {
1042
- storeNames: l,
1113
+ storeNames: c,
1043
1114
  storeStates: f,
1044
- actionLog: x,
1045
- timeTravelIndex: x.length > 0 ? x.length - 1 : -1,
1046
- selectedStore: S,
1047
- components: e.getComponents()
1115
+ actionLog: _,
1116
+ timeTravelIndex: _.length > 0 ? _.length - 1 : -1,
1117
+ selectedStore: b,
1118
+ components: t.getComponents()
1048
1119
  });
1049
1120
  } finally {
1050
1121
  o = !1;
1051
1122
  }
1052
1123
  }
1053
1124
  }
1054
- e.on((l) => {
1055
- l.type === "component-mounted" || l.type === "component-unmounted" || s();
1125
+ t.on((c) => {
1126
+ c.type === "component-mounted" || c.type === "component-unmounted" || s();
1056
1127
  });
1057
1128
  const r = {
1058
- selectStore: (l) => {
1059
- n.dispatch("selectStore", l);
1060
- const f = e.getHistory(l);
1129
+ selectStore: (c) => {
1130
+ n.dispatch("selectStore", c);
1131
+ const f = t.getHistory(c);
1061
1132
  n.dispatch("sync", {
1062
1133
  actionLog: f,
1063
1134
  timeTravelIndex: f.length > 0 ? f.length - 1 : -1
1064
1135
  });
1065
1136
  },
1066
- setTab: (l) => n.dispatch("setTab", l),
1067
- setFilter: (l) => n.dispatch("setFilter", l),
1137
+ setTab: (c) => n.dispatch("setTab", c),
1138
+ setFilter: (c) => n.dispatch("setFilter", c),
1068
1139
  close: () => n.dispatch("close"),
1069
- travelTo: (l) => {
1140
+ travelTo: (c) => {
1070
1141
  const f = n.getState().selectedStore;
1071
- f && (W(e, f, l), n.dispatch("setTimeTravelIndex", l));
1142
+ f && (W(t, f, c), n.dispatch("setTimeTravelIndex", c));
1072
1143
  },
1073
- sliderChange: (l) => {
1144
+ sliderChange: (c) => {
1074
1145
  const f = n.getState().selectedStore;
1075
- f && (W(e, f, l), n.dispatch("setTimeTravelIndex", l));
1146
+ f && (W(t, f, c), n.dispatch("setTimeTravelIndex", c));
1076
1147
  }
1077
- }, i = le({
1078
- open: n.select((l) => l.open),
1079
- activeTab: n.select((l) => l.activeTab),
1080
- selectedStore: n.select((l) => l.selectedStore),
1081
- timeTravelIndex: n.select((l) => l.timeTravelIndex),
1082
- storeNames: n.select((l) => l.storeNames),
1083
- storeStates: n.select((l) => l.storeStates),
1084
- actionLog: n.select((l) => l.actionLog),
1085
- filter: n.select((l) => l.filter),
1086
- components: n.select((l) => l.components)
1087
- })((l) => ze({ ...l, panelActions: r }));
1148
+ }, i = pt({
1149
+ open: n.select((c) => c.open),
1150
+ activeTab: n.select((c) => c.activeTab),
1151
+ selectedStore: n.select((c) => c.selectedStore),
1152
+ timeTravelIndex: n.select((c) => c.timeTravelIndex),
1153
+ storeNames: n.select((c) => c.storeNames),
1154
+ storeStates: n.select((c) => c.storeStates),
1155
+ actionLog: n.select((c) => c.actionLog),
1156
+ filter: n.select((c) => c.filter),
1157
+ components: n.select((c) => c.components)
1158
+ })((c) => Kt({ ...c, panelActions: r }));
1088
1159
  let a = null;
1089
- function u() {
1090
- a || (a = document.createElement("div"), a.id = "pulse-devtools-root", document.body.appendChild(a), Se(p(i, null), a), s());
1160
+ function p() {
1161
+ a || (a = document.createElement("div"), a.id = "pulse-devtools-root", document.body.appendChild(a), xt(u(i, null), a), s());
1091
1162
  }
1092
- function c() {
1093
- u(), n.dispatch("open");
1163
+ function l() {
1164
+ p(), n.dispatch("open");
1094
1165
  }
1095
1166
  function h() {
1096
1167
  n.dispatch("close");
1097
1168
  }
1098
1169
  function g() {
1099
- u(), n.dispatch("toggle");
1170
+ p(), n.dispatch("toggle");
1100
1171
  }
1101
- return { openPanel: c, closePanel: h, togglePanel: g, panelStore: n };
1172
+ return { openPanel: l, closePanel: h, togglePanel: g, panelStore: n };
1102
1173
  }
1103
- const $ = new de(), te = /* @__PURE__ */ new WeakSet();
1104
- function We(e) {
1105
- te.add(e);
1174
+ const L = new mt(), ot = /* @__PURE__ */ new WeakSet();
1175
+ function Xt(t) {
1176
+ ot.add(t);
1106
1177
  }
1107
- ce(
1108
- (e) => {
1109
- const t = e.connectedFn._bindings || {}, n = Object.values(t).map((i) => i.store);
1110
- if (n.length > 0 && n.every((i) => te.has(i)))
1178
+ at(
1179
+ (t) => {
1180
+ const e = t.connectedFn._bindings || {}, n = Object.values(e).map((i) => i.store);
1181
+ if (n.length > 0 && n.every((i) => ot.has(i)))
1111
1182
  return;
1112
- const o = n.map((i) => i.name || "unnamed"), s = e.connectedFn.displayName || "Unknown", r = $.trackComponent(s, o);
1113
- e._devtoolsId = r;
1183
+ const o = n.map((i) => i.name || "unnamed"), s = t.connectedFn.displayName || "Unknown", r = L.trackComponent(s, o);
1184
+ t._devtoolsId = r;
1114
1185
  },
1115
- (e) => {
1116
- const t = e._devtoolsId;
1117
- t != null && $.untrackComponent(t);
1186
+ (t) => {
1187
+ const e = t._devtoolsId;
1188
+ e != null && L.untrackComponent(e);
1118
1189
  }
1119
1190
  );
1120
1191
  let N = null;
1121
- function ne() {
1122
- return N || (N = Ke($, We)), N;
1192
+ function st() {
1193
+ return N || (N = Wt(L, Xt)), N;
1123
1194
  }
1124
- function Qe() {
1125
- ne().openPanel();
1195
+ function Zt() {
1196
+ st().openPanel();
1126
1197
  }
1127
- function Ye() {
1198
+ function te() {
1128
1199
  N && N.closePanel();
1129
1200
  }
1130
- function Xe() {
1131
- ne().togglePanel();
1201
+ function qt() {
1202
+ st().togglePanel();
1132
1203
  }
1133
- typeof window < "u" && (window.addEventListener("keydown", (e) => {
1134
- e.ctrlKey && e.shiftKey && e.key === "P" && (e.preventDefault(), Xe());
1135
- }), window.__PULSE_DEVTOOLS__ = $);
1204
+ typeof window < "u" && (window.addEventListener("keydown", (t) => {
1205
+ t.ctrlKey && t.shiftKey && t.key === "P" && (t.preventDefault(), qt());
1206
+ }), window.__PULSE_DEVTOOLS__ = L);
1136
1207
  export {
1137
- de as PulseDevtools,
1138
- We as _markInternalStore,
1139
- Ye as closePanel,
1140
- $ as devtools,
1141
- Ge as instrumentStore,
1142
- Qe as openPanel,
1143
- Je as replayFrom,
1144
- Xe as togglePanel,
1208
+ mt as PulseDevtools,
1209
+ Xt as _markInternalStore,
1210
+ te as closePanel,
1211
+ L as devtools,
1212
+ Qt as instrumentStore,
1213
+ Zt as openPanel,
1214
+ Yt as replayFrom,
1215
+ qt as togglePanel,
1145
1216
  W as travelTo
1146
1217
  };
1147
1218
  //# sourceMappingURL=devtools.js.map