@incremark/devtools 0.3.3 → 0.3.4

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,723 +1,3758 @@
1
- // src/styles.ts
2
- var styles = `
3
- .incremark-devtools {
4
- position: fixed;
5
- z-index: 99999;
6
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
7
- font-size: 13px;
8
- line-height: 1.5;
1
+ var Os = Object.defineProperty;
2
+ var ar = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var qs = (e, t, n) => t in e ? Os(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var K = (e, t, n) => qs(e, typeof t != "symbol" ? t + "" : t, n), zn = (e, t, n) => t.has(e) || ar("Cannot " + n);
7
+ var c = (e, t, n) => (zn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), z = (e, t, n) => t.has(e) ? ar("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), T = (e, t, n, r) => (zn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), R = (e, t, n) => (zn(e, t, "access private method"), n);
8
+ const Y = Symbol(), zs = Symbol("filename"), Ps = "http://www.w3.org/1999/xhtml";
9
+ var Tr, Cr;
10
+ const lr = (Cr = (Tr = globalThis.process) == null ? void 0 : Tr.env) == null ? void 0 : Cr.NODE_ENV, _ = lr && !lr.toLowerCase().startsWith("prod");
11
+ var Wn = Array.isArray, Is = Array.prototype.indexOf, En = Array.from, pt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, Ns = Object.getOwnPropertyDescriptors, Ms = Object.prototype, Ls = Array.prototype, Ar = Object.getPrototypeOf, fr = Object.isExtensible;
12
+ function Ds(e) {
13
+ for (var t = 0; t < e.length; t++)
14
+ e[t]();
15
+ }
16
+ function Or() {
17
+ var e, t, n = new Promise((r, o) => {
18
+ e = r, t = o;
19
+ });
20
+ return { promise: n, resolve: e, reject: t };
21
+ }
22
+ function Rs(e, t) {
23
+ if (Array.isArray(e))
24
+ return e;
25
+ if (!(Symbol.iterator in e))
26
+ return Array.from(e);
27
+ const n = [];
28
+ for (const r of e)
29
+ if (n.push(r), n.length === t) break;
30
+ return n;
31
+ }
32
+ const V = 2, Gn = 4, Zn = 8, Bs = 1 << 24, Re = 16, Be = 32, _t = 64, Tn = 128, ke = 512, X = 1024, ae = 2048, ze = 4096, ce = 8192, Ye = 16384, Xn = 32768, Nt = 65536, mn = 1 << 17, qr = 1 << 18, Bt = 1 << 19, Fs = 1 << 20, Ke = 1 << 25, Xe = 32768, Nn = 1 << 21, Cn = 1 << 22, We = 1 << 23, ft = Symbol("$state"), zr = Symbol("proxy path"), Ct = new class extends Error {
33
+ constructor() {
34
+ super(...arguments);
35
+ K(this, "name", "StaleReactionError");
36
+ K(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
37
+ }
38
+ }();
39
+ function Hs() {
40
+ if (_) {
41
+ const e = new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");
42
+ throw e.name = "Svelte error", e;
43
+ } else
44
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
45
+ }
46
+ function Us() {
47
+ if (_) {
48
+ const e = new Error(`derived_references_self
49
+ A derived value cannot reference itself recursively
50
+ https://svelte.dev/e/derived_references_self`);
51
+ throw e.name = "Svelte error", e;
52
+ } else
53
+ throw new Error("https://svelte.dev/e/derived_references_self");
54
+ }
55
+ function Js(e) {
56
+ if (_) {
57
+ const t = new Error(`effect_in_teardown
58
+ \`${e}\` cannot be used inside an effect cleanup function
59
+ https://svelte.dev/e/effect_in_teardown`);
60
+ throw t.name = "Svelte error", t;
61
+ } else
62
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
63
+ }
64
+ function Vs() {
65
+ if (_) {
66
+ const e = new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");
67
+ throw e.name = "Svelte error", e;
68
+ } else
69
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
70
+ }
71
+ function Ks(e) {
72
+ if (_) {
73
+ const t = new Error(`effect_orphan
74
+ \`${e}\` can only be used inside an effect (e.g. during component initialisation)
75
+ https://svelte.dev/e/effect_orphan`);
76
+ throw t.name = "Svelte error", t;
77
+ } else
78
+ throw new Error("https://svelte.dev/e/effect_orphan");
79
+ }
80
+ function Ys() {
81
+ if (_) {
82
+ const e = new Error(`effect_update_depth_exceeded
83
+ Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
84
+ https://svelte.dev/e/effect_update_depth_exceeded`);
85
+ throw e.name = "Svelte error", e;
86
+ } else
87
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
88
+ }
89
+ function Ws(e) {
90
+ if (_) {
91
+ const t = new Error(`rune_outside_svelte
92
+ The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
93
+ https://svelte.dev/e/rune_outside_svelte`);
94
+ throw t.name = "Svelte error", t;
95
+ } else
96
+ throw new Error("https://svelte.dev/e/rune_outside_svelte");
97
+ }
98
+ function Gs() {
99
+ if (_) {
100
+ const e = new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");
101
+ throw e.name = "Svelte error", e;
102
+ } else
103
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
104
+ }
105
+ function Zs() {
106
+ if (_) {
107
+ const e = new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");
108
+ throw e.name = "Svelte error", e;
109
+ } else
110
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
111
+ }
112
+ function Xs() {
113
+ if (_) {
114
+ const e = new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");
115
+ throw e.name = "Svelte error", e;
116
+ } else
117
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
118
+ }
119
+ function Qs() {
120
+ if (_) {
121
+ const e = new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");
122
+ throw e.name = "Svelte error", e;
123
+ } else
124
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
125
+ }
126
+ var rn = "font-weight: bold", sn = "font-weight: normal";
127
+ function $s() {
128
+ _ ? console.warn(`%c[svelte] lifecycle_double_unmount
129
+ %cTried to unmount a component that was not mounted
130
+ https://svelte.dev/e/lifecycle_double_unmount`, rn, sn) : console.warn("https://svelte.dev/e/lifecycle_double_unmount");
131
+ }
132
+ function eo() {
133
+ _ ? console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value", rn, sn) : console.warn("https://svelte.dev/e/select_multiple_invalid_value");
134
+ }
135
+ function Pn(e) {
136
+ _ ? console.warn(`%c[svelte] state_proxy_equality_mismatch
137
+ %cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results
138
+ https://svelte.dev/e/state_proxy_equality_mismatch`, rn, sn) : console.warn("https://svelte.dev/e/state_proxy_equality_mismatch");
139
+ }
140
+ function to() {
141
+ _ ? console.warn(`%c[svelte] state_proxy_unmount
142
+ %cTried to unmount a state proxy, rather than a component
143
+ https://svelte.dev/e/state_proxy_unmount`, rn, sn) : console.warn("https://svelte.dev/e/state_proxy_unmount");
144
+ }
145
+ function no() {
146
+ _ ? console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop", rn, sn) : console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
147
+ }
148
+ function Pr(e) {
149
+ return e === this.v;
150
+ }
151
+ function ro(e, t) {
152
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
153
+ }
154
+ function Ir(e) {
155
+ return !ro(e, this.v);
156
+ }
157
+ let so = !1;
158
+ function Ee(e, t) {
159
+ return e.label = t, Nr(e.v, t), e;
160
+ }
161
+ function Nr(e, t) {
162
+ var n;
163
+ return (n = e == null ? void 0 : e[zr]) == null || n.call(e, t), e;
164
+ }
165
+ function oo(e) {
166
+ const t = new Error(), n = io();
167
+ return n.length === 0 ? null : (n.unshift(`
168
+ `), pt(t, "stack", {
169
+ value: n.join(`
170
+ `)
171
+ }), pt(t, "name", {
172
+ value: e
173
+ }), /** @type {Error & { stack: string }} */
174
+ t);
175
+ }
176
+ function io() {
177
+ const e = Error.stackTraceLimit;
178
+ Error.stackTraceLimit = 1 / 0;
179
+ const t = new Error().stack;
180
+ if (Error.stackTraceLimit = e, !t) return [];
181
+ const n = t.split(`
182
+ `), r = [];
183
+ for (let o = 0; o < n.length; o++) {
184
+ const s = n[o], i = s.replaceAll("\\", "/");
185
+ if (s.trim() !== "Error") {
186
+ if (s.includes("validate_each_keys"))
187
+ return [];
188
+ i.includes("svelte/src/internal") || i.includes("node_modules/.vite") || r.push(s);
189
+ }
190
+ }
191
+ return r;
192
+ }
193
+ let G = null;
194
+ function Mt(e) {
195
+ G = e;
196
+ }
197
+ let Wt = null;
198
+ function _n(e) {
199
+ Wt = e;
200
+ }
201
+ let on = null;
202
+ function cr(e) {
203
+ on = e;
204
+ }
205
+ function Qe(e, t = !1, n) {
206
+ G = {
207
+ p: G,
208
+ i: !1,
209
+ c: null,
210
+ e: null,
211
+ s: e,
212
+ x: null,
213
+ l: null
214
+ }, _ && (G.function = n, on = n);
215
+ }
216
+ function $e(e) {
217
+ var t = (
218
+ /** @type {ComponentContext} */
219
+ G
220
+ ), n = t.e;
221
+ if (n !== null) {
222
+ t.e = null;
223
+ for (var r of n)
224
+ Qr(r);
225
+ }
226
+ return t.i = !0, G = t.p, _ && (on = (G == null ? void 0 : G.function) ?? null), /** @type {T} */
227
+ {};
228
+ }
229
+ function Mr() {
230
+ return !0;
231
+ }
232
+ let St = [];
233
+ function ao() {
234
+ var e = St;
235
+ St = [], Ds(e);
236
+ }
237
+ function Sn(e) {
238
+ if (St.length === 0) {
239
+ var t = St;
240
+ queueMicrotask(() => {
241
+ t === St && ao();
242
+ });
243
+ }
244
+ St.push(e);
245
+ }
246
+ const Mn = /* @__PURE__ */ new WeakMap();
247
+ function Lr(e) {
248
+ var t = P;
249
+ if (t === null)
250
+ return q.f |= We, e;
251
+ if (_ && e instanceof Error && !Mn.has(e) && Mn.set(e, lo(e, t)), (t.f & Xn) === 0) {
252
+ if ((t.f & Tn) === 0)
253
+ throw _ && !t.parent && e instanceof Error && Dr(e), e;
254
+ t.b.error(e);
255
+ } else
256
+ Lt(e, t);
257
+ }
258
+ function Lt(e, t) {
259
+ for (; t !== null; ) {
260
+ if ((t.f & Tn) !== 0)
261
+ try {
262
+ t.b.error(e);
263
+ return;
264
+ } catch (n) {
265
+ e = n;
266
+ }
267
+ t = t.parent;
268
+ }
269
+ throw _ && e instanceof Error && Dr(e), e;
270
+ }
271
+ function lo(e, t) {
272
+ var i, a, l;
273
+ const n = At(e, "message");
274
+ if (!(n && !n.configurable)) {
275
+ for (var r = nr ? " " : " ", o = `
276
+ ${r}in ${((i = t.fn) == null ? void 0 : i.name) || "<unknown>"}`, s = t.ctx; s !== null; )
277
+ o += `
278
+ ${r}in ${(a = s.function) == null ? void 0 : a[zs].split("/").pop()}`, s = s.p;
279
+ return {
280
+ message: e.message + `
281
+ ${o}
282
+ `,
283
+ stack: (l = e.stack) == null ? void 0 : l.split(`
284
+ `).filter((f) => !f.includes("svelte/src/internal")).join(`
285
+ `)
286
+ };
287
+ }
288
+ }
289
+ function Dr(e) {
290
+ const t = Mn.get(e);
291
+ t && (pt(e, "message", {
292
+ value: t.message
293
+ }), pt(e, "stack", {
294
+ value: t.stack
295
+ }));
296
+ }
297
+ const cn = /* @__PURE__ */ new Set();
298
+ let I = null, B = null, Te = [], Qn = null, Ln = !1;
299
+ var qt, zt, rt, st, en, Pt, It, J, Dn, Jt, Rn, Rr, Br;
300
+ const xn = class xn {
301
+ constructor() {
302
+ z(this, J);
303
+ K(this, "committed", !1);
304
+ /**
305
+ * The current values of any sources that are updated in this batch
306
+ * They keys of this map are identical to `this.#previous`
307
+ * @type {Map<Source, any>}
308
+ */
309
+ K(this, "current", /* @__PURE__ */ new Map());
310
+ /**
311
+ * The values of any sources that are updated in this batch _before_ those updates took place.
312
+ * They keys of this map are identical to `this.#current`
313
+ * @type {Map<Source, any>}
314
+ */
315
+ K(this, "previous", /* @__PURE__ */ new Map());
316
+ /**
317
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
318
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
319
+ * @type {Set<() => void>}
320
+ */
321
+ z(this, qt, /* @__PURE__ */ new Set());
322
+ /**
323
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
324
+ * @type {Set<(batch: Batch) => void>}
325
+ */
326
+ z(this, zt, /* @__PURE__ */ new Set());
327
+ /**
328
+ * The number of async effects that are currently in flight
329
+ */
330
+ z(this, rt, 0);
331
+ /**
332
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
333
+ */
334
+ z(this, st, 0);
335
+ /**
336
+ * A deferred that resolves when the batch is committed, used with `settled()`
337
+ * TODO replace with Promise.withResolvers once supported widely enough
338
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
339
+ */
340
+ z(this, en, null);
341
+ /**
342
+ * Deferred effects (which run after async work has completed) that are DIRTY
343
+ * @type {Set<Effect>}
344
+ */
345
+ z(this, Pt, /* @__PURE__ */ new Set());
346
+ /**
347
+ * Deferred effects that are MAYBE_DIRTY
348
+ * @type {Set<Effect>}
349
+ */
350
+ z(this, It, /* @__PURE__ */ new Set());
351
+ /**
352
+ * A set of branches that still exist, but will be destroyed when this batch
353
+ * is committed — we skip over these during `process`
354
+ * @type {Set<Effect>}
355
+ */
356
+ K(this, "skipped_effects", /* @__PURE__ */ new Set());
357
+ K(this, "is_fork", !1);
358
+ }
359
+ is_deferred() {
360
+ return this.is_fork || c(this, st) > 0;
361
+ }
362
+ /**
363
+ *
364
+ * @param {Effect[]} root_effects
365
+ */
366
+ process(t) {
367
+ var r;
368
+ Te = [], this.apply();
369
+ var n = {
370
+ parent: null,
371
+ effect: null,
372
+ effects: [],
373
+ render_effects: []
374
+ };
375
+ for (const o of t)
376
+ R(this, J, Dn).call(this, o, n);
377
+ this.is_fork || R(this, J, Rr).call(this), this.is_deferred() ? (R(this, J, Jt).call(this, n.effects), R(this, J, Jt).call(this, n.render_effects)) : (I = null, ur(n.render_effects), ur(n.effects), (r = c(this, en)) == null || r.resolve()), B = null;
378
+ }
379
+ /**
380
+ * Associate a change to a given source with the current
381
+ * batch, noting its previous and current values
382
+ * @param {Source} source
383
+ * @param {any} value
384
+ */
385
+ capture(t, n) {
386
+ this.previous.has(t) || this.previous.set(t, n), (t.f & We) === 0 && (this.current.set(t, t.v), B == null || B.set(t, t.v));
387
+ }
388
+ activate() {
389
+ I = this, this.apply();
390
+ }
391
+ deactivate() {
392
+ I === this && (I = null, B = null);
393
+ }
394
+ flush() {
395
+ if (this.activate(), Te.length > 0) {
396
+ if (fo(), I !== null && I !== this)
397
+ return;
398
+ } else c(this, rt) === 0 && this.process([]);
399
+ this.deactivate();
400
+ }
401
+ discard() {
402
+ for (const t of c(this, zt)) t(this);
403
+ c(this, zt).clear();
404
+ }
405
+ /**
406
+ *
407
+ * @param {boolean} blocking
408
+ */
409
+ increment(t) {
410
+ T(this, rt, c(this, rt) + 1), t && T(this, st, c(this, st) + 1);
411
+ }
412
+ /**
413
+ *
414
+ * @param {boolean} blocking
415
+ */
416
+ decrement(t) {
417
+ T(this, rt, c(this, rt) - 1), t && T(this, st, c(this, st) - 1), this.revive();
418
+ }
419
+ revive() {
420
+ for (const t of c(this, Pt))
421
+ c(this, It).delete(t), Q(t, ae), gt(t);
422
+ for (const t of c(this, It))
423
+ Q(t, ze), gt(t);
424
+ this.flush();
425
+ }
426
+ /** @param {() => void} fn */
427
+ oncommit(t) {
428
+ c(this, qt).add(t);
429
+ }
430
+ /** @param {(batch: Batch) => void} fn */
431
+ ondiscard(t) {
432
+ c(this, zt).add(t);
433
+ }
434
+ settled() {
435
+ return (c(this, en) ?? T(this, en, Or())).promise;
436
+ }
437
+ static ensure() {
438
+ if (I === null) {
439
+ const t = I = new xn();
440
+ cn.add(I), xn.enqueue(() => {
441
+ I === t && t.flush();
442
+ });
443
+ }
444
+ return I;
445
+ }
446
+ /** @param {() => void} task */
447
+ static enqueue(t) {
448
+ Sn(t);
449
+ }
450
+ apply() {
451
+ }
452
+ };
453
+ qt = new WeakMap(), zt = new WeakMap(), rt = new WeakMap(), st = new WeakMap(), en = new WeakMap(), Pt = new WeakMap(), It = new WeakMap(), J = new WeakSet(), /**
454
+ * Traverse the effect tree, executing effects or stashing
455
+ * them for later execution as appropriate
456
+ * @param {Effect} root
457
+ * @param {EffectTarget} target
458
+ */
459
+ Dn = function(t, n) {
460
+ var g;
461
+ t.f ^= X;
462
+ for (var r = t.first; r !== null; ) {
463
+ var o = r.f, s = (o & (Be | _t)) !== 0, i = s && (o & X) !== 0, a = i || (o & ce) !== 0 || this.skipped_effects.has(r);
464
+ if ((r.f & Tn) !== 0 && ((g = r.b) != null && g.is_pending()) && (n = {
465
+ parent: n,
466
+ effect: r,
467
+ effects: [],
468
+ render_effects: []
469
+ }), !a && r.fn !== null) {
470
+ s ? r.f ^= X : (o & Gn) !== 0 ? n.effects.push(r) : ln(r) && ((r.f & Re) !== 0 && c(this, Pt).add(r), Xt(r));
471
+ var l = r.first;
472
+ if (l !== null) {
473
+ r = l;
474
+ continue;
475
+ }
476
+ }
477
+ var f = r.parent;
478
+ for (r = r.next; r === null && f !== null; )
479
+ f === n.effect && (R(this, J, Jt).call(this, n.effects), R(this, J, Jt).call(this, n.render_effects), n = /** @type {EffectTarget} */
480
+ n.parent), r = f.next, f = f.parent;
481
+ }
482
+ }, /**
483
+ * @param {Effect[]} effects
484
+ */
485
+ Jt = function(t) {
486
+ for (const n of t)
487
+ (n.f & ae) !== 0 ? c(this, Pt).add(n) : (n.f & ze) !== 0 && c(this, It).add(n), R(this, J, Rn).call(this, n.deps), Q(n, X);
488
+ }, /**
489
+ * @param {Value[] | null} deps
490
+ */
491
+ Rn = function(t) {
492
+ if (t !== null)
493
+ for (const n of t)
494
+ (n.f & V) === 0 || (n.f & Xe) === 0 || (n.f ^= Xe, R(this, J, Rn).call(
495
+ this,
496
+ /** @type {Derived} */
497
+ n.deps
498
+ ));
499
+ }, Rr = function() {
500
+ if (c(this, st) === 0) {
501
+ for (const t of c(this, qt)) t();
502
+ c(this, qt).clear();
503
+ }
504
+ c(this, rt) === 0 && R(this, J, Br).call(this);
505
+ }, Br = function() {
506
+ var s;
507
+ if (cn.size > 1) {
508
+ this.previous.clear();
509
+ var t = B, n = !0, r = {
510
+ parent: null,
511
+ effect: null,
512
+ effects: [],
513
+ render_effects: []
514
+ };
515
+ for (const i of cn) {
516
+ if (i === this) {
517
+ n = !1;
518
+ continue;
519
+ }
520
+ const a = [];
521
+ for (const [f, g] of this.current) {
522
+ if (i.current.has(f))
523
+ if (n && g !== i.current.get(f))
524
+ i.current.set(f, g);
525
+ else
526
+ continue;
527
+ a.push(f);
528
+ }
529
+ if (a.length === 0)
530
+ continue;
531
+ const l = [...i.current.keys()].filter((f) => !this.current.has(f));
532
+ if (l.length > 0) {
533
+ var o = Te;
534
+ Te = [];
535
+ const f = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map();
536
+ for (const h of a)
537
+ Fr(h, l, f, g);
538
+ if (Te.length > 0) {
539
+ I = i, i.apply();
540
+ for (const h of Te)
541
+ R(s = i, J, Dn).call(s, h, r);
542
+ i.deactivate();
543
+ }
544
+ Te = o;
545
+ }
546
+ }
547
+ I = null, B = t;
548
+ }
549
+ this.committed = !0, cn.delete(this);
550
+ };
551
+ let De = xn;
552
+ function fo() {
553
+ var e = ut;
554
+ Ln = !0;
555
+ var t = _ ? /* @__PURE__ */ new Set() : null;
556
+ try {
557
+ var n = 0;
558
+ for (wn(!0); Te.length > 0; ) {
559
+ var r = De.ensure();
560
+ if (n++ > 1e3) {
561
+ if (_) {
562
+ var o = /* @__PURE__ */ new Map();
563
+ for (const i of r.current.keys())
564
+ for (const [a, l] of i.updated ?? []) {
565
+ var s = o.get(a);
566
+ s || (s = { error: l.error, count: 0 }, o.set(a, s)), s.count += l.count;
567
+ }
568
+ for (const i of o.values())
569
+ i.error && console.error(i.error);
570
+ }
571
+ co();
572
+ }
573
+ if (r.process(Te), Ge.clear(), _)
574
+ for (const i of r.current.keys())
575
+ t.add(i);
576
+ }
577
+ } finally {
578
+ if (Ln = !1, wn(e), Qn = null, _)
579
+ for (
580
+ const i of
581
+ /** @type {Set<Source>} */
582
+ t
583
+ )
584
+ i.updated = null;
585
+ }
586
+ }
587
+ function co() {
588
+ try {
589
+ Ys();
590
+ } catch (e) {
591
+ _ && pt(e, "stack", { value: "" }), Lt(e, Qn);
592
+ }
593
+ }
594
+ let we = null;
595
+ function ur(e) {
596
+ var t = e.length;
597
+ if (t !== 0) {
598
+ for (var n = 0; n < t; ) {
599
+ var r = e[n++];
600
+ if ((r.f & (Ye | ce)) === 0 && ln(r) && (we = /* @__PURE__ */ new Set(), Xt(r), r.deps === null && r.first === null && r.nodes === null && (r.teardown === null && r.ac === null ? rs(r) : r.fn = null), (we == null ? void 0 : we.size) > 0)) {
601
+ Ge.clear();
602
+ for (const o of we) {
603
+ if ((o.f & (Ye | ce)) !== 0) continue;
604
+ const s = [o];
605
+ let i = o.parent;
606
+ for (; i !== null; )
607
+ we.has(i) && (we.delete(i), s.push(i)), i = i.parent;
608
+ for (let a = s.length - 1; a >= 0; a--) {
609
+ const l = s[a];
610
+ (l.f & (Ye | ce)) === 0 && Xt(l);
611
+ }
612
+ }
613
+ we.clear();
614
+ }
615
+ }
616
+ we = null;
617
+ }
618
+ }
619
+ function Fr(e, t, n, r) {
620
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
621
+ for (const o of e.reactions) {
622
+ const s = o.f;
623
+ (s & V) !== 0 ? Fr(
624
+ /** @type {Derived} */
625
+ o,
626
+ t,
627
+ n,
628
+ r
629
+ ) : (s & (Cn | Re)) !== 0 && (s & ae) === 0 && Hr(o, t, r) && (Q(o, ae), gt(
630
+ /** @type {Effect} */
631
+ o
632
+ ));
633
+ }
634
+ }
635
+ function Hr(e, t, n) {
636
+ const r = n.get(e);
637
+ if (r !== void 0) return r;
638
+ if (e.deps !== null)
639
+ for (const o of e.deps) {
640
+ if (t.includes(o))
641
+ return !0;
642
+ if ((o.f & V) !== 0 && Hr(
643
+ /** @type {Derived} */
644
+ o,
645
+ t,
646
+ n
647
+ ))
648
+ return n.set(
649
+ /** @type {Derived} */
650
+ o,
651
+ !0
652
+ ), !0;
653
+ }
654
+ return n.set(e, !1), !1;
655
+ }
656
+ function gt(e) {
657
+ for (var t = Qn = e; t.parent !== null; ) {
658
+ t = t.parent;
659
+ var n = t.f;
660
+ if (Ln && t === P && (n & Re) !== 0 && (n & qr) === 0)
661
+ return;
662
+ if ((n & (_t | Be)) !== 0) {
663
+ if ((n & X) === 0) return;
664
+ t.f ^= X;
665
+ }
666
+ }
667
+ Te.push(t);
668
+ }
669
+ function uo(e) {
670
+ let t = 0, n = mt(0), r;
671
+ return _ && Ee(n, "createSubscriber version"), () => {
672
+ Gt() && (p(n), es(() => (t === 0 && (r = vs(() => e(() => Kt(n)))), t += 1, () => {
673
+ Sn(() => {
674
+ t -= 1, t === 0 && (r == null || r(), r = void 0, Kt(n));
675
+ });
676
+ })));
677
+ };
678
+ }
679
+ var vo = Nt | Bt | Tn;
680
+ function ho(e, t, n) {
681
+ new po(e, t, n);
682
+ }
683
+ var he, pe, Yn, Ce, ot, Se, ge, se, Ae, Me, Je, it, Ve, at, Le, kn, F, go, mo, Bn, pn, gn, Fn;
684
+ class po {
685
+ /**
686
+ * @param {TemplateNode} node
687
+ * @param {BoundaryProps} props
688
+ * @param {((anchor: Node) => void)} children
689
+ */
690
+ constructor(t, n, r) {
691
+ z(this, F);
692
+ /** @type {Boundary | null} */
693
+ K(this, "parent");
694
+ z(this, he, !1);
695
+ /** @type {TemplateNode} */
696
+ z(this, pe);
697
+ /** @type {TemplateNode | null} */
698
+ z(this, Yn, null);
699
+ /** @type {BoundaryProps} */
700
+ z(this, Ce);
701
+ /** @type {((anchor: Node) => void)} */
702
+ z(this, ot);
703
+ /** @type {Effect} */
704
+ z(this, Se);
705
+ /** @type {Effect | null} */
706
+ z(this, ge, null);
707
+ /** @type {Effect | null} */
708
+ z(this, se, null);
709
+ /** @type {Effect | null} */
710
+ z(this, Ae, null);
711
+ /** @type {DocumentFragment | null} */
712
+ z(this, Me, null);
713
+ /** @type {TemplateNode | null} */
714
+ z(this, Je, null);
715
+ z(this, it, 0);
716
+ z(this, Ve, 0);
717
+ z(this, at, !1);
718
+ /**
719
+ * A source containing the number of pending async deriveds/expressions.
720
+ * Only created if `$effect.pending()` is used inside the boundary,
721
+ * otherwise updating the source results in needless `Batch.ensure()`
722
+ * calls followed by no-op flushes
723
+ * @type {Source<number> | null}
724
+ */
725
+ z(this, Le, null);
726
+ z(this, kn, uo(() => (T(this, Le, mt(c(this, it))), _ && Ee(c(this, Le), "$effect.pending()"), () => {
727
+ T(this, Le, null);
728
+ })));
729
+ T(this, pe, t), T(this, Ce, n), T(this, ot, r), this.parent = /** @type {Effect} */
730
+ P.b, T(this, he, !!c(this, Ce).pending), T(this, Se, sr(() => {
731
+ P.b = this;
732
+ {
733
+ var o = R(this, F, Bn).call(this);
734
+ try {
735
+ T(this, ge, me(() => r(o)));
736
+ } catch (s) {
737
+ this.error(s);
738
+ }
739
+ c(this, Ve) > 0 ? R(this, F, gn).call(this) : T(this, he, !1);
740
+ }
741
+ return () => {
742
+ var s;
743
+ (s = c(this, Je)) == null || s.remove();
744
+ };
745
+ }, vo));
746
+ }
747
+ /**
748
+ * Returns `true` if the effect exists inside a boundary whose pending snippet is shown
749
+ * @returns {boolean}
750
+ */
751
+ is_pending() {
752
+ return c(this, he) || !!this.parent && this.parent.is_pending();
753
+ }
754
+ has_pending_snippet() {
755
+ return !!c(this, Ce).pending;
756
+ }
757
+ /**
758
+ * Update the source that powers `$effect.pending()` inside this boundary,
759
+ * and controls when the current `pending` snippet (if any) is removed.
760
+ * Do not call from inside the class
761
+ * @param {1 | -1} d
762
+ */
763
+ update_pending_count(t) {
764
+ R(this, F, Fn).call(this, t), T(this, it, c(this, it) + t), c(this, Le) && Rt(c(this, Le), c(this, it));
765
+ }
766
+ get_effect_pending() {
767
+ return c(this, kn).call(this), p(
768
+ /** @type {Source<number>} */
769
+ c(this, Le)
770
+ );
771
+ }
772
+ /** @param {unknown} error */
773
+ error(t) {
774
+ var n = c(this, Ce).onerror;
775
+ let r = c(this, Ce).failed;
776
+ if (c(this, at) || !n && !r)
777
+ throw t;
778
+ c(this, ge) && (ie(c(this, ge)), T(this, ge, null)), c(this, se) && (ie(c(this, se)), T(this, se, null)), c(this, Ae) && (ie(c(this, Ae)), T(this, Ae, null));
779
+ var o = !1, s = !1;
780
+ const i = () => {
781
+ if (o) {
782
+ no();
783
+ return;
784
+ }
785
+ o = !0, s && Qs(), De.ensure(), T(this, it, 0), c(this, Ae) !== null && ct(c(this, Ae), () => {
786
+ T(this, Ae, null);
787
+ }), T(this, he, this.has_pending_snippet()), T(this, ge, R(this, F, pn).call(this, () => (T(this, at, !1), me(() => c(this, ot).call(this, c(this, pe)))))), c(this, Ve) > 0 ? R(this, F, gn).call(this) : T(this, he, !1);
788
+ };
789
+ var a = q;
790
+ try {
791
+ oe(null), s = !0, n == null || n(t, i), s = !1;
792
+ } catch (l) {
793
+ Lt(l, c(this, Se) && c(this, Se).parent);
794
+ } finally {
795
+ oe(a);
796
+ }
797
+ r && Sn(() => {
798
+ T(this, Ae, R(this, F, pn).call(this, () => {
799
+ De.ensure(), T(this, at, !0);
800
+ try {
801
+ return me(() => {
802
+ r(
803
+ c(this, pe),
804
+ () => t,
805
+ () => i
806
+ );
807
+ });
808
+ } catch (l) {
809
+ return Lt(
810
+ l,
811
+ /** @type {Effect} */
812
+ c(this, Se).parent
813
+ ), null;
814
+ } finally {
815
+ T(this, at, !1);
816
+ }
817
+ }));
818
+ });
819
+ }
820
+ }
821
+ he = new WeakMap(), pe = new WeakMap(), Yn = new WeakMap(), Ce = new WeakMap(), ot = new WeakMap(), Se = new WeakMap(), ge = new WeakMap(), se = new WeakMap(), Ae = new WeakMap(), Me = new WeakMap(), Je = new WeakMap(), it = new WeakMap(), Ve = new WeakMap(), at = new WeakMap(), Le = new WeakMap(), kn = new WeakMap(), F = new WeakSet(), go = function() {
822
+ try {
823
+ T(this, ge, me(() => c(this, ot).call(this, c(this, pe))));
824
+ } catch (t) {
825
+ this.error(t);
826
+ }
827
+ T(this, he, !1);
828
+ }, mo = function() {
829
+ const t = c(this, Ce).pending;
830
+ t && (T(this, se, me(() => t(c(this, pe)))), De.enqueue(() => {
831
+ var n = R(this, F, Bn).call(this);
832
+ T(this, ge, R(this, F, pn).call(this, () => (De.ensure(), me(() => c(this, ot).call(this, n))))), c(this, Ve) > 0 ? R(this, F, gn).call(this) : (ct(
833
+ /** @type {Effect} */
834
+ c(this, se),
835
+ () => {
836
+ T(this, se, null);
837
+ }
838
+ ), T(this, he, !1));
839
+ }));
840
+ }, Bn = function() {
841
+ var t = c(this, pe);
842
+ return c(this, he) && (T(this, Je, Ze()), c(this, pe).before(c(this, Je)), t = c(this, Je)), t;
843
+ }, /**
844
+ * @param {() => Effect | null} fn
845
+ */
846
+ pn = function(t) {
847
+ var n = P, r = q, o = G;
848
+ xe(c(this, Se)), oe(c(this, Se)), Mt(c(this, Se).ctx);
849
+ try {
850
+ return t();
851
+ } catch (s) {
852
+ return Lr(s), null;
853
+ } finally {
854
+ xe(n), oe(r), Mt(o);
855
+ }
856
+ }, gn = function() {
857
+ const t = (
858
+ /** @type {(anchor: Node) => void} */
859
+ c(this, Ce).pending
860
+ );
861
+ c(this, ge) !== null && (T(this, Me, document.createDocumentFragment()), c(this, Me).append(
862
+ /** @type {TemplateNode} */
863
+ c(this, Je)
864
+ ), is(c(this, ge), c(this, Me))), c(this, se) === null && T(this, se, me(() => t(c(this, pe))));
865
+ }, /**
866
+ * Updates the pending count associated with the currently visible pending snippet,
867
+ * if any, such that we can replace the snippet with content once work is done
868
+ * @param {1 | -1} d
869
+ */
870
+ Fn = function(t) {
871
+ var n;
872
+ if (!this.has_pending_snippet()) {
873
+ this.parent && R(n = this.parent, F, Fn).call(n, t);
874
+ return;
875
+ }
876
+ T(this, Ve, c(this, Ve) + t), c(this, Ve) === 0 && (T(this, he, !1), c(this, se) && ct(c(this, se), () => {
877
+ T(this, se, null);
878
+ }), c(this, Me) && (c(this, pe).before(c(this, Me)), T(this, Me, null)));
879
+ };
880
+ function _o(e, t, n, r) {
881
+ const o = $n;
882
+ if (n.length === 0 && e.length === 0) {
883
+ r(t.map(o));
884
+ return;
885
+ }
886
+ var s = I, i = (
887
+ /** @type {Effect} */
888
+ P
889
+ ), a = bo();
890
+ function l() {
891
+ Promise.all(n.map((f) => /* @__PURE__ */ yo(f))).then((f) => {
892
+ a();
893
+ try {
894
+ r([...t.map(o), ...f]);
895
+ } catch (g) {
896
+ (i.f & Ye) === 0 && Lt(g, i);
897
+ }
898
+ s == null || s.deactivate(), bn();
899
+ }).catch((f) => {
900
+ Lt(f, i);
901
+ });
902
+ }
903
+ e.length > 0 ? Promise.all(e).then(() => {
904
+ a();
905
+ try {
906
+ return l();
907
+ } finally {
908
+ s == null || s.deactivate(), bn();
909
+ }
910
+ }) : l();
911
+ }
912
+ function bo() {
913
+ var e = P, t = q, n = G, r = I;
914
+ if (_)
915
+ var o = Wt;
916
+ return function(i = !0) {
917
+ xe(e), oe(t), Mt(n), i && (r == null || r.activate()), _ && _n(o);
918
+ };
919
+ }
920
+ function bn() {
921
+ xe(null), oe(null), Mt(null), _ && _n(null);
922
+ }
923
+ const wo = /* @__PURE__ */ new Set();
924
+ // @__NO_SIDE_EFFECTS__
925
+ function $n(e) {
926
+ var t = V | ae, n = q !== null && (q.f & V) !== 0 ? (
927
+ /** @type {Derived} */
928
+ q
929
+ ) : null;
930
+ return P !== null && (P.f |= Bt), {
931
+ ctx: G,
932
+ deps: null,
933
+ effects: null,
934
+ equals: Pr,
935
+ f: t,
936
+ fn: e,
937
+ reactions: null,
938
+ rv: 0,
939
+ v: (
940
+ /** @type {V} */
941
+ Y
942
+ ),
943
+ wv: 0,
944
+ parent: n ?? P,
945
+ ac: null
946
+ };
947
+ }
948
+ // @__NO_SIDE_EFFECTS__
949
+ function yo(e, t) {
950
+ let n = (
951
+ /** @type {Effect | null} */
952
+ P
953
+ );
954
+ n === null && Hs();
955
+ var r = (
956
+ /** @type {Boundary} */
957
+ n.b
958
+ ), o = (
959
+ /** @type {Promise<V>} */
960
+ /** @type {unknown} */
961
+ void 0
962
+ ), s = mt(
963
+ /** @type {V} */
964
+ Y
965
+ ), i = !q, a = /* @__PURE__ */ new Map();
966
+ return Lo(() => {
967
+ var v;
968
+ var l = Or();
969
+ o = l.promise;
970
+ try {
971
+ Promise.resolve(e()).then(l.resolve, l.reject).then(() => {
972
+ f === I && f.committed && f.deactivate(), bn();
973
+ });
974
+ } catch (d) {
975
+ l.reject(d), bn();
976
+ }
977
+ var f = (
978
+ /** @type {Batch} */
979
+ I
980
+ );
981
+ if (i) {
982
+ var g = !r.is_pending();
983
+ r.update_pending_count(1), f.increment(g), (v = a.get(f)) == null || v.reject(Ct), a.delete(f), a.set(f, l);
984
+ }
985
+ const h = (d, u = void 0) => {
986
+ if (f.activate(), u)
987
+ u !== Ct && (s.f |= We, Rt(s, u));
988
+ else {
989
+ (s.f & We) !== 0 && (s.f ^= We), Rt(s, d);
990
+ for (const [b, E] of a) {
991
+ if (a.delete(b), b === f) break;
992
+ E.reject(Ct);
993
+ }
994
+ }
995
+ i && (r.update_pending_count(-1), f.decrement(g));
996
+ };
997
+ l.promise.then(h, (d) => h(null, d || "unknown"));
998
+ }), Zr(() => {
999
+ for (const l of a.values())
1000
+ l.reject(Ct);
1001
+ }), _ && (s.f |= Cn), new Promise((l) => {
1002
+ function f(g) {
1003
+ function h() {
1004
+ g === o ? l(s) : f(o);
1005
+ }
1006
+ g.then(h, h);
1007
+ }
1008
+ f(o);
1009
+ });
1010
+ }
1011
+ // @__NO_SIDE_EFFECTS__
1012
+ function Ot(e) {
1013
+ const t = /* @__PURE__ */ $n(e);
1014
+ return as(t), t;
1015
+ }
1016
+ // @__NO_SIDE_EFFECTS__
1017
+ function xo(e) {
1018
+ const t = /* @__PURE__ */ $n(e);
1019
+ return t.equals = Ir, t;
1020
+ }
1021
+ function Hn(e) {
1022
+ var t = e.effects;
1023
+ if (t !== null) {
1024
+ e.effects = null;
1025
+ for (var n = 0; n < t.length; n += 1)
1026
+ ie(
1027
+ /** @type {Effect} */
1028
+ t[n]
1029
+ );
1030
+ }
1031
+ }
1032
+ let In = [];
1033
+ function ko(e) {
1034
+ for (var t = e.parent; t !== null; ) {
1035
+ if ((t.f & V) === 0)
1036
+ return (t.f & Ye) === 0 ? (
1037
+ /** @type {Effect} */
1038
+ t
1039
+ ) : null;
1040
+ t = t.parent;
1041
+ }
1042
+ return null;
1043
+ }
1044
+ function er(e) {
1045
+ var t, n = P;
1046
+ if (xe(ko(e)), _) {
1047
+ let r = Dt;
1048
+ dr(/* @__PURE__ */ new Set());
1049
+ try {
1050
+ In.includes(e) && Us(), In.push(e), e.f &= ~Xe, Hn(e), t = Un(e);
1051
+ } finally {
1052
+ xe(n), dr(r), In.pop();
1053
+ }
1054
+ } else
1055
+ try {
1056
+ e.f &= ~Xe, Hn(e), t = Un(e);
1057
+ } finally {
1058
+ xe(n);
1059
+ }
1060
+ return t;
1061
+ }
1062
+ function Ur(e) {
1063
+ var t = er(e);
1064
+ if (e.equals(t) || (I != null && I.is_fork || (e.v = t), e.wv = fs()), !Ft)
1065
+ if (B !== null)
1066
+ (Gt() || I != null && I.is_fork) && B.set(e, t);
1067
+ else {
1068
+ var n = (e.f & ke) === 0 ? ze : X;
1069
+ Q(e, n);
1070
+ }
1071
+ }
1072
+ let Dt = /* @__PURE__ */ new Set();
1073
+ const Ge = /* @__PURE__ */ new Map();
1074
+ function dr(e) {
1075
+ Dt = e;
1076
+ }
1077
+ let tr = !1;
1078
+ function jo() {
1079
+ tr = !0;
1080
+ }
1081
+ function mt(e, t) {
1082
+ var n = {
1083
+ f: 0,
1084
+ // TODO ideally we could skip this altogether, but it causes type errors
1085
+ v: e,
1086
+ reactions: null,
1087
+ equals: Pr,
1088
+ rv: 0,
1089
+ wv: 0
1090
+ };
1091
+ return n;
1092
+ }
1093
+ // @__NO_SIDE_EFFECTS__
1094
+ function W(e, t) {
1095
+ const n = mt(e);
1096
+ return as(n), n;
1097
+ }
1098
+ // @__NO_SIDE_EFFECTS__
1099
+ function Eo(e, t = !1, n = !0) {
1100
+ const r = mt(e);
1101
+ return t || (r.equals = Ir), r;
1102
+ }
1103
+ function N(e, t, n = !1) {
1104
+ q !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
1105
+ // to ensure we error if state is set inside an inspect effect
1106
+ (!qe || (q.f & mn) !== 0) && Mr() && (q.f & (V | Re | Cn | mn)) !== 0 && !(te != null && te.includes(e)) && Xs();
1107
+ let r = n ? nt(t) : t;
1108
+ return _ && Nr(
1109
+ r,
1110
+ /** @type {string} */
1111
+ e.label
1112
+ ), Rt(e, r);
1113
+ }
1114
+ function Rt(e, t) {
1115
+ var o;
1116
+ if (!e.equals(t)) {
1117
+ var n = e.v;
1118
+ Ft ? Ge.set(e, t) : Ge.set(e, n), e.v = t;
1119
+ var r = De.ensure();
1120
+ if (r.capture(e, n), _) {
1121
+ if (P !== null) {
1122
+ e.updated ?? (e.updated = /* @__PURE__ */ new Map());
1123
+ const s = (((o = e.updated.get("")) == null ? void 0 : o.count) ?? 0) + 1;
1124
+ if (e.updated.set("", { error: (
1125
+ /** @type {any} */
1126
+ null
1127
+ ), count: s }), s > 5) {
1128
+ const i = oo("updated at");
1129
+ if (i !== null) {
1130
+ let a = e.updated.get(i.stack);
1131
+ a || (a = { error: i, count: 0 }, e.updated.set(i.stack, a)), a.count++;
1132
+ }
1133
+ }
1134
+ }
1135
+ P !== null && (e.set_during_effect = !0);
1136
+ }
1137
+ (e.f & V) !== 0 && ((e.f & ae) !== 0 && er(
1138
+ /** @type {Derived} */
1139
+ e
1140
+ ), Q(e, (e.f & ke) !== 0 ? X : ze)), e.wv = fs(), Vr(e, ae), P !== null && (P.f & X) !== 0 && (P.f & (Be | _t)) === 0 && (ve === null ? Bo([e]) : ve.push(e)), !r.is_fork && Dt.size > 0 && !tr && Jr();
1141
+ }
1142
+ return t;
1143
+ }
1144
+ function Jr() {
1145
+ tr = !1;
1146
+ var e = ut;
1147
+ wn(!0);
1148
+ const t = Array.from(Dt);
1149
+ try {
1150
+ for (const n of t)
1151
+ (n.f & X) !== 0 && Q(n, ze), ln(n) && Xt(n);
1152
+ } finally {
1153
+ wn(e);
1154
+ }
1155
+ Dt.clear();
1156
+ }
1157
+ function To(e, t = 1) {
1158
+ var n = p(e), r = t === 1 ? n++ : n--;
1159
+ return N(e, n), r;
1160
+ }
1161
+ function Kt(e) {
1162
+ N(e, e.v + 1);
1163
+ }
1164
+ function Vr(e, t) {
1165
+ var n = e.reactions;
1166
+ if (n !== null)
1167
+ for (var r = n.length, o = 0; o < r; o++) {
1168
+ var s = n[o], i = s.f;
1169
+ if (_ && (i & mn) !== 0) {
1170
+ Dt.add(s);
1171
+ continue;
1172
+ }
1173
+ var a = (i & ae) === 0;
1174
+ if (a && Q(s, t), (i & V) !== 0) {
1175
+ var l = (
1176
+ /** @type {Derived} */
1177
+ s
1178
+ );
1179
+ B == null || B.delete(l), (i & Xe) === 0 && (i & ke && (s.f |= Xe), Vr(l, ze));
1180
+ } else a && ((i & Re) !== 0 && we !== null && we.add(
1181
+ /** @type {Effect} */
1182
+ s
1183
+ ), gt(
1184
+ /** @type {Effect} */
1185
+ s
1186
+ ));
1187
+ }
1188
+ }
1189
+ const Co = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
1190
+ function nt(e) {
1191
+ if (typeof e != "object" || e === null || ft in e)
1192
+ return e;
1193
+ const t = Ar(e);
1194
+ if (t !== Ms && t !== Ls)
1195
+ return e;
1196
+ var n = /* @__PURE__ */ new Map(), r = Wn(e), o = /* @__PURE__ */ W(0), s = dt, i = (g) => {
1197
+ if (dt === s)
1198
+ return g();
1199
+ var h = q, v = dt;
1200
+ oe(null), pr(s);
1201
+ var d = g();
1202
+ return oe(h), pr(v), d;
1203
+ };
1204
+ r && (n.set("length", /* @__PURE__ */ W(
1205
+ /** @type {any[]} */
1206
+ e.length
1207
+ )), _ && (e = /** @type {any} */
1208
+ Oo(
1209
+ /** @type {any[]} */
1210
+ e
1211
+ )));
1212
+ var a = "";
1213
+ let l = !1;
1214
+ function f(g) {
1215
+ if (!l) {
1216
+ l = !0, a = g, Ee(o, `${a} version`);
1217
+ for (const [h, v] of n)
1218
+ Ee(v, tt(a, h));
1219
+ l = !1;
1220
+ }
1221
+ }
1222
+ return new Proxy(
1223
+ /** @type {any} */
1224
+ e,
1225
+ {
1226
+ defineProperty(g, h, v) {
1227
+ (!("value" in v) || v.configurable === !1 || v.enumerable === !1 || v.writable === !1) && Gs();
1228
+ var d = n.get(h);
1229
+ return d === void 0 ? d = i(() => {
1230
+ var u = /* @__PURE__ */ W(v.value);
1231
+ return n.set(h, u), _ && typeof h == "string" && Ee(u, tt(a, h)), u;
1232
+ }) : N(d, v.value, !0), !0;
1233
+ },
1234
+ deleteProperty(g, h) {
1235
+ var v = n.get(h);
1236
+ if (v === void 0) {
1237
+ if (h in g) {
1238
+ const d = i(() => /* @__PURE__ */ W(Y));
1239
+ n.set(h, d), Kt(o), _ && Ee(d, tt(a, h));
1240
+ }
1241
+ } else
1242
+ N(v, Y), Kt(o);
1243
+ return !0;
1244
+ },
1245
+ get(g, h, v) {
1246
+ var E;
1247
+ if (h === ft)
1248
+ return e;
1249
+ if (_ && h === zr)
1250
+ return f;
1251
+ var d = n.get(h), u = h in g;
1252
+ if (d === void 0 && (!u || (E = At(g, h)) != null && E.writable) && (d = i(() => {
1253
+ var A = nt(u ? g[h] : Y), k = /* @__PURE__ */ W(A);
1254
+ return _ && Ee(k, tt(a, h)), k;
1255
+ }), n.set(h, d)), d !== void 0) {
1256
+ var b = p(d);
1257
+ return b === Y ? void 0 : b;
1258
+ }
1259
+ return Reflect.get(g, h, v);
1260
+ },
1261
+ getOwnPropertyDescriptor(g, h) {
1262
+ var v = Reflect.getOwnPropertyDescriptor(g, h);
1263
+ if (v && "value" in v) {
1264
+ var d = n.get(h);
1265
+ d && (v.value = p(d));
1266
+ } else if (v === void 0) {
1267
+ var u = n.get(h), b = u == null ? void 0 : u.v;
1268
+ if (u !== void 0 && b !== Y)
1269
+ return {
1270
+ enumerable: !0,
1271
+ configurable: !0,
1272
+ value: b,
1273
+ writable: !0
1274
+ };
1275
+ }
1276
+ return v;
1277
+ },
1278
+ has(g, h) {
1279
+ var b;
1280
+ if (h === ft)
1281
+ return !0;
1282
+ var v = n.get(h), d = v !== void 0 && v.v !== Y || Reflect.has(g, h);
1283
+ if (v !== void 0 || P !== null && (!d || (b = At(g, h)) != null && b.writable)) {
1284
+ v === void 0 && (v = i(() => {
1285
+ var E = d ? nt(g[h]) : Y, A = /* @__PURE__ */ W(E);
1286
+ return _ && Ee(A, tt(a, h)), A;
1287
+ }), n.set(h, v));
1288
+ var u = p(v);
1289
+ if (u === Y)
1290
+ return !1;
1291
+ }
1292
+ return d;
1293
+ },
1294
+ set(g, h, v, d) {
1295
+ var j;
1296
+ var u = n.get(h), b = h in g;
1297
+ if (r && h === "length")
1298
+ for (var E = v; E < /** @type {Source<number>} */
1299
+ u.v; E += 1) {
1300
+ var A = n.get(E + "");
1301
+ A !== void 0 ? N(A, Y) : E in g && (A = i(() => /* @__PURE__ */ W(Y)), n.set(E + "", A), _ && Ee(A, tt(a, E)));
1302
+ }
1303
+ if (u === void 0)
1304
+ (!b || (j = At(g, h)) != null && j.writable) && (u = i(() => /* @__PURE__ */ W(void 0)), _ && Ee(u, tt(a, h)), N(u, nt(v)), n.set(h, u));
1305
+ else {
1306
+ b = u.v !== Y;
1307
+ var k = i(() => nt(v));
1308
+ N(u, k);
1309
+ }
1310
+ var x = Reflect.getOwnPropertyDescriptor(g, h);
1311
+ if (x != null && x.set && x.set.call(d, v), !b) {
1312
+ if (r && typeof h == "string") {
1313
+ var O = (
1314
+ /** @type {Source<number>} */
1315
+ n.get("length")
1316
+ ), w = Number(h);
1317
+ Number.isInteger(w) && w >= O.v && N(O, w + 1);
1318
+ }
1319
+ Kt(o);
1320
+ }
1321
+ return !0;
1322
+ },
1323
+ ownKeys(g) {
1324
+ p(o);
1325
+ var h = Reflect.ownKeys(g).filter((u) => {
1326
+ var b = n.get(u);
1327
+ return b === void 0 || b.v !== Y;
1328
+ });
1329
+ for (var [v, d] of n)
1330
+ d.v !== Y && !(v in g) && h.push(v);
1331
+ return h;
1332
+ },
1333
+ setPrototypeOf() {
1334
+ Zs();
1335
+ }
1336
+ }
1337
+ );
1338
+ }
1339
+ function tt(e, t) {
1340
+ return typeof t == "symbol" ? `${e}[Symbol(${t.description ?? ""})]` : Co.test(t) ? `${e}.${t}` : /^\d+$/.test(t) ? `${e}[${t}]` : `${e}['${t}']`;
1341
+ }
1342
+ function Yt(e) {
1343
+ try {
1344
+ if (e !== null && typeof e == "object" && ft in e)
1345
+ return e[ft];
1346
+ } catch {
1347
+ }
1348
+ return e;
1349
+ }
1350
+ function So(e, t) {
1351
+ return Object.is(Yt(e), Yt(t));
1352
+ }
1353
+ const Ao = /* @__PURE__ */ new Set([
1354
+ "copyWithin",
1355
+ "fill",
1356
+ "pop",
1357
+ "push",
1358
+ "reverse",
1359
+ "shift",
1360
+ "sort",
1361
+ "splice",
1362
+ "unshift"
1363
+ ]);
1364
+ function Oo(e) {
1365
+ return new Proxy(e, {
1366
+ get(t, n, r) {
1367
+ var o = Reflect.get(t, n, r);
1368
+ return Ao.has(
1369
+ /** @type {string} */
1370
+ n
1371
+ ) ? function(...s) {
1372
+ jo();
1373
+ var i = o.apply(this, s);
1374
+ return Jr(), i;
1375
+ } : o;
1376
+ }
1377
+ });
1378
+ }
1379
+ function qo() {
1380
+ const e = Array.prototype, t = Array.__svelte_cleanup;
1381
+ t && t();
1382
+ const { indexOf: n, lastIndexOf: r, includes: o } = e;
1383
+ e.indexOf = function(s, i) {
1384
+ const a = n.call(this, s, i);
1385
+ if (a === -1) {
1386
+ for (let l = i ?? 0; l < this.length; l += 1)
1387
+ if (Yt(this[l]) === s) {
1388
+ Pn("array.indexOf(...)");
1389
+ break;
1390
+ }
1391
+ }
1392
+ return a;
1393
+ }, e.lastIndexOf = function(s, i) {
1394
+ const a = r.call(this, s, i ?? this.length - 1);
1395
+ if (a === -1) {
1396
+ for (let l = 0; l <= (i ?? this.length - 1); l += 1)
1397
+ if (Yt(this[l]) === s) {
1398
+ Pn("array.lastIndexOf(...)");
1399
+ break;
1400
+ }
1401
+ }
1402
+ return a;
1403
+ }, e.includes = function(s, i) {
1404
+ const a = o.call(this, s, i);
1405
+ if (!a) {
1406
+ for (let l = 0; l < this.length; l += 1)
1407
+ if (Yt(this[l]) === s) {
1408
+ Pn("array.includes(...)");
1409
+ break;
1410
+ }
1411
+ }
1412
+ return a;
1413
+ }, Array.__svelte_cleanup = () => {
1414
+ e.indexOf = n, e.lastIndexOf = r, e.includes = o;
1415
+ };
1416
+ }
1417
+ var vr, nr, Kr, Yr;
1418
+ function zo() {
1419
+ if (vr === void 0) {
1420
+ vr = window, nr = /Firefox/.test(navigator.userAgent);
1421
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
1422
+ Kr = At(t, "firstChild").get, Yr = At(t, "nextSibling").get, fr(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), fr(n) && (n.__t = void 0), _ && (e.__svelte_meta = null, qo());
1423
+ }
1424
+ }
1425
+ function Ze(e = "") {
1426
+ return document.createTextNode(e);
1427
+ }
1428
+ // @__NO_SIDE_EFFECTS__
1429
+ function rr(e) {
1430
+ return (
1431
+ /** @type {TemplateNode | null} */
1432
+ Kr.call(e)
1433
+ );
1434
+ }
1435
+ // @__NO_SIDE_EFFECTS__
1436
+ function an(e) {
1437
+ return (
1438
+ /** @type {TemplateNode | null} */
1439
+ Yr.call(e)
1440
+ );
1441
+ }
1442
+ function m(e, t) {
1443
+ return /* @__PURE__ */ rr(e);
1444
+ }
1445
+ function un(e, t = !1) {
1446
+ {
1447
+ var n = /* @__PURE__ */ rr(e);
1448
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ an(n) : n;
1449
+ }
1450
+ }
1451
+ function C(e, t = 1, n = !1) {
1452
+ let r = e;
1453
+ for (; t--; )
1454
+ r = /** @type {TemplateNode} */
1455
+ /* @__PURE__ */ an(r);
1456
+ return r;
1457
+ }
1458
+ function Po(e) {
1459
+ e.textContent = "";
1460
+ }
1461
+ function Wr() {
1462
+ return !1;
1463
+ }
1464
+ function Gr(e) {
1465
+ var t = q, n = P;
1466
+ oe(null), xe(null);
1467
+ try {
1468
+ return e();
1469
+ } finally {
1470
+ oe(t), xe(n);
1471
+ }
1472
+ }
1473
+ function Io(e) {
1474
+ P === null && (q === null && Ks(e), Vs()), Ft && Js(e);
1475
+ }
1476
+ function No(e, t) {
1477
+ var n = t.last;
1478
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1479
+ }
1480
+ function Fe(e, t, n) {
1481
+ var r = P;
1482
+ if (_)
1483
+ for (; r !== null && (r.f & mn) !== 0; )
1484
+ r = r.parent;
1485
+ r !== null && (r.f & ce) !== 0 && (e |= ce);
1486
+ var o = {
1487
+ ctx: G,
1488
+ deps: null,
1489
+ nodes: null,
1490
+ f: e | ae | ke,
1491
+ first: null,
1492
+ fn: t,
1493
+ last: null,
1494
+ next: null,
1495
+ parent: r,
1496
+ b: r && r.b,
1497
+ prev: null,
1498
+ teardown: null,
1499
+ wv: 0,
1500
+ ac: null
1501
+ };
1502
+ if (_ && (o.component_function = on), n)
1503
+ try {
1504
+ Xt(o), o.f |= Xn;
1505
+ } catch (a) {
1506
+ throw ie(o), a;
1507
+ }
1508
+ else t !== null && gt(o);
1509
+ var s = o;
1510
+ if (n && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
1511
+ (s.f & Bt) === 0 && (s = s.first, (e & Re) !== 0 && (e & Nt) !== 0 && s !== null && (s.f |= Nt)), s !== null && (s.parent = r, r !== null && No(s, r), q !== null && (q.f & V) !== 0 && (e & _t) === 0)) {
1512
+ var i = (
1513
+ /** @type {Derived} */
1514
+ q
1515
+ );
1516
+ (i.effects ?? (i.effects = [])).push(s);
1517
+ }
1518
+ return o;
1519
+ }
1520
+ function Gt() {
1521
+ return q !== null && !qe;
1522
+ }
1523
+ function Zr(e) {
1524
+ const t = Fe(Zn, null, !1);
1525
+ return Q(t, X), t.teardown = e, t;
1526
+ }
1527
+ function Xr(e) {
1528
+ Io("$effect"), _ && pt(e, "name", {
1529
+ value: "$effect"
1530
+ });
1531
+ var t = (
1532
+ /** @type {Effect} */
1533
+ P.f
1534
+ ), n = !q && (t & Be) !== 0 && (t & Xn) === 0;
1535
+ if (n) {
1536
+ var r = (
1537
+ /** @type {ComponentContext} */
1538
+ G
1539
+ );
1540
+ (r.e ?? (r.e = [])).push(e);
1541
+ } else
1542
+ return Qr(e);
1543
+ }
1544
+ function Qr(e) {
1545
+ return Fe(Gn | Fs, e, !1);
1546
+ }
1547
+ function Mo(e) {
1548
+ De.ensure();
1549
+ const t = Fe(_t | Bt, e, !0);
1550
+ return (n = {}) => new Promise((r) => {
1551
+ n.outro ? ct(t, () => {
1552
+ ie(t), r(void 0);
1553
+ }) : (ie(t), r(void 0));
1554
+ });
1555
+ }
1556
+ function $r(e) {
1557
+ return Fe(Gn, e, !1);
1558
+ }
1559
+ function Lo(e) {
1560
+ return Fe(Cn | Bt, e, !0);
1561
+ }
1562
+ function es(e, t = 0) {
1563
+ return Fe(Zn | t, e, !0);
1564
+ }
1565
+ function Z(e, t = [], n = [], r = []) {
1566
+ _o(r, t, n, (o) => {
1567
+ Fe(Zn, () => e(...o.map(p)), !0);
1568
+ });
1569
+ }
1570
+ function sr(e, t = 0) {
1571
+ var n = Fe(Re | t, e, !0);
1572
+ return _ && (n.dev_stack = Wt), n;
1573
+ }
1574
+ function me(e) {
1575
+ return Fe(Be | Bt, e, !0);
1576
+ }
1577
+ function ts(e) {
1578
+ var t = e.teardown;
1579
+ if (t !== null) {
1580
+ const n = Ft, r = q;
1581
+ hr(!0), oe(null);
1582
+ try {
1583
+ t.call(null);
1584
+ } finally {
1585
+ hr(n), oe(r);
1586
+ }
1587
+ }
1588
+ }
1589
+ function ns(e, t = !1) {
1590
+ var n = e.first;
1591
+ for (e.first = e.last = null; n !== null; ) {
1592
+ const o = n.ac;
1593
+ o !== null && Gr(() => {
1594
+ o.abort(Ct);
1595
+ });
1596
+ var r = n.next;
1597
+ (n.f & _t) !== 0 ? n.parent = null : ie(n, t), n = r;
1598
+ }
1599
+ }
1600
+ function Do(e) {
1601
+ for (var t = e.first; t !== null; ) {
1602
+ var n = t.next;
1603
+ (t.f & Be) === 0 && ie(t), t = n;
1604
+ }
1605
+ }
1606
+ function ie(e, t = !0) {
1607
+ var n = !1;
1608
+ (t || (e.f & qr) !== 0) && e.nodes !== null && e.nodes.end !== null && (Ro(
1609
+ e.nodes.start,
1610
+ /** @type {TemplateNode} */
1611
+ e.nodes.end
1612
+ ), n = !0), ns(e, t && !n), yn(e, 0), Q(e, Ye);
1613
+ var r = e.nodes && e.nodes.t;
1614
+ if (r !== null)
1615
+ for (const s of r)
1616
+ s.stop();
1617
+ ts(e);
1618
+ var o = e.parent;
1619
+ o !== null && o.first !== null && rs(e), _ && (e.component_function = null), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1620
+ }
1621
+ function Ro(e, t) {
1622
+ for (; e !== null; ) {
1623
+ var n = e === t ? null : /* @__PURE__ */ an(e);
1624
+ e.remove(), e = n;
1625
+ }
1626
+ }
1627
+ function rs(e) {
1628
+ var t = e.parent, n = e.prev, r = e.next;
1629
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
1630
+ }
1631
+ function ct(e, t, n = !0) {
1632
+ var r = [];
1633
+ ss(e, r, !0);
1634
+ var o = () => {
1635
+ n && ie(e), t && t();
1636
+ }, s = r.length;
1637
+ if (s > 0) {
1638
+ var i = () => --s || o();
1639
+ for (var a of r)
1640
+ a.out(i);
1641
+ } else
1642
+ o();
1643
+ }
1644
+ function ss(e, t, n) {
1645
+ if ((e.f & ce) === 0) {
1646
+ e.f ^= ce;
1647
+ var r = e.nodes && e.nodes.t;
1648
+ if (r !== null)
1649
+ for (const a of r)
1650
+ (a.is_global || n) && t.push(a);
1651
+ for (var o = e.first; o !== null; ) {
1652
+ var s = o.next, i = (o.f & Nt) !== 0 || // If this is a branch effect without a block effect parent,
1653
+ // it means the parent block effect was pruned. In that case,
1654
+ // transparency information was transferred to the branch effect.
1655
+ (o.f & Be) !== 0 && (e.f & Re) !== 0;
1656
+ ss(o, t, i ? n : !1), o = s;
1657
+ }
1658
+ }
1659
+ }
1660
+ function or(e) {
1661
+ os(e, !0);
1662
+ }
1663
+ function os(e, t) {
1664
+ if ((e.f & ce) !== 0) {
1665
+ e.f ^= ce, (e.f & X) === 0 && (Q(e, ae), gt(e));
1666
+ for (var n = e.first; n !== null; ) {
1667
+ var r = n.next, o = (n.f & Nt) !== 0 || (n.f & Be) !== 0;
1668
+ os(n, o ? t : !1), n = r;
1669
+ }
1670
+ var s = e.nodes && e.nodes.t;
1671
+ if (s !== null)
1672
+ for (const i of s)
1673
+ (i.is_global || t) && i.in();
1674
+ }
1675
+ }
1676
+ function is(e, t) {
1677
+ if (e.nodes)
1678
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
1679
+ var o = n === r ? null : /* @__PURE__ */ an(n);
1680
+ t.append(n), n = o;
1681
+ }
1682
+ }
1683
+ let ut = !1;
1684
+ function wn(e) {
1685
+ ut = e;
1686
+ }
1687
+ let Ft = !1;
1688
+ function hr(e) {
1689
+ Ft = e;
1690
+ }
1691
+ let q = null, qe = !1;
1692
+ function oe(e) {
1693
+ q = e;
1694
+ }
1695
+ let P = null;
1696
+ function xe(e) {
1697
+ P = e;
1698
+ }
1699
+ let te = null;
1700
+ function as(e) {
1701
+ q !== null && (te === null ? te = [e] : te.push(e));
1702
+ }
1703
+ let ee = null, le = 0, ve = null;
1704
+ function Bo(e) {
1705
+ ve = e;
1706
+ }
1707
+ let ls = 1, Zt = 0, dt = Zt;
1708
+ function pr(e) {
1709
+ dt = e;
1710
+ }
1711
+ function fs() {
1712
+ return ++ls;
1713
+ }
1714
+ function ln(e) {
1715
+ var t = e.f;
1716
+ if ((t & ae) !== 0)
1717
+ return !0;
1718
+ if (t & V && (e.f &= ~Xe), (t & ze) !== 0) {
1719
+ var n = e.deps;
1720
+ if (n !== null)
1721
+ for (var r = n.length, o = 0; o < r; o++) {
1722
+ var s = n[o];
1723
+ if (ln(
1724
+ /** @type {Derived} */
1725
+ s
1726
+ ) && Ur(
1727
+ /** @type {Derived} */
1728
+ s
1729
+ ), s.wv > e.wv)
1730
+ return !0;
1731
+ }
1732
+ (t & ke) !== 0 && // During time traveling we don't want to reset the status so that
1733
+ // traversal of the graph in the other batches still happens
1734
+ B === null && Q(e, X);
1735
+ }
1736
+ return !1;
1737
+ }
1738
+ function cs(e, t, n = !0) {
1739
+ var r = e.reactions;
1740
+ if (r !== null && !(te != null && te.includes(e)))
1741
+ for (var o = 0; o < r.length; o++) {
1742
+ var s = r[o];
1743
+ (s.f & V) !== 0 ? cs(
1744
+ /** @type {Derived} */
1745
+ s,
1746
+ t,
1747
+ !1
1748
+ ) : t === s && (n ? Q(s, ae) : (s.f & X) !== 0 && Q(s, ze), gt(
1749
+ /** @type {Effect} */
1750
+ s
1751
+ ));
1752
+ }
1753
+ }
1754
+ function Un(e) {
1755
+ var u;
1756
+ var t = ee, n = le, r = ve, o = q, s = te, i = G, a = qe, l = dt, f = e.f;
1757
+ ee = /** @type {null | Value[]} */
1758
+ null, le = 0, ve = null, q = (f & (Be | _t)) === 0 ? e : null, te = null, Mt(e.ctx), qe = !1, dt = ++Zt, e.ac !== null && (Gr(() => {
1759
+ e.ac.abort(Ct);
1760
+ }), e.ac = null);
1761
+ try {
1762
+ e.f |= Nn;
1763
+ var g = (
1764
+ /** @type {Function} */
1765
+ e.fn
1766
+ ), h = g(), v = e.deps;
1767
+ if (ee !== null) {
1768
+ var d;
1769
+ if (yn(e, le), v !== null && le > 0)
1770
+ for (v.length = le + ee.length, d = 0; d < ee.length; d++)
1771
+ v[le + d] = ee[d];
1772
+ else
1773
+ e.deps = v = ee;
1774
+ if (Gt() && (e.f & ke) !== 0)
1775
+ for (d = le; d < v.length; d++)
1776
+ ((u = v[d]).reactions ?? (u.reactions = [])).push(e);
1777
+ } else v !== null && le < v.length && (yn(e, le), v.length = le);
1778
+ if (Mr() && ve !== null && !qe && v !== null && (e.f & (V | ze | ae)) === 0)
1779
+ for (d = 0; d < /** @type {Source[]} */
1780
+ ve.length; d++)
1781
+ cs(
1782
+ ve[d],
1783
+ /** @type {Effect} */
1784
+ e
1785
+ );
1786
+ return o !== null && o !== e && (Zt++, ve !== null && (r === null ? r = ve : r.push(.../** @type {Source[]} */
1787
+ ve))), (e.f & We) !== 0 && (e.f ^= We), h;
1788
+ } catch (b) {
1789
+ return Lr(b);
1790
+ } finally {
1791
+ e.f ^= Nn, ee = t, le = n, ve = r, q = o, te = s, Mt(i), qe = a, dt = l;
1792
+ }
1793
+ }
1794
+ function Fo(e, t) {
1795
+ let n = t.reactions;
1796
+ if (n !== null) {
1797
+ var r = Is.call(n, e);
1798
+ if (r !== -1) {
1799
+ var o = n.length - 1;
1800
+ o === 0 ? n = t.reactions = null : (n[r] = n[o], n.pop());
1801
+ }
1802
+ }
1803
+ n === null && (t.f & V) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1804
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1805
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1806
+ (ee === null || !ee.includes(t)) && (Q(t, ze), (t.f & ke) !== 0 && (t.f ^= ke, t.f &= ~Xe), Hn(
1807
+ /** @type {Derived} **/
1808
+ t
1809
+ ), yn(
1810
+ /** @type {Derived} **/
1811
+ t,
1812
+ 0
1813
+ ));
1814
+ }
1815
+ function yn(e, t) {
1816
+ var n = e.deps;
1817
+ if (n !== null)
1818
+ for (var r = t; r < n.length; r++)
1819
+ Fo(e, n[r]);
1820
+ }
1821
+ function Xt(e) {
1822
+ var t = e.f;
1823
+ if ((t & Ye) === 0) {
1824
+ Q(e, X);
1825
+ var n = P, r = ut;
1826
+ if (P = e, ut = !0, _) {
1827
+ var o = on;
1828
+ cr(e.component_function);
1829
+ var s = (
1830
+ /** @type {any} */
1831
+ Wt
1832
+ );
1833
+ _n(e.dev_stack ?? Wt);
1834
+ }
1835
+ try {
1836
+ (t & (Re | Bs)) !== 0 ? Do(e) : ns(e), ts(e);
1837
+ var i = Un(e);
1838
+ e.teardown = typeof i == "function" ? i : null, e.wv = ls;
1839
+ var a;
1840
+ _ && so && (e.f & ae) !== 0 && e.deps;
1841
+ } finally {
1842
+ ut = r, P = n, _ && (cr(o), _n(s));
1843
+ }
1844
+ }
1845
+ }
1846
+ function p(e) {
1847
+ var t = e.f, n = (t & V) !== 0;
1848
+ if (q !== null && !qe) {
1849
+ var r = P !== null && (P.f & Ye) !== 0;
1850
+ if (!r && !(te != null && te.includes(e))) {
1851
+ var o = q.deps;
1852
+ if ((q.f & Nn) !== 0)
1853
+ e.rv < Zt && (e.rv = Zt, ee === null && o !== null && o[le] === e ? le++ : ee === null ? ee = [e] : ee.includes(e) || ee.push(e));
1854
+ else {
1855
+ (q.deps ?? (q.deps = [])).push(e);
1856
+ var s = e.reactions;
1857
+ s === null ? e.reactions = [q] : s.includes(q) || s.push(q);
1858
+ }
1859
+ }
1860
+ }
1861
+ if (_ && wo.delete(e), Ft) {
1862
+ if (Ge.has(e))
1863
+ return Ge.get(e);
1864
+ if (n) {
1865
+ var i = (
1866
+ /** @type {Derived} */
1867
+ e
1868
+ ), a = i.v;
1869
+ return ((i.f & X) === 0 && i.reactions !== null || ds(i)) && (a = er(i)), Ge.set(i, a), a;
1870
+ }
1871
+ } else n && (!(B != null && B.has(e)) || I != null && I.is_fork && !Gt()) && (i = /** @type {Derived} */
1872
+ e, ln(i) && Ur(i), ut && Gt() && (i.f & ke) === 0 && us(i));
1873
+ if (B != null && B.has(e))
1874
+ return B.get(e);
1875
+ if ((e.f & We) !== 0)
1876
+ throw e.v;
1877
+ return e.v;
1878
+ }
1879
+ function us(e) {
1880
+ if (e.deps !== null) {
1881
+ e.f ^= ke;
1882
+ for (const t of e.deps)
1883
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & V) !== 0 && (t.f & ke) === 0 && us(
1884
+ /** @type {Derived} */
1885
+ t
1886
+ );
1887
+ }
1888
+ }
1889
+ function ds(e) {
1890
+ if (e.v === Y) return !0;
1891
+ if (e.deps === null) return !1;
1892
+ for (const t of e.deps)
1893
+ if (Ge.has(t) || (t.f & V) !== 0 && ds(
1894
+ /** @type {Derived} */
1895
+ t
1896
+ ))
1897
+ return !0;
1898
+ return !1;
1899
+ }
1900
+ function vs(e) {
1901
+ var t = qe;
1902
+ try {
1903
+ return qe = !0, e();
1904
+ } finally {
1905
+ qe = t;
1906
+ }
1907
+ }
1908
+ const Ho = -7169;
1909
+ function Q(e, t) {
1910
+ e.f = e.f & Ho | t;
1911
+ }
1912
+ const hs = /* @__PURE__ */ new Set(), Jn = /* @__PURE__ */ new Set();
1913
+ function fn(e) {
1914
+ for (var t = 0; t < e.length; t++)
1915
+ hs.add(e[t]);
1916
+ for (var n of Jn)
1917
+ n(e);
1918
+ }
1919
+ let gr = null;
1920
+ function dn(e) {
1921
+ var E;
1922
+ var t = this, n = (
1923
+ /** @type {Node} */
1924
+ t.ownerDocument
1925
+ ), r = e.type, o = ((E = e.composedPath) == null ? void 0 : E.call(e)) || [], s = (
1926
+ /** @type {null | Element} */
1927
+ o[0] || e.target
1928
+ );
1929
+ gr = e;
1930
+ var i = 0, a = gr === e && e.__root;
1931
+ if (a) {
1932
+ var l = o.indexOf(a);
1933
+ if (l !== -1 && (t === document || t === /** @type {any} */
1934
+ window)) {
1935
+ e.__root = t;
1936
+ return;
1937
+ }
1938
+ var f = o.indexOf(t);
1939
+ if (f === -1)
1940
+ return;
1941
+ l <= f && (i = l);
1942
+ }
1943
+ if (s = /** @type {Element} */
1944
+ o[i] || e.target, s !== t) {
1945
+ pt(e, "currentTarget", {
1946
+ configurable: !0,
1947
+ get() {
1948
+ return s || n;
1949
+ }
1950
+ });
1951
+ var g = q, h = P;
1952
+ oe(null), xe(null);
1953
+ try {
1954
+ for (var v, d = []; s !== null; ) {
1955
+ var u = s.assignedSlot || s.parentNode || /** @type {any} */
1956
+ s.host || null;
1957
+ try {
1958
+ var b = s["__" + r];
1959
+ b != null && (!/** @type {any} */
1960
+ s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1961
+ // -> the target could not have been disabled because it emits the event in the first place
1962
+ e.target === s) && b.call(s, e);
1963
+ } catch (A) {
1964
+ v ? d.push(A) : v = A;
1965
+ }
1966
+ if (e.cancelBubble || u === t || u === null)
1967
+ break;
1968
+ s = u;
1969
+ }
1970
+ if (v) {
1971
+ for (let A of d)
1972
+ queueMicrotask(() => {
1973
+ throw A;
1974
+ });
1975
+ throw v;
1976
+ }
1977
+ } finally {
1978
+ e.__root = t, delete e.currentTarget, oe(g), xe(h);
1979
+ }
1980
+ }
1981
+ }
1982
+ function Uo(e) {
1983
+ var t = document.createElement("template");
1984
+ return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1985
+ }
1986
+ function ps(e, t) {
1987
+ var n = (
1988
+ /** @type {Effect} */
1989
+ P
1990
+ );
1991
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1992
+ }
1993
+ // @__NO_SIDE_EFFECTS__
1994
+ function H(e, t) {
1995
+ var n = (t & 2) !== 0, r, o = !e.startsWith("<!>");
1996
+ return () => {
1997
+ r === void 0 && (r = Uo(o ? e : "<!>" + e), r = /** @type {TemplateNode} */
1998
+ /* @__PURE__ */ rr(r));
1999
+ var s = (
2000
+ /** @type {TemplateNode} */
2001
+ n || nr ? document.importNode(r, !0) : r.cloneNode(!0)
2002
+ );
2003
+ return ps(s, s), s;
2004
+ };
2005
+ }
2006
+ function vn() {
2007
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = Ze();
2008
+ return e.append(t, n), ps(t, n), e;
2009
+ }
2010
+ function D(e, t) {
2011
+ e !== null && e.before(
2012
+ /** @type {Node} */
2013
+ t
2014
+ );
2015
+ }
2016
+ const Jo = ["touchstart", "touchmove"];
2017
+ function Vo(e) {
2018
+ return Jo.includes(e);
2019
+ }
2020
+ function S(e, t) {
2021
+ var n = t == null ? "" : typeof t == "object" ? t + "" : t;
2022
+ n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n + "");
2023
+ }
2024
+ function Ko(e, t) {
2025
+ return Yo(e, t);
2026
+ }
2027
+ const Et = /* @__PURE__ */ new Map();
2028
+ function Yo(e, { target: t, anchor: n, props: r = {}, events: o, context: s, intro: i = !0 }) {
2029
+ zo();
2030
+ var a = /* @__PURE__ */ new Set(), l = (h) => {
2031
+ for (var v = 0; v < h.length; v++) {
2032
+ var d = h[v];
2033
+ if (!a.has(d)) {
2034
+ a.add(d);
2035
+ var u = Vo(d);
2036
+ t.addEventListener(d, dn, { passive: u });
2037
+ var b = Et.get(d);
2038
+ b === void 0 ? (document.addEventListener(d, dn, { passive: u }), Et.set(d, 1)) : Et.set(d, b + 1);
2039
+ }
2040
+ }
2041
+ };
2042
+ l(En(hs)), Jn.add(l);
2043
+ var f = void 0, g = Mo(() => {
2044
+ var h = n ?? t.appendChild(Ze());
2045
+ return ho(
2046
+ /** @type {TemplateNode} */
2047
+ h,
2048
+ {
2049
+ pending: () => {
2050
+ }
2051
+ },
2052
+ (v) => {
2053
+ if (s) {
2054
+ Qe({});
2055
+ var d = (
2056
+ /** @type {ComponentContext} */
2057
+ G
2058
+ );
2059
+ d.c = s;
2060
+ }
2061
+ o && (r.$$events = o), f = e(v, r) || {}, s && $e();
2062
+ }
2063
+ ), () => {
2064
+ var u;
2065
+ for (var v of a) {
2066
+ t.removeEventListener(v, dn);
2067
+ var d = (
2068
+ /** @type {number} */
2069
+ Et.get(v)
2070
+ );
2071
+ --d === 0 ? (document.removeEventListener(v, dn), Et.delete(v)) : Et.set(v, d);
2072
+ }
2073
+ Jn.delete(l), h !== n && ((u = h.parentNode) == null || u.removeChild(h));
2074
+ };
2075
+ });
2076
+ return Vn.set(f, g), f;
9
2077
  }
10
-
11
- .incremark-devtools.bottom-right { bottom: 20px; right: 20px; }
12
- .incremark-devtools.bottom-left { bottom: 20px; left: 20px; }
13
- .incremark-devtools.top-right { top: 20px; right: 20px; }
14
- .incremark-devtools.top-left { top: 20px; left: 20px; }
15
-
16
- .incremark-devtools * {
17
- box-sizing: border-box;
18
- margin: 0;
19
- padding: 0;
2078
+ let Vn = /* @__PURE__ */ new WeakMap();
2079
+ function Wo(e, t) {
2080
+ const n = Vn.get(e);
2081
+ return n ? (Vn.delete(e), n(t)) : (_ && (ft in e ? to() : $s()), Promise.resolve());
20
2082
  }
21
-
22
- .devtools-trigger {
23
- width: 48px;
24
- height: 48px;
25
- border-radius: 50%;
26
- border: none;
27
- background: #1e1e1e;
28
- color: white;
29
- cursor: pointer;
30
- display: flex;
31
- align-items: center;
32
- justify-content: center;
33
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
34
- position: relative;
35
- font-size: 20px;
2083
+ var ye, Oe, fe, lt, tn, nn, jn;
2084
+ class Go {
2085
+ /**
2086
+ * @param {TemplateNode} anchor
2087
+ * @param {boolean} transition
2088
+ */
2089
+ constructor(t, n = !0) {
2090
+ /** @type {TemplateNode} */
2091
+ K(this, "anchor");
2092
+ /** @type {Map<Batch, Key>} */
2093
+ z(this, ye, /* @__PURE__ */ new Map());
2094
+ /**
2095
+ * Map of keys to effects that are currently rendered in the DOM.
2096
+ * These effects are visible and actively part of the document tree.
2097
+ * Example:
2098
+ * ```
2099
+ * {#if condition}
2100
+ * foo
2101
+ * {:else}
2102
+ * bar
2103
+ * {/if}
2104
+ * ```
2105
+ * Can result in the entries `true->Effect` and `false->Effect`
2106
+ * @type {Map<Key, Effect>}
2107
+ */
2108
+ z(this, Oe, /* @__PURE__ */ new Map());
2109
+ /**
2110
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
2111
+ * in the DOM, because their insertion is deferred.
2112
+ * @type {Map<Key, Branch>}
2113
+ */
2114
+ z(this, fe, /* @__PURE__ */ new Map());
2115
+ /**
2116
+ * Keys of effects that are currently outroing
2117
+ * @type {Set<Key>}
2118
+ */
2119
+ z(this, lt, /* @__PURE__ */ new Set());
2120
+ /**
2121
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
2122
+ * This is necessary for `<svelte:element>`
2123
+ */
2124
+ z(this, tn, !0);
2125
+ z(this, nn, () => {
2126
+ var t = (
2127
+ /** @type {Batch} */
2128
+ I
2129
+ );
2130
+ if (c(this, ye).has(t)) {
2131
+ var n = (
2132
+ /** @type {Key} */
2133
+ c(this, ye).get(t)
2134
+ ), r = c(this, Oe).get(n);
2135
+ if (r)
2136
+ or(r), c(this, lt).delete(n);
2137
+ else {
2138
+ var o = c(this, fe).get(n);
2139
+ o && (c(this, Oe).set(n, o.effect), c(this, fe).delete(n), o.fragment.lastChild.remove(), this.anchor.before(o.fragment), r = o.effect);
2140
+ }
2141
+ for (const [s, i] of c(this, ye)) {
2142
+ if (c(this, ye).delete(s), s === t)
2143
+ break;
2144
+ const a = c(this, fe).get(i);
2145
+ a && (ie(a.effect), c(this, fe).delete(i));
2146
+ }
2147
+ for (const [s, i] of c(this, Oe)) {
2148
+ if (s === n || c(this, lt).has(s)) continue;
2149
+ const a = () => {
2150
+ if (Array.from(c(this, ye).values()).includes(s)) {
2151
+ var f = document.createDocumentFragment();
2152
+ is(i, f), f.append(Ze()), c(this, fe).set(s, { effect: i, fragment: f });
2153
+ } else
2154
+ ie(i);
2155
+ c(this, lt).delete(s), c(this, Oe).delete(s);
2156
+ };
2157
+ c(this, tn) || !r ? (c(this, lt).add(s), ct(i, a, !1)) : a();
2158
+ }
2159
+ }
2160
+ });
2161
+ /**
2162
+ * @param {Batch} batch
2163
+ */
2164
+ z(this, jn, (t) => {
2165
+ c(this, ye).delete(t);
2166
+ const n = Array.from(c(this, ye).values());
2167
+ for (const [r, o] of c(this, fe))
2168
+ n.includes(r) || (ie(o.effect), c(this, fe).delete(r));
2169
+ });
2170
+ this.anchor = t, T(this, tn, n);
2171
+ }
2172
+ /**
2173
+ *
2174
+ * @param {any} key
2175
+ * @param {null | ((target: TemplateNode) => void)} fn
2176
+ */
2177
+ ensure(t, n) {
2178
+ var r = (
2179
+ /** @type {Batch} */
2180
+ I
2181
+ ), o = Wr();
2182
+ if (n && !c(this, Oe).has(t) && !c(this, fe).has(t))
2183
+ if (o) {
2184
+ var s = document.createDocumentFragment(), i = Ze();
2185
+ s.append(i), c(this, fe).set(t, {
2186
+ effect: me(() => n(i)),
2187
+ fragment: s
2188
+ });
2189
+ } else
2190
+ c(this, Oe).set(
2191
+ t,
2192
+ me(() => n(this.anchor))
2193
+ );
2194
+ if (c(this, ye).set(r, t), o) {
2195
+ for (const [a, l] of c(this, Oe))
2196
+ a === t ? r.skipped_effects.delete(l) : r.skipped_effects.add(l);
2197
+ for (const [a, l] of c(this, fe))
2198
+ a === t ? r.skipped_effects.delete(l.effect) : r.skipped_effects.add(l.effect);
2199
+ r.oncommit(c(this, nn)), r.ondiscard(c(this, jn));
2200
+ } else
2201
+ c(this, nn).call(this);
2202
+ }
36
2203
  }
37
-
38
- .devtools-trigger:hover {
39
- background: #2d2d2d;
2204
+ ye = new WeakMap(), Oe = new WeakMap(), fe = new WeakMap(), lt = new WeakMap(), tn = new WeakMap(), nn = new WeakMap(), jn = new WeakMap();
2205
+ if (_) {
2206
+ let e = function(t) {
2207
+ if (!(t in globalThis)) {
2208
+ let n;
2209
+ Object.defineProperty(globalThis, t, {
2210
+ configurable: !0,
2211
+ // eslint-disable-next-line getter-return
2212
+ get: () => {
2213
+ if (n !== void 0)
2214
+ return n;
2215
+ Ws(t);
2216
+ },
2217
+ set: (r) => {
2218
+ n = r;
2219
+ }
2220
+ });
2221
+ }
2222
+ };
2223
+ e("$state"), e("$effect"), e("$derived"), e("$inspect"), e("$props"), e("$bindable");
40
2224
  }
41
-
42
- .loading-dot {
43
- position: absolute;
44
- top: 8px;
45
- right: 8px;
46
- width: 8px;
47
- height: 8px;
48
- background: #22c55e;
49
- border-radius: 50%;
50
- animation: pulse 1s infinite;
2225
+ var mr = /* @__PURE__ */ new Map();
2226
+ function Zo(e, t) {
2227
+ var n = mr.get(e);
2228
+ n || (n = /* @__PURE__ */ new Set(), mr.set(e, n)), n.add(t);
51
2229
  }
52
-
53
- @keyframes pulse {
54
- 0%, 100% { opacity: 1; }
55
- 50% { opacity: 0.5; }
2230
+ function Ne(e, t, n = !1) {
2231
+ var r = new Go(e), o = n ? Nt : 0;
2232
+ function s(i, a) {
2233
+ r.ensure(i, a);
2234
+ }
2235
+ sr(() => {
2236
+ var i = !1;
2237
+ t((a, l = !0) => {
2238
+ i = !0, s(l, a);
2239
+ }), i || s(!1, null);
2240
+ }, o);
2241
+ }
2242
+ function Qt(e, t) {
2243
+ return t;
2244
+ }
2245
+ function Xo(e, t, n) {
2246
+ for (var r = [], o = t.length, s, i = t.length, a = 0; a < o; a++) {
2247
+ let h = t[a];
2248
+ ct(
2249
+ h,
2250
+ () => {
2251
+ if (s) {
2252
+ if (s.pending.delete(h), s.done.add(h), s.pending.size === 0) {
2253
+ var v = (
2254
+ /** @type {Set<EachOutroGroup>} */
2255
+ e.outrogroups
2256
+ );
2257
+ Kn(En(s.done)), v.delete(s), v.size === 0 && (e.outrogroups = null);
2258
+ }
2259
+ } else
2260
+ i -= 1;
2261
+ },
2262
+ !1
2263
+ );
2264
+ }
2265
+ if (i === 0) {
2266
+ var l = r.length === 0 && n !== null;
2267
+ if (l) {
2268
+ var f = (
2269
+ /** @type {Element} */
2270
+ n
2271
+ ), g = (
2272
+ /** @type {Element} */
2273
+ f.parentNode
2274
+ );
2275
+ Po(g), g.append(f), e.items.clear();
2276
+ }
2277
+ Kn(t, !l);
2278
+ } else
2279
+ s = {
2280
+ pending: new Set(t),
2281
+ done: /* @__PURE__ */ new Set()
2282
+ }, (e.outrogroups ?? (e.outrogroups = /* @__PURE__ */ new Set())).add(s);
2283
+ }
2284
+ function Kn(e, t = !0) {
2285
+ for (var n = 0; n < e.length; n++)
2286
+ ie(e[n], t);
2287
+ }
2288
+ var _r;
2289
+ function $t(e, t, n, r, o, s = null) {
2290
+ var i = e, a = /* @__PURE__ */ new Map();
2291
+ {
2292
+ var l = (
2293
+ /** @type {Element} */
2294
+ e
2295
+ );
2296
+ i = l.appendChild(Ze());
2297
+ }
2298
+ var f = null, g = /* @__PURE__ */ xo(() => {
2299
+ var E = n();
2300
+ return Wn(E) ? E : E == null ? [] : En(E);
2301
+ }), h, v = !0;
2302
+ function d() {
2303
+ b.fallback = f, Qo(b, h, i, t, r), f !== null && (h.length === 0 ? (f.f & Ke) === 0 ? or(f) : (f.f ^= Ke, Vt(f, null, i)) : ct(f, () => {
2304
+ f = null;
2305
+ }));
2306
+ }
2307
+ var u = sr(() => {
2308
+ h = /** @type {V[]} */
2309
+ p(g);
2310
+ for (var E = h.length, A = /* @__PURE__ */ new Set(), k = (
2311
+ /** @type {Batch} */
2312
+ I
2313
+ ), x = Wr(), O = 0; O < E; O += 1) {
2314
+ var w = h[O], j = r(w, O), y = v ? null : a.get(j);
2315
+ y ? (y.v && Rt(y.v, w), y.i && Rt(y.i, O), x && k.skipped_effects.delete(y.e)) : (y = $o(
2316
+ a,
2317
+ v ? i : _r ?? (_r = Ze()),
2318
+ w,
2319
+ j,
2320
+ O,
2321
+ o,
2322
+ t,
2323
+ n
2324
+ ), v || (y.e.f |= Ke), a.set(j, y)), A.add(j);
2325
+ }
2326
+ if (E === 0 && s && !f && (v ? f = me(() => s(i)) : (f = me(() => s(_r ?? (_r = Ze()))), f.f |= Ke)), !v)
2327
+ if (x) {
2328
+ for (const [M, L] of a)
2329
+ A.has(M) || k.skipped_effects.add(L.e);
2330
+ k.oncommit(d), k.ondiscard(() => {
2331
+ });
2332
+ } else
2333
+ d();
2334
+ p(g);
2335
+ }), b = { effect: u, items: a, outrogroups: null, fallback: f };
2336
+ v = !1;
2337
+ }
2338
+ function Qo(e, t, n, r, o) {
2339
+ var M;
2340
+ var s = t.length, i = e.items, a = e.effect.first, l, f = null, g = [], h = [], v, d, u, b;
2341
+ for (b = 0; b < s; b += 1) {
2342
+ if (v = t[b], d = o(v, b), u = /** @type {EachItem} */
2343
+ i.get(d).e, e.outrogroups !== null)
2344
+ for (const L of e.outrogroups)
2345
+ L.pending.delete(u), L.done.delete(u);
2346
+ if ((u.f & Ke) !== 0)
2347
+ if (u.f ^= Ke, u === a)
2348
+ Vt(u, null, n);
2349
+ else {
2350
+ var E = f ? f.next : a;
2351
+ u === e.effect.last && (e.effect.last = u.prev), u.prev && (u.prev.next = u.next), u.next && (u.next.prev = u.prev), Ue(e, f, u), Ue(e, u, E), Vt(u, E, n), f = u, g = [], h = [], a = f.next;
2352
+ continue;
2353
+ }
2354
+ if ((u.f & ce) !== 0 && or(u), u !== a) {
2355
+ if (l !== void 0 && l.has(u)) {
2356
+ if (g.length < h.length) {
2357
+ var A = h[0], k;
2358
+ f = A.prev;
2359
+ var x = g[0], O = g[g.length - 1];
2360
+ for (k = 0; k < g.length; k += 1)
2361
+ Vt(g[k], A, n);
2362
+ for (k = 0; k < h.length; k += 1)
2363
+ l.delete(h[k]);
2364
+ Ue(e, x.prev, O.next), Ue(e, f, x), Ue(e, O, A), a = A, f = O, b -= 1, g = [], h = [];
2365
+ } else
2366
+ l.delete(u), Vt(u, a, n), Ue(e, u.prev, u.next), Ue(e, u, f === null ? e.effect.first : f.next), Ue(e, f, u), f = u;
2367
+ continue;
2368
+ }
2369
+ for (g = [], h = []; a !== null && a !== u; )
2370
+ (l ?? (l = /* @__PURE__ */ new Set())).add(a), h.push(a), a = a.next;
2371
+ if (a === null)
2372
+ continue;
2373
+ }
2374
+ (u.f & Ke) === 0 && g.push(u), f = u, a = u.next;
2375
+ }
2376
+ if (e.outrogroups !== null) {
2377
+ for (const L of e.outrogroups)
2378
+ L.pending.size === 0 && (Kn(En(L.done)), (M = e.outrogroups) == null || M.delete(L));
2379
+ e.outrogroups.size === 0 && (e.outrogroups = null);
2380
+ }
2381
+ if (a !== null || l !== void 0) {
2382
+ var w = [];
2383
+ if (l !== void 0)
2384
+ for (u of l)
2385
+ (u.f & ce) === 0 && w.push(u);
2386
+ for (; a !== null; )
2387
+ (a.f & ce) === 0 && a !== e.fallback && w.push(a), a = a.next;
2388
+ var j = w.length;
2389
+ if (j > 0) {
2390
+ var y = s === 0 ? n : null;
2391
+ Xo(e, w, y);
2392
+ }
2393
+ }
2394
+ }
2395
+ function $o(e, t, n, r, o, s, i, a) {
2396
+ var l = (i & 1) !== 0 ? (i & 16) === 0 ? /* @__PURE__ */ Eo(n, !1, !1) : mt(n) : null, f = (i & 2) !== 0 ? mt(o) : null;
2397
+ return _ && l && (l.trace = () => {
2398
+ a()[(f == null ? void 0 : f.v) ?? o];
2399
+ }), {
2400
+ v: l,
2401
+ i: f,
2402
+ e: me(() => (s(t, l ?? n, f ?? o, a), () => {
2403
+ e.delete(r);
2404
+ }))
2405
+ };
2406
+ }
2407
+ function Vt(e, t, n) {
2408
+ if (e.nodes)
2409
+ for (var r = e.nodes.start, o = e.nodes.end, s = t && (t.f & Ke) === 0 ? (
2410
+ /** @type {EffectNodes} */
2411
+ t.nodes.start
2412
+ ) : n; r !== null; ) {
2413
+ var i = (
2414
+ /** @type {TemplateNode} */
2415
+ /* @__PURE__ */ an(r)
2416
+ );
2417
+ if (s.before(r), r === o)
2418
+ return;
2419
+ r = i;
2420
+ }
2421
+ }
2422
+ function Ue(e, t, n) {
2423
+ t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
2424
+ }
2425
+ function bt(e, t) {
2426
+ $r(() => {
2427
+ var n = e.getRootNode(), r = (
2428
+ /** @type {ShadowRoot} */
2429
+ n.host ? (
2430
+ /** @type {ShadowRoot} */
2431
+ n
2432
+ ) : (
2433
+ /** @type {Document} */
2434
+ n.head ?? /** @type {Document} */
2435
+ n.ownerDocument.head
2436
+ )
2437
+ );
2438
+ if (!r.querySelector("#" + t.hash)) {
2439
+ const o = document.createElement("style");
2440
+ o.id = t.hash, o.textContent = t.code, r.appendChild(o), _ && Zo(t.hash, o);
2441
+ }
2442
+ });
2443
+ }
2444
+ const br = [...`
2445
+ \r\f \v\uFEFF`];
2446
+ function ei(e, t, n) {
2447
+ var r = e == null ? "" : "" + e;
2448
+ if (t && (r = r ? r + " " + t : t), n) {
2449
+ for (var o in n)
2450
+ if (n[o])
2451
+ r = r ? r + " " + o : o;
2452
+ else if (r.length)
2453
+ for (var s = o.length, i = 0; (i = r.indexOf(o, i)) >= 0; ) {
2454
+ var a = i + s;
2455
+ (i === 0 || br.includes(r[i - 1])) && (a === r.length || br.includes(r[a])) ? r = (i === 0 ? "" : r.substring(0, i)) + r.substring(a + 1) : i = a;
2456
+ }
2457
+ }
2458
+ return r === "" ? null : r;
2459
+ }
2460
+ function ti(e, t) {
2461
+ return e == null ? null : String(e);
2462
+ }
2463
+ function vt(e, t, n, r, o, s) {
2464
+ var i = e.__className;
2465
+ if (i !== n || i === void 0) {
2466
+ var a = ei(n, r, s);
2467
+ a == null ? e.removeAttribute("class") : e.className = a, e.__className = n;
2468
+ } else if (s && o !== s)
2469
+ for (var l in s) {
2470
+ var f = !!s[l];
2471
+ (o == null || f !== !!o[l]) && e.classList.toggle(l, f);
2472
+ }
2473
+ return s;
2474
+ }
2475
+ function gs(e, t, n, r) {
2476
+ var o = e.__style;
2477
+ if (o !== t) {
2478
+ var s = ti(t);
2479
+ s == null ? e.removeAttribute("style") : e.style.cssText = s, e.__style = t;
2480
+ }
2481
+ return r;
2482
+ }
2483
+ function ms(e, t, n = !1) {
2484
+ if (e.multiple) {
2485
+ if (t == null)
2486
+ return;
2487
+ if (!Wn(t))
2488
+ return eo();
2489
+ for (var r of e.options)
2490
+ r.selected = t.includes(wr(r));
2491
+ return;
2492
+ }
2493
+ for (r of e.options) {
2494
+ var o = wr(r);
2495
+ if (So(o, t)) {
2496
+ r.selected = !0;
2497
+ return;
2498
+ }
2499
+ }
2500
+ (!n || t !== void 0) && (e.selectedIndex = -1);
2501
+ }
2502
+ function ni(e) {
2503
+ var t = new MutationObserver(() => {
2504
+ ms(e, e.__value);
2505
+ });
2506
+ t.observe(e, {
2507
+ // Listen to option element changes
2508
+ childList: !0,
2509
+ subtree: !0,
2510
+ // because of <optgroup>
2511
+ // Listen to option element value attribute changes
2512
+ // (doesn't get notified of select value changes,
2513
+ // because that property is not reflected as an attribute)
2514
+ attributes: !0,
2515
+ attributeFilter: ["value"]
2516
+ }), Zr(() => {
2517
+ t.disconnect();
2518
+ });
2519
+ }
2520
+ function wr(e) {
2521
+ return "__value" in e ? e.__value : e.value;
2522
+ }
2523
+ const ri = Symbol("is custom element"), si = Symbol("is html");
2524
+ function oi(e, t, n, r) {
2525
+ var o = ii(e);
2526
+ o[t] !== (o[t] = n) && (n == null ? e.removeAttribute(t) : typeof n != "string" && ai(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
2527
+ }
2528
+ function ii(e) {
2529
+ return (
2530
+ /** @type {Record<string | symbol, unknown>} **/
2531
+ // @ts-expect-error
2532
+ e.__attributes ?? (e.__attributes = {
2533
+ [ri]: e.nodeName.includes("-"),
2534
+ [si]: e.namespaceURI === Ps
2535
+ })
2536
+ );
2537
+ }
2538
+ var yr = /* @__PURE__ */ new Map();
2539
+ function ai(e) {
2540
+ var t = e.getAttribute("is") || e.nodeName, n = yr.get(t);
2541
+ if (n) return n;
2542
+ yr.set(t, n = []);
2543
+ for (var r, o = e, s = Element.prototype; s !== o; ) {
2544
+ r = Ns(o);
2545
+ for (var i in r)
2546
+ r[i].set && n.push(i);
2547
+ o = Ar(o);
2548
+ }
2549
+ return n;
56
2550
  }
2551
+ function xr(e, t) {
2552
+ return e === t || (e == null ? void 0 : e[ft]) === t;
2553
+ }
2554
+ function _s(e = {}, t, n, r) {
2555
+ return $r(() => {
2556
+ var o, s;
2557
+ return es(() => {
2558
+ o = s, s = [], vs(() => {
2559
+ e !== n(...s) && (t(e, ...s), o && xr(n(...o), e) && t(null, ...o));
2560
+ });
2561
+ }), () => {
2562
+ Sn(() => {
2563
+ s && xr(n(...s), e) && t(null, ...s);
2564
+ });
2565
+ };
2566
+ }), e;
2567
+ }
2568
+ function kr(e, t, n, r) {
2569
+ var o = (
2570
+ /** @type {V} */
2571
+ r
2572
+ ), s = !0, i = () => (s && (s = !1, o = /** @type {V} */
2573
+ r), o), a;
2574
+ a = /** @type {V} */
2575
+ e[t], a === void 0 && r !== void 0 && (a = i());
2576
+ var l;
2577
+ return l = () => {
2578
+ var f = (
2579
+ /** @type {V} */
2580
+ e[t]
2581
+ );
2582
+ return f === void 0 ? i() : (s = !0, f);
2583
+ }, l;
2584
+ }
2585
+ const li = {
2586
+ // 面板标题
2587
+ panelTitle: "Incremark 开发工具",
2588
+ // Tabs
2589
+ tabOverview: "概览",
2590
+ tabBlocks: "块",
2591
+ tabAst: "AST",
2592
+ tabTimeline: "时间线",
2593
+ // 按钮
2594
+ btnClose: "×",
2595
+ btnCopy: "复制",
2596
+ btnClear: "清除",
2597
+ // 状态
2598
+ statusStreaming: "⏳ 流式处理中...",
2599
+ statusComplete: "✅ 完成",
2600
+ waitingForData: "等待数据...",
2601
+ // 概览页
2602
+ totalBlocks: "总块数",
2603
+ completed: "已完成",
2604
+ pending: "处理中",
2605
+ characters: "字符数",
2606
+ nodeTypes: "节点类型",
2607
+ status: "状态",
2608
+ // Blocks 页
2609
+ blockDetails: "块详情",
2610
+ blockId: "ID",
2611
+ blockType: "类型",
2612
+ blockStatus: "状态",
2613
+ rawText: "原始文本",
2614
+ astNode: "AST 节点",
2615
+ selectBlockHint: "选择一个块查看详情",
2616
+ // Timeline 页
2617
+ totalAppends: "次追加",
2618
+ // 工具提示
2619
+ toolTriggerTitle: "Incremark 开发工具"
2620
+ }, fi = {
2621
+ // 面板标题
2622
+ panelTitle: "Incremark DevTools",
2623
+ // Tabs
2624
+ tabOverview: "Overview",
2625
+ tabBlocks: "Blocks",
2626
+ tabAst: "AST",
2627
+ tabTimeline: "Timeline",
2628
+ // 按钮
2629
+ btnClose: "×",
2630
+ btnCopy: "Copy",
2631
+ btnClear: "Clear",
2632
+ // 状态
2633
+ statusStreaming: "⏳ Streaming...",
2634
+ statusComplete: "✅ Complete",
2635
+ waitingForData: "Waiting for data...",
2636
+ // 概览页
2637
+ totalBlocks: "Total Blocks",
2638
+ completed: "Completed",
2639
+ pending: "Pending",
2640
+ characters: "Characters",
2641
+ nodeTypes: "Node Types",
2642
+ status: "Status",
2643
+ // Blocks 页
2644
+ blockDetails: "Block Details",
2645
+ blockId: "ID",
2646
+ blockType: "Type",
2647
+ blockStatus: "Status",
2648
+ rawText: "Raw Text",
2649
+ astNode: "AST Node",
2650
+ selectBlockHint: "Select a block to view details",
2651
+ // Timeline 页
2652
+ totalAppends: "appends",
2653
+ // 工具提示
2654
+ toolTriggerTitle: "Incremark DevTools"
2655
+ }, ir = { "zh-CN": li, "en-US": fi };
2656
+ let ht = "en-US";
2657
+ const bs = [];
2658
+ function ci(e) {
2659
+ e in ir && ht !== e && (ht = e, bs.forEach((t) => t()));
2660
+ }
2661
+ function Qi() {
2662
+ return ht;
2663
+ }
2664
+ function $i(e) {
2665
+ return ir[ht][e] || e;
2666
+ }
2667
+ function ui(e = "en-US") {
2668
+ ht = e;
2669
+ let t = /* @__PURE__ */ W(0);
2670
+ const n = () => {
2671
+ To(t);
2672
+ };
2673
+ return bs.push(n), {
2674
+ get locale() {
2675
+ return p(t), ht;
2676
+ },
2677
+ setLocale(o) {
2678
+ ci(o);
2679
+ },
2680
+ t(o) {
2681
+ return p(t), ir[ht][o] || o;
2682
+ },
2683
+ // 获取版本号
2684
+ get version() {
2685
+ return p(t);
2686
+ }
2687
+ };
2688
+ }
2689
+ function di(e = {}) {
2690
+ const t = ui(e.locale ?? "en-US");
2691
+ let n = /* @__PURE__ */ W(nt(/* @__PURE__ */ new Map())), r = /* @__PURE__ */ W(null), o = /* @__PURE__ */ W(nt(e.open ?? !1)), s = /* @__PURE__ */ W("overview"), i = /* @__PURE__ */ W(null);
2692
+ const a = /* @__PURE__ */ Ot(() => Array.from(p(n).values())), l = /* @__PURE__ */ Ot(() => p(r) ? p(n).get(p(r)) ?? null : null), f = /* @__PURE__ */ Ot(() => p(a).some((w) => {
2693
+ var j;
2694
+ return (j = w.state) == null ? void 0 : j.isLoading;
2695
+ }));
2696
+ function g(w, j) {
2697
+ const y = p(n).get(w);
2698
+ if (!y) return;
2699
+ const M = {
2700
+ blocks: [...j.completedBlocks, ...j.pendingBlocks],
2701
+ completedBlocks: j.completedBlocks,
2702
+ pendingBlocks: j.pendingBlocks,
2703
+ markdown: j.markdown,
2704
+ ast: j.ast,
2705
+ isLoading: j.pendingBlocks.length > 0
2706
+ }, L = y.state;
2707
+ if (L) {
2708
+ const ne = L.markdown.length, Pe = M.markdown.length;
2709
+ Pe < ne ? y.appendHistory = [] : Pe > ne && (y.appendHistory = [
2710
+ ...y.appendHistory,
2711
+ {
2712
+ timestamp: Date.now(),
2713
+ chunk: M.markdown.slice(ne),
2714
+ completedCount: M.completedBlocks.length,
2715
+ pendingCount: M.pendingBlocks.length
2716
+ }
2717
+ ]);
2718
+ }
2719
+ const $ = {
2720
+ ...y,
2721
+ state: M,
2722
+ appendHistory: y.appendHistory
2723
+ }, _e = new Map(p(n));
2724
+ _e.set(w, $), N(n, _e, !0);
2725
+ }
2726
+ function h(w, j) {
2727
+ const { id: y, label: M } = j;
2728
+ p(n).has(y) && v(y);
2729
+ const L = {
2730
+ id: y,
2731
+ label: M || y,
2732
+ parser: w,
2733
+ state: null,
2734
+ appendHistory: []
2735
+ };
2736
+ w.setOnChange((_e) => {
2737
+ g(y, _e);
2738
+ });
2739
+ const $ = new Map(p(n));
2740
+ $.set(y, L), N(n, $, !0), p(n).size === 1 && N(r, y, !0);
2741
+ }
2742
+ function v(w) {
2743
+ const j = p(n).get(w);
2744
+ if (j) {
2745
+ j.parser.setOnChange(void 0);
2746
+ const y = new Map(p(n));
2747
+ if (y.delete(w), N(n, y, !0), p(r) === w) {
2748
+ const M = p(n).keys().next();
2749
+ N(r, M.done ? null : M.value, !0);
2750
+ }
2751
+ }
2752
+ }
2753
+ function d(w) {
2754
+ p(n).has(w) && (N(r, w, !0), N(i, null));
2755
+ }
2756
+ function u() {
2757
+ N(o, !0);
2758
+ }
2759
+ function b() {
2760
+ N(o, !1);
2761
+ }
2762
+ function E() {
2763
+ N(o, !p(o));
2764
+ }
2765
+ function A(w) {
2766
+ N(s, w, !0);
2767
+ }
2768
+ function k(w) {
2769
+ N(i, w, !0);
2770
+ }
2771
+ function x() {
2772
+ if (!p(r)) return;
2773
+ const w = p(n).get(p(r));
2774
+ if (w) {
2775
+ const j = { ...w, appendHistory: [] }, y = new Map(p(n));
2776
+ y.set(p(r), j), N(n, y, !0);
2777
+ }
2778
+ }
2779
+ function O() {
2780
+ for (const w of p(n).values())
2781
+ w.parser.setOnChange(void 0);
2782
+ N(n, /* @__PURE__ */ new Map(), !0), N(r, null);
2783
+ }
2784
+ return {
2785
+ // 状态 getters
2786
+ get parsers() {
2787
+ return p(n);
2788
+ },
2789
+ get parsersArray() {
2790
+ return p(a);
2791
+ },
2792
+ get selectedParserId() {
2793
+ return p(r);
2794
+ },
2795
+ get selectedParser() {
2796
+ return p(l);
2797
+ },
2798
+ get isOpen() {
2799
+ return p(o);
2800
+ },
2801
+ get activeTab() {
2802
+ return p(s);
2803
+ },
2804
+ get selectedBlockId() {
2805
+ return p(i);
2806
+ },
2807
+ get hasLoadingParser() {
2808
+ return p(f);
2809
+ },
2810
+ get i18n() {
2811
+ return t;
2812
+ },
2813
+ // 方法
2814
+ register: h,
2815
+ unregister: v,
2816
+ selectParser: d,
2817
+ open: u,
2818
+ close: b,
2819
+ toggle: E,
2820
+ setActiveTab: A,
2821
+ selectBlock: k,
2822
+ clearHistory: x,
2823
+ destroy: O
2824
+ };
2825
+ }
2826
+ const vi = "5";
2827
+ var Sr;
2828
+ typeof window < "u" && ((Sr = window.__svelte ?? (window.__svelte = {})).v ?? (Sr.v = /* @__PURE__ */ new Set())).add(vi);
2829
+ var hi = /* @__PURE__ */ H('<span class="loading-dot svelte-198cxf2"></span>'), pi = /* @__PURE__ */ H('<span class="parser-count svelte-198cxf2"> </span>'), gi = /* @__PURE__ */ H('<button class="devtools-trigger svelte-198cxf2"><span class="svelte-198cxf2">🔧</span> <!> <!></button>');
2830
+ const mi = {
2831
+ hash: "svelte-198cxf2",
2832
+ code: `.devtools-trigger.svelte-198cxf2 {width:48px;height:48px;border-radius:50%;border:none;background:#1e1e1e;color:white;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(0, 0, 0, 0.3);position:relative;font-size:20px;transition:all 0.2s;}.devtools-trigger.svelte-198cxf2:hover {background:#2d2d2d;transform:scale(1.05);}.devtools-trigger.svelte-198cxf2:active {transform:scale(0.95);}.loading-dot.svelte-198cxf2 {position:absolute;top:8px;right:8px;width:8px;height:8px;background:#22c55e;border-radius:50%;
2833
+ animation: svelte-198cxf2-pulse 1s infinite;}.parser-count.svelte-198cxf2 {position:absolute;bottom:4px;right:4px;min-width:16px;height:16px;background:#3b82f6;border-radius:8px;font-size:10px;font-weight:600;display:flex;align-items:center;justify-content:center;padding:0 4px;color:white;}
57
2834
 
58
- .devtools-panel {
59
- position: absolute;
60
- width: 420px;
61
- max-height: 500px;
62
- background: #1e1e1e;
63
- border-radius: 12px;
64
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
65
- overflow: hidden;
2835
+ @keyframes svelte-198cxf2-pulse {
2836
+ 0%, 100% { opacity: 1; }
2837
+ 50% { opacity: 0.5; }
2838
+ }.light .devtools-trigger.svelte-198cxf2 {background:#fff;color:#333;box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);}.light .devtools-trigger.svelte-198cxf2:hover {background:#f5f5f5;}`
2839
+ };
2840
+ function _i(e, t) {
2841
+ Qe(t, !0), bt(e, mi);
2842
+ var n = gi();
2843
+ n.__click = function(...a) {
2844
+ var l;
2845
+ (l = t.onToggle) == null || l.apply(this, a);
2846
+ };
2847
+ var r = C(m(n), 2);
2848
+ {
2849
+ var o = (a) => {
2850
+ var l = hi();
2851
+ D(a, l);
2852
+ };
2853
+ Ne(r, (a) => {
2854
+ t.hasLoadingParser && a(o);
2855
+ });
2856
+ }
2857
+ var s = C(r, 2);
2858
+ {
2859
+ var i = (a) => {
2860
+ var l = pi(), f = m(l);
2861
+ Z(() => S(f, t.parserCount)), D(a, l);
2862
+ };
2863
+ Ne(s, (a) => {
2864
+ t.parserCount > 1 && a(i);
2865
+ });
2866
+ }
2867
+ Z((a) => oi(n, "title", a), [() => t.store.i18n.t("toolTriggerTitle")]), D(e, n), $e();
2868
+ }
2869
+ fn(["click"]);
2870
+ var bi = /* @__PURE__ */ H('<div class="type-bar svelte-1p1wgsv"><span class="type-color svelte-1p1wgsv"></span> <span class="type-name svelte-1p1wgsv"> </span> <span class="type-count svelte-1p1wgsv"> </span></div>'), wi = /* @__PURE__ */ H('<div class="overview-tab svelte-1p1wgsv"><div class="stats-grid svelte-1p1wgsv"><div class="stat-card svelte-1p1wgsv"><div class="stat-value svelte-1p1wgsv"> </div> <div class="stat-label svelte-1p1wgsv"> </div></div> <div class="stat-card completed svelte-1p1wgsv"><div class="stat-value svelte-1p1wgsv"> </div> <div class="stat-label svelte-1p1wgsv"> </div></div> <div class="stat-card pending svelte-1p1wgsv"><div class="stat-value svelte-1p1wgsv"> </div> <div class="stat-label svelte-1p1wgsv"> </div></div> <div class="stat-card svelte-1p1wgsv"><div class="stat-value svelte-1p1wgsv"> </div> <div class="stat-label svelte-1p1wgsv"> </div></div></div> <div class="section svelte-1p1wgsv"><h4 class="svelte-1p1wgsv"> </h4> <div class="type-bars svelte-1p1wgsv"></div></div> <div class="section svelte-1p1wgsv"><h4 class="svelte-1p1wgsv"> </h4> <div> </div></div></div>');
2871
+ const yi = {
2872
+ hash: "svelte-1p1wgsv",
2873
+ code: ".overview-tab.svelte-1p1wgsv {flex:1;overflow-y:auto;}.overview-tab.svelte-1p1wgsv::-webkit-scrollbar {width:6px;}.overview-tab.svelte-1p1wgsv::-webkit-scrollbar-track {background:transparent;}.overview-tab.svelte-1p1wgsv::-webkit-scrollbar-thumb {background:#444;border-radius:3px;}.stats-grid.svelte-1p1wgsv {display:grid;grid-template-columns:repeat(4, 1fr);gap:12px;margin-bottom:20px;}.stat-card.svelte-1p1wgsv {background:#2a2a2a;padding:12px;border-radius:8px;text-align:center;}.stat-value.svelte-1p1wgsv {font-size:24px;font-weight:700;color:#fff;}.stat-label.svelte-1p1wgsv {font-size:11px;color:#888;margin-top:4px;}.stat-card.completed.svelte-1p1wgsv .stat-value:where(.svelte-1p1wgsv) {color:#22c55e;}.stat-card.pending.svelte-1p1wgsv .stat-value:where(.svelte-1p1wgsv) {color:#a855f7;}.section.svelte-1p1wgsv {margin-bottom:20px;}.section.svelte-1p1wgsv h4:where(.svelte-1p1wgsv) {margin:0 0 12px;font-size:12px;color:#888;text-transform:uppercase;}.type-bars.svelte-1p1wgsv {display:flex;flex-direction:column;gap:6px;max-height:200px;overflow-y:auto;}.type-bars.svelte-1p1wgsv::-webkit-scrollbar {width:6px;}.type-bars.svelte-1p1wgsv::-webkit-scrollbar-track {background:transparent;}.type-bars.svelte-1p1wgsv::-webkit-scrollbar-thumb {background:#444;border-radius:3px;}.type-bar.svelte-1p1wgsv {display:flex;align-items:center;gap:8px;}.type-color.svelte-1p1wgsv {width:12px;height:12px;border-radius:3px;}.type-name.svelte-1p1wgsv {flex:1;}.type-count.svelte-1p1wgsv {color:#888;}.status-indicator.svelte-1p1wgsv {padding:8px 12px;background:#2a2a2a;border-radius:6px;}.status-indicator.loading.svelte-1p1wgsv {background:#22c55e20;color:#22c55e;}.light .stat-card.svelte-1p1wgsv {background:#f5f5f5;}.light .stat-value.svelte-1p1wgsv {color:#333;}"
2874
+ };
2875
+ function xi(e, t) {
2876
+ Qe(t, !0), bt(e, yi);
2877
+ const n = {
2878
+ heading: "#3b82f6",
2879
+ paragraph: "#22c55e",
2880
+ code: "#f59e0b",
2881
+ list: "#8b5cf6",
2882
+ table: "#ec4899",
2883
+ blockquote: "#06b6d4",
2884
+ thematicBreak: "#6b7280"
2885
+ }, r = /* @__PURE__ */ Ot(() => {
2886
+ const de = {};
2887
+ for (const be of t.devState.blocks) {
2888
+ const je = be.node.type;
2889
+ de[je] = (de[je] || 0) + 1;
2890
+ }
2891
+ return de;
2892
+ });
2893
+ var o = wi(), s = m(o), i = m(s), a = m(i), l = m(a), f = C(a, 2), g = m(f), h = C(i, 2), v = m(h), d = m(v), u = C(v, 2), b = m(u), E = C(h, 2), A = m(E), k = m(A), x = C(A, 2), O = m(x), w = C(E, 2), j = m(w), y = m(j), M = C(j, 2), L = m(M), $ = C(s, 2), _e = m($), ne = m(_e), Pe = C(_e, 2);
2894
+ $t(Pe, 21, () => Object.entries(p(r)), Qt, (de, be) => {
2895
+ var je = /* @__PURE__ */ Ot(() => Rs(p(be), 2));
2896
+ let yt = () => p(je)[0], xt = () => p(je)[1];
2897
+ var kt = bi(), jt = m(kt), Ie = C(jt, 2), An = m(Ie), On = C(Ie, 2), qn = m(On);
2898
+ Z(() => {
2899
+ gs(jt, `background: ${(n[yt()] || "#9ca3af") ?? ""}`), S(An, yt()), S(qn, xt());
2900
+ }), D(de, kt);
2901
+ });
2902
+ var wt = C($, 2), et = m(wt), Ht = m(et), ue = C(et, 2);
2903
+ let He;
2904
+ var Ut = m(ue);
2905
+ Z(
2906
+ (de, be, je, yt, xt, kt, jt) => {
2907
+ S(l, t.devState.blocks.length), S(g, de), S(d, t.devState.completedBlocks.length), S(b, be), S(k, t.devState.pendingBlocks.length), S(O, je), S(y, t.devState.markdown.length), S(L, yt), S(ne, xt), S(Ht, kt), He = vt(ue, 1, "status-indicator svelte-1p1wgsv", null, He, { loading: t.devState.isLoading }), S(Ut, jt);
2908
+ },
2909
+ [
2910
+ () => t.store.i18n.t("totalBlocks"),
2911
+ () => t.store.i18n.t("completed"),
2912
+ () => t.store.i18n.t("pending"),
2913
+ () => t.store.i18n.t("characters"),
2914
+ () => t.store.i18n.t("nodeTypes"),
2915
+ () => t.store.i18n.t("status"),
2916
+ () => t.devState.isLoading ? t.store.i18n.t("statusStreaming") : t.store.i18n.t("statusComplete")
2917
+ ]
2918
+ ), D(e, o), $e();
2919
+ }
2920
+ function ws(e) {
2921
+ return e === null ? "null" : typeof e;
2922
+ }
2923
+ function ys(e) {
2924
+ return !!e && typeof e == "object";
2925
+ }
2926
+ function xs(e) {
2927
+ if (e === void 0) return "";
2928
+ if (e === null || typeof e == "object" && !e.constructor) return "Object";
2929
+ var t = /function ([^(]*)/.exec(e.constructor.toString());
2930
+ return t && t.length > 1 ? t[1] : "";
2931
+ }
2932
+ function ks(e, t, n) {
2933
+ return e === "null" || e === "undefined" ? e : (e !== "string" && e !== "stringifiable" || (n = '"' + (n.replace(/"/g, '\\"') + '"')), e === "function" ? t.toString().replace(/[\r\n]/g, "").replace(/\{.*\}/, "") + "{…}" : n);
2934
+ }
2935
+ function jr(e) {
2936
+ var t = "";
2937
+ return ys(e) ? (t = xs(e), Array.isArray(e) && (t += "[" + e.length + "]")) : t = ks(ws(e), e, e), t;
2938
+ }
2939
+ function re(e) {
2940
+ return "json-formatter-".concat(e);
2941
+ }
2942
+ function U(e, t, n) {
2943
+ var r = document.createElement(e);
2944
+ return t && r.classList.add(re(t)), n !== void 0 && (n instanceof Node ? r.appendChild(n) : r.appendChild(document.createTextNode(String(n)))), r;
2945
+ }
2946
+ (function(e) {
2947
+ if (typeof window < "u") {
2948
+ var t = document.createElement("style");
2949
+ t.setAttribute("media", "screen"), t.innerHTML = e, document.head.appendChild(t);
2950
+ }
2951
+ })(`.json-formatter-row {
2952
+ font-family: monospace;
2953
+ }
2954
+ .json-formatter-row,
2955
+ .json-formatter-row a,
2956
+ .json-formatter-row a:hover {
2957
+ color: black;
2958
+ text-decoration: none;
2959
+ }
2960
+ .json-formatter-row .json-formatter-row {
2961
+ margin-left: 1rem;
2962
+ }
2963
+ .json-formatter-row .json-formatter-children.json-formatter-empty {
2964
+ opacity: 0.5;
2965
+ margin-left: 1rem;
2966
+ }
2967
+ .json-formatter-row .json-formatter-children.json-formatter-empty:after {
66
2968
  display: none;
67
- flex-direction: column;
68
2969
  }
69
-
70
- .devtools-panel.open {
71
- display: flex;
2970
+ .json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {
2971
+ content: "No properties";
72
2972
  }
73
-
74
- .bottom-right .devtools-panel,
75
- .bottom-left .devtools-panel {
76
- bottom: 60px;
2973
+ .json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {
2974
+ content: "[]";
77
2975
  }
78
-
79
- .top-right .devtools-panel,
80
- .top-left .devtools-panel {
81
- top: 60px;
2976
+ .json-formatter-row .json-formatter-string,
2977
+ .json-formatter-row .json-formatter-stringifiable {
2978
+ color: green;
2979
+ white-space: pre;
2980
+ word-wrap: break-word;
82
2981
  }
83
-
84
- .bottom-right .devtools-panel,
85
- .top-right .devtools-panel {
86
- right: 0;
2982
+ .json-formatter-row .json-formatter-number {
2983
+ color: blue;
87
2984
  }
88
-
89
- .bottom-left .devtools-panel,
90
- .top-left .devtools-panel {
91
- left: 0;
2985
+ .json-formatter-row .json-formatter-boolean {
2986
+ color: red;
92
2987
  }
93
-
94
- .devtools-header {
95
- display: flex;
96
- align-items: center;
97
- padding: 12px 16px;
98
- background: #252525;
99
- border-bottom: 1px solid #333;
2988
+ .json-formatter-row .json-formatter-null {
2989
+ color: #855a00;
100
2990
  }
101
-
102
- .devtools-header h3 {
103
- margin: 0;
104
- font-size: 14px;
105
- font-weight: 600;
106
- color: #fff;
2991
+ .json-formatter-row .json-formatter-undefined {
2992
+ color: #ca0b69;
107
2993
  }
108
-
109
- .devtools-tabs {
110
- display: flex;
111
- gap: 4px;
112
- margin-left: auto;
113
- margin-right: 12px;
2994
+ .json-formatter-row .json-formatter-function {
2995
+ color: #FF20ED;
114
2996
  }
115
-
116
- .devtools-tabs button {
117
- padding: 4px 10px;
118
- border: none;
119
- background: transparent;
120
- color: #888;
2997
+ .json-formatter-row .json-formatter-date {
2998
+ background-color: rgba(0, 0, 0, 0.05);
2999
+ }
3000
+ .json-formatter-row .json-formatter-url {
3001
+ text-decoration: underline;
3002
+ color: blue;
121
3003
  cursor: pointer;
122
- border-radius: 4px;
123
- font-size: 12px;
124
- text-transform: capitalize;
125
3004
  }
126
-
127
- .devtools-tabs button.active {
128
- background: #3b82f6;
129
- color: white;
3005
+ .json-formatter-row .json-formatter-bracket {
3006
+ color: blue;
130
3007
  }
131
-
132
- .close-btn {
133
- width: 24px;
134
- height: 24px;
135
- border: none;
136
- background: transparent;
137
- color: #888;
3008
+ .json-formatter-row .json-formatter-key {
3009
+ color: #00008b;
3010
+ padding-right: 0.2rem;
3011
+ }
3012
+ .json-formatter-row .json-formatter-toggler-link {
138
3013
  cursor: pointer;
139
- font-size: 18px;
140
- line-height: 1;
141
3014
  }
142
-
143
- .close-btn:hover {
144
- color: #fff;
3015
+ .json-formatter-row .json-formatter-toggler {
3016
+ line-height: 1.2rem;
3017
+ font-size: 0.7rem;
3018
+ vertical-align: middle;
3019
+ opacity: 0.6;
3020
+ cursor: pointer;
3021
+ padding-right: 0.2rem;
145
3022
  }
146
-
147
- .devtools-content {
148
- flex: 1;
149
- overflow-y: auto;
150
- padding: 16px;
151
- color: #e0e0e0;
152
- min-height: 200px;
3023
+ .json-formatter-row .json-formatter-toggler:after {
3024
+ display: inline-block;
3025
+ transition: transform 100ms ease-in;
3026
+ content: "►";
153
3027
  }
154
-
155
- .stats-grid {
156
- display: grid;
157
- grid-template-columns: repeat(4, 1fr);
158
- gap: 12px;
159
- margin-bottom: 20px;
3028
+ .json-formatter-row > a > .json-formatter-preview-text {
3029
+ opacity: 0;
3030
+ transition: opacity 0.15s ease-in;
3031
+ font-style: italic;
160
3032
  }
161
-
162
- .stat-card {
163
- background: #2a2a2a;
164
- padding: 12px;
165
- border-radius: 8px;
166
- text-align: center;
3033
+ .json-formatter-row:hover > a > .json-formatter-preview-text {
3034
+ opacity: 0.6;
167
3035
  }
168
-
169
- .stat-value {
170
- font-size: 24px;
171
- font-weight: 700;
172
- color: #fff;
3036
+ .json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {
3037
+ transform: rotate(90deg);
173
3038
  }
174
-
175
- .stat-label {
176
- font-size: 11px;
177
- color: #888;
178
- margin-top: 4px;
3039
+ .json-formatter-row.json-formatter-open > .json-formatter-children:after {
3040
+ display: inline-block;
179
3041
  }
180
-
181
- .stat-card.completed .stat-value { color: #22c55e; }
182
- .stat-card.pending .stat-value { color: #a855f7; }
183
-
184
- .section {
185
- margin-bottom: 20px;
3042
+ .json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {
3043
+ display: none;
186
3044
  }
187
-
188
- .section h4 {
189
- margin: 0 0 12px;
190
- font-size: 12px;
191
- color: #888;
192
- text-transform: uppercase;
3045
+ .json-formatter-row.json-formatter-open.json-formatter-empty:after {
3046
+ display: block;
193
3047
  }
194
-
195
- .type-bars {
196
- display: flex;
197
- flex-direction: column;
198
- gap: 6px;
3048
+ .json-formatter-dark.json-formatter-row {
3049
+ font-family: monospace;
199
3050
  }
200
-
201
- .type-bar {
202
- display: flex;
203
- align-items: center;
204
- gap: 8px;
3051
+ .json-formatter-dark.json-formatter-row,
3052
+ .json-formatter-dark.json-formatter-row a,
3053
+ .json-formatter-dark.json-formatter-row a:hover {
3054
+ color: white;
3055
+ text-decoration: none;
205
3056
  }
206
-
207
- .type-color {
208
- width: 12px;
209
- height: 12px;
210
- border-radius: 3px;
3057
+ .json-formatter-dark.json-formatter-row .json-formatter-row {
3058
+ margin-left: 1rem;
211
3059
  }
212
-
213
- .type-name { flex: 1; }
214
- .type-count { color: #888; }
215
-
216
- .status-indicator {
217
- padding: 8px 12px;
218
- background: #2a2a2a;
219
- border-radius: 6px;
3060
+ .json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {
3061
+ opacity: 0.5;
3062
+ margin-left: 1rem;
220
3063
  }
221
-
222
- .status-indicator.loading {
223
- background: #22c55e20;
224
- color: #22c55e;
3064
+ .json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {
3065
+ display: none;
225
3066
  }
226
-
227
- .blocks-list {
228
- max-height: 200px;
229
- overflow-y: auto;
230
- margin-bottom: 16px;
3067
+ .json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {
3068
+ content: "No properties";
231
3069
  }
232
-
233
- .block-item {
234
- display: flex;
235
- align-items: center;
236
- gap: 8px;
237
- padding: 8px;
238
- cursor: pointer;
239
- border-radius: 6px;
3070
+ .json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {
3071
+ content: "[]";
240
3072
  }
241
-
242
- .block-item:hover { background: #2a2a2a; }
243
- .block-item.selected { background: #3b82f620; }
244
-
245
- .block-status {
246
- width: 8px;
247
- height: 8px;
248
- border-radius: 50%;
249
- background: #888;
3073
+ .json-formatter-dark.json-formatter-row .json-formatter-string,
3074
+ .json-formatter-dark.json-formatter-row .json-formatter-stringifiable {
3075
+ color: #31f031;
3076
+ white-space: pre;
3077
+ word-wrap: break-word;
250
3078
  }
251
-
252
- .block-status.completed { background: #22c55e; }
253
- .block-status.pending { background: #a855f7; }
254
-
255
- .block-type {
256
- font-weight: 600;
257
- min-width: 80px;
3079
+ .json-formatter-dark.json-formatter-row .json-formatter-number {
3080
+ color: #66c2ff;
258
3081
  }
259
-
260
- .block-preview {
261
- color: #888;
262
- font-size: 12px;
263
- white-space: nowrap;
264
- overflow: hidden;
265
- text-overflow: ellipsis;
3082
+ .json-formatter-dark.json-formatter-row .json-formatter-boolean {
3083
+ color: #EC4242;
266
3084
  }
267
-
268
- .block-detail {
269
- background: #2a2a2a;
270
- padding: 12px;
271
- border-radius: 8px;
3085
+ .json-formatter-dark.json-formatter-row .json-formatter-null {
3086
+ color: #EEC97D;
272
3087
  }
273
-
274
- .block-detail h4,
275
- .block-detail h5 {
276
- margin: 0 0 8px;
277
- font-size: 12px;
278
- color: #888;
3088
+ .json-formatter-dark.json-formatter-row .json-formatter-undefined {
3089
+ color: #ef8fbe;
279
3090
  }
280
-
281
- .block-detail h5 { margin-top: 12px; }
282
-
283
- .detail-row {
284
- display: flex;
285
- gap: 8px;
286
- margin-bottom: 4px;
3091
+ .json-formatter-dark.json-formatter-row .json-formatter-function {
3092
+ color: #FD48CB;
287
3093
  }
288
-
289
- .detail-row .label {
290
- color: #888;
291
- min-width: 50px;
3094
+ .json-formatter-dark.json-formatter-row .json-formatter-date {
3095
+ background-color: rgba(255, 255, 255, 0.05);
292
3096
  }
293
-
294
- .detail-row .value.completed { color: #22c55e; }
295
- .detail-row .value.pending { color: #a855f7; }
296
-
297
- .raw-text,
298
- .ast-json,
299
- .ast-tree {
300
- background: #1a1a1a;
301
- padding: 12px;
302
- border-radius: 6px;
303
- overflow-x: auto;
304
- font-size: 11px;
305
- white-space: pre-wrap;
306
- word-break: break-all;
307
- max-height: 150px;
308
- font-family: monospace;
3097
+ .json-formatter-dark.json-formatter-row .json-formatter-url {
3098
+ text-decoration: underline;
3099
+ color: #027bff;
3100
+ cursor: pointer;
309
3101
  }
310
-
311
- .timeline-header {
312
- display: flex;
313
- justify-content: space-between;
314
- align-items: center;
315
- margin-bottom: 12px;
3102
+ .json-formatter-dark.json-formatter-row .json-formatter-bracket {
3103
+ color: #9494ff;
316
3104
  }
317
-
318
- .timeline-header button {
319
- padding: 4px 8px;
320
- border: none;
321
- background: #333;
322
- color: #888;
323
- border-radius: 4px;
3105
+ .json-formatter-dark.json-formatter-row .json-formatter-key {
3106
+ color: #23a0db;
3107
+ padding-right: 0.2rem;
3108
+ }
3109
+ .json-formatter-dark.json-formatter-row .json-formatter-toggler-link {
324
3110
  cursor: pointer;
325
3111
  }
326
-
327
- .timeline-list {
328
- max-height: 300px;
329
- overflow-y: auto;
3112
+ .json-formatter-dark.json-formatter-row .json-formatter-toggler {
3113
+ line-height: 1.2rem;
3114
+ font-size: 0.7rem;
3115
+ vertical-align: middle;
3116
+ opacity: 0.6;
3117
+ cursor: pointer;
3118
+ padding-right: 0.2rem;
330
3119
  }
331
-
332
- .timeline-item {
333
- display: flex;
334
- gap: 12px;
335
- padding: 8px 0;
336
- border-bottom: 1px solid #333;
337
- font-size: 12px;
3120
+ .json-formatter-dark.json-formatter-row .json-formatter-toggler:after {
3121
+ display: inline-block;
3122
+ transition: transform 100ms ease-in;
3123
+ content: "►";
338
3124
  }
339
-
340
- .timeline-item .time {
341
- color: #888;
342
- min-width: 70px;
3125
+ .json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {
3126
+ opacity: 0;
3127
+ transition: opacity 0.15s ease-in;
3128
+ font-style: italic;
343
3129
  }
344
-
345
- .timeline-item .chunk {
346
- flex: 1;
347
- color: #22c55e;
348
- font-family: monospace;
3130
+ .json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {
3131
+ opacity: 0.6;
349
3132
  }
350
-
351
- .timeline-item .stats { color: #888; }
352
-
353
- /* Light theme */
354
- .incremark-devtools.light .devtools-trigger {
355
- background: #fff;
356
- color: #333;
357
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
3133
+ .json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {
3134
+ transform: rotate(90deg);
358
3135
  }
359
-
360
- .incremark-devtools.light .devtools-panel {
361
- background: #fff;
362
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
3136
+ .json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {
3137
+ display: inline-block;
363
3138
  }
364
-
365
- .incremark-devtools.light .devtools-header {
366
- background: #f5f5f5;
367
- border-bottom: 1px solid #e0e0e0;
3139
+ .json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {
3140
+ display: none;
368
3141
  }
369
-
370
- .incremark-devtools.light .devtools-header h3 { color: #333; }
371
- .incremark-devtools.light .devtools-content { color: #333; }
372
- .incremark-devtools.light .stat-card { background: #f5f5f5; }
373
- .incremark-devtools.light .stat-value { color: #333; }
374
- `;
375
-
376
- // src/devtools.ts
377
- var NODE_TYPE_COLORS = {
378
- heading: "#3b82f6",
379
- paragraph: "#22c55e",
380
- code: "#f59e0b",
381
- list: "#8b5cf6",
382
- table: "#ec4899",
383
- blockquote: "#06b6d4",
384
- thematicBreak: "#6b7280"
3142
+ .json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {
3143
+ display: block;
3144
+ }
3145
+ `);
3146
+ var ki = /(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/, ji = /\d{2}:\d{2}:\d{2} GMT-\d{4}/, Ei = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/, Ti = /^https?:\/\//, hn = window.requestAnimationFrame || function(e) {
3147
+ return e(), 0;
3148
+ }, Tt = { hoverPreviewEnabled: !1, hoverPreviewArrayCount: 100, hoverPreviewFieldCount: 5, animateOpen: !0, animateClose: !0, theme: null, useToJSON: !0, sortPropertiesBy: null, maxArrayItems: 100, exposePath: !1 }, js = (function() {
3149
+ function e(t, n, r, o, s, i, a) {
3150
+ n === void 0 && (n = 1), r === void 0 && (r = Tt), i === void 0 && (i = []), this.json = t, this.open = n, this.config = r, this.key = o, this.displayKey = s, this.path = i, this.arrayRange = a, this._isOpen = null, this.config.hoverPreviewEnabled === void 0 && (this.config.hoverPreviewEnabled = Tt.hoverPreviewEnabled), this.config.hoverPreviewArrayCount === void 0 && (this.config.hoverPreviewArrayCount = Tt.hoverPreviewArrayCount), this.config.hoverPreviewFieldCount === void 0 && (this.config.hoverPreviewFieldCount = Tt.hoverPreviewFieldCount), this.config.useToJSON === void 0 && (this.config.useToJSON = Tt.useToJSON), this.config.maxArrayItems === void 0 && (this.config.maxArrayItems = Tt.maxArrayItems), this.key === "" && (this.key = '""'), this.displayKey === void 0 && (this.displayKey = this.key);
3151
+ }
3152
+ return Object.defineProperty(e.prototype, "isOpen", { get: function() {
3153
+ return this._isOpen !== null ? this._isOpen : this.open > 0;
3154
+ }, set: function(t) {
3155
+ this._isOpen = t;
3156
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isDate", { get: function() {
3157
+ return this.json instanceof Date || this.type === "string" && (ki.test(this.json) || Ei.test(this.json) || ji.test(this.json));
3158
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isUrl", { get: function() {
3159
+ return this.type === "string" && Ti.test(this.json);
3160
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isArray", { get: function() {
3161
+ return Array.isArray(this.json);
3162
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isLargeArray", { get: function() {
3163
+ return this.isArray && this.json.length > this.config.maxArrayItems;
3164
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isArrayRange", { get: function() {
3165
+ return this.isArray && this.arrayRange !== void 0 && this.arrayRange.length == 2;
3166
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isObject", { get: function() {
3167
+ return ys(this.json);
3168
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isEmptyObject", { get: function() {
3169
+ return !this.keys.length && !this.isArray;
3170
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isEmpty", { get: function() {
3171
+ return this.isEmptyObject || this.keys && !this.keys.length && this.isArray;
3172
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "useToJSON", { get: function() {
3173
+ return this.config.useToJSON && this.type === "stringifiable";
3174
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasKey", { get: function() {
3175
+ return this.key !== void 0;
3176
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "constructorName", { get: function() {
3177
+ return xs(this.json);
3178
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "type", { get: function() {
3179
+ return this.config.useToJSON && this.json && this.json.toJSON ? "stringifiable" : ws(this.json);
3180
+ }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "keys", { get: function() {
3181
+ if (this.isObject) {
3182
+ var t = Object.keys(this.json);
3183
+ if (this.isLargeArray) {
3184
+ var n = Math.ceil(this.json.length / this.config.maxArrayItems);
3185
+ t = [];
3186
+ for (var r = 0; r < n; r++) {
3187
+ var o = r * this.config.maxArrayItems, s = Math.min(this.json.length - 1, o + (this.config.maxArrayItems - 1));
3188
+ t.push("".concat(o, " … ").concat(s));
3189
+ }
3190
+ }
3191
+ return !this.isArray && this.config.sortPropertiesBy ? t.sort(this.config.sortPropertiesBy) : t;
3192
+ }
3193
+ return [];
3194
+ }, enumerable: !1, configurable: !0 }), e.prototype.toggleOpen = function() {
3195
+ this.isOpen = !this.isOpen, this.element && (this.isOpen ? this.appendChildren(this.config.animateOpen) : this.removeChildren(this.config.animateClose), this.element.classList.toggle(re("open")));
3196
+ }, e.prototype.openAtDepth = function(t) {
3197
+ t === void 0 && (t = 1), t < 0 || (this.open = t, this.isOpen = t !== 0, this.element && (this.removeChildren(!1), t === 0 ? this.element.classList.remove(re("open")) : (this.appendChildren(this.config.animateOpen), this.element.classList.add(re("open")))));
3198
+ }, e.prototype.getInlinepreview = function() {
3199
+ var t = this;
3200
+ if (this.isArray) return this.json.length > this.config.hoverPreviewArrayCount ? "Array[".concat(this.json.length, "]") : "[".concat(this.json.map(jr).join(", "), "]");
3201
+ var n = this.keys, r = n.slice(0, this.config.hoverPreviewFieldCount).map((function(s) {
3202
+ return "".concat(s, ":").concat(jr(t.json[s]));
3203
+ })), o = n.length >= this.config.hoverPreviewFieldCount ? "…" : "";
3204
+ return "{".concat(r.join(", ")).concat(o, "}");
3205
+ }, e.prototype.render = function() {
3206
+ this.element = U("div", "row");
3207
+ var t = this.isObject ? U("a", "toggler-link") : U("span");
3208
+ if (this.isObject && !this.useToJSON && t.appendChild(U("span", "toggler")), this.isArrayRange ? t.appendChild(U("span", "range", "[".concat(this.displayKey, "]"))) : this.hasKey && (t.appendChild(U("span", "key", "".concat(this.displayKey, ":"))), this.config.exposePath && (this.element.dataset.path = JSON.stringify(this.path))), this.isObject && !this.useToJSON) {
3209
+ var n = U("span", "value"), r = U("span");
3210
+ if (!this.isArrayRange) {
3211
+ var o = U("span", "constructor-name", this.constructorName);
3212
+ r.appendChild(o);
3213
+ }
3214
+ if (this.isArray && !this.isArrayRange) {
3215
+ var s = U("span");
3216
+ s.appendChild(U("span", "bracket", "[")), s.appendChild(U("span", "number", this.json.length)), s.appendChild(U("span", "bracket", "]")), r.appendChild(s);
3217
+ }
3218
+ n.appendChild(r), t.appendChild(n);
3219
+ } else {
3220
+ (n = this.isUrl ? U("a") : U("span")).classList.add(re(this.type)), this.isDate && n.classList.add(re("date")), this.isUrl && (n.classList.add(re("url")), n.setAttribute("href", this.json));
3221
+ var i = ks(this.type, this.json, this.useToJSON ? this.json.toJSON() : this.json);
3222
+ n.appendChild(document.createTextNode(i)), t.appendChild(n);
3223
+ }
3224
+ if (this.isObject && this.config.hoverPreviewEnabled) {
3225
+ var a = U("span", "preview-text");
3226
+ a.appendChild(document.createTextNode(this.getInlinepreview())), t.appendChild(a);
3227
+ }
3228
+ var l = U("div", "children");
3229
+ return this.isObject && l.classList.add(re("object")), this.isArray && l.classList.add(re("array")), this.isEmpty && l.classList.add(re("empty")), this.config && this.config.theme && this.element.classList.add(re(this.config.theme)), this.isOpen && this.element.classList.add(re("open")), this.element.appendChild(t), this.element.appendChild(l), this.isObject && this.isOpen && this.appendChildren(), this.isObject && !this.useToJSON && t.addEventListener("click", this.toggleOpen.bind(this)), this.element;
3230
+ }, e.prototype.appendChildren = function(t) {
3231
+ var n = this;
3232
+ t === void 0 && (t = !1);
3233
+ var r = this.element.querySelector("div.".concat(re("children")));
3234
+ if (r && !this.isEmpty) {
3235
+ var o = function(a, l) {
3236
+ var f = n.isLargeArray ? [l * n.config.maxArrayItems, Math.min(n.json.length - 1, l * n.config.maxArrayItems + (n.config.maxArrayItems - 1))] : void 0, g = n.isArrayRange ? (n.arrayRange[0] + l).toString() : a, h = new e(f ? n.json.slice(f[0], f[1] + 1) : n.json[a], n.open - 1, n.config, a, g, f ? n.path : n.path.concat(g), f);
3237
+ r.appendChild(h.render());
3238
+ };
3239
+ if (t) {
3240
+ var s = 0, i = function() {
3241
+ var a = n.keys[s];
3242
+ o(a, s), (s += 1) < n.keys.length && (s > 10 ? i() : hn(i));
3243
+ };
3244
+ hn(i);
3245
+ } else this.keys.forEach((function(a, l) {
3246
+ return o(a, l);
3247
+ }));
3248
+ }
3249
+ }, e.prototype.removeChildren = function(t) {
3250
+ t === void 0 && (t = !1);
3251
+ var n = this.element.querySelector("div.".concat(re("children")));
3252
+ if (t) {
3253
+ var r = 0, o = function() {
3254
+ n && n.children.length && (n.removeChild(n.children[0]), (r += 1) > 10 ? o() : hn(o));
3255
+ };
3256
+ hn(o);
3257
+ } else n && (n.innerHTML = "");
3258
+ }, e;
3259
+ })(), Ci = /* @__PURE__ */ H('<button><span></span> <span class="block-type svelte-z6xs5m"> </span> <span class="block-preview svelte-z6xs5m"> </span></button>'), Si = /* @__PURE__ */ H('<div class="block-detail svelte-z6xs5m"><div class="detail-header svelte-z6xs5m"><h4 class="svelte-z6xs5m"> </h4> <button class="copy-btn svelte-z6xs5m"> </button></div> <div class="detail-row svelte-z6xs5m"><span class="label svelte-z6xs5m"> </span> <span class="value"> </span></div> <div class="detail-row svelte-z6xs5m"><span class="label svelte-z6xs5m"> </span> <span class="value"> </span></div> <div class="detail-row svelte-z6xs5m"><span class="label svelte-z6xs5m"> </span> <span> </span></div> <h5> </h5> <pre class="raw-text svelte-z6xs5m"> </pre> <h5> </h5> <div class="json-tree svelte-z6xs5m"></div></div>'), Ai = /* @__PURE__ */ H('<div class="empty-hint svelte-z6xs5m"> </div>'), Oi = /* @__PURE__ */ H('<div class="blocks-tab svelte-z6xs5m"><div class="blocks-list svelte-z6xs5m"></div> <!></div>');
3260
+ const qi = {
3261
+ hash: "svelte-z6xs5m",
3262
+ code: `.blocks-tab.svelte-z6xs5m {display:flex;flex-direction:column;flex:1;overflow:hidden;}.blocks-list.svelte-z6xs5m {max-height:180px;min-height:100px;overflow-y:auto;margin-bottom:12px;flex-shrink:0;}.blocks-list.svelte-z6xs5m::-webkit-scrollbar {width:6px;}.blocks-list.svelte-z6xs5m::-webkit-scrollbar-track {background:transparent;}.blocks-list.svelte-z6xs5m::-webkit-scrollbar-thumb {background:#444;border-radius:3px;}.block-item.svelte-z6xs5m {display:flex;align-items:center;gap:8px;padding:8px;cursor:pointer;border-radius:6px;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;}.block-item.svelte-z6xs5m:hover {background:#2a2a2a;}.block-item.selected.svelte-z6xs5m {background:#3b82f620;}.block-status.svelte-z6xs5m {width:8px;height:8px;border-radius:50%;background:#888;}.block-status.completed.svelte-z6xs5m {background:#22c55e;}.block-status.pending.svelte-z6xs5m {background:#a855f7;}.block-type.svelte-z6xs5m {font-weight:600;min-width:80px;}.block-preview.svelte-z6xs5m {color:#888;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.block-detail.svelte-z6xs5m {flex:1;min-height:0;background:#2a2a2a;padding:12px;border-radius:8px;overflow-y:auto;display:flex;flex-direction:column;}.block-detail.svelte-z6xs5m::-webkit-scrollbar {width:6px;}.block-detail.svelte-z6xs5m::-webkit-scrollbar-track {background:transparent;}.block-detail.svelte-z6xs5m::-webkit-scrollbar-thumb {background:#555;border-radius:3px;}.block-detail.svelte-z6xs5m h4,
3263
+ .block-detail.svelte-z6xs5m h5 {margin:0 0 8px;font-size:12px;color:#888;flex-shrink:0;}.block-detail.svelte-z6xs5m h5 {margin-top:12px;}.detail-header.svelte-z6xs5m {display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;flex-shrink:0;}.detail-header.svelte-z6xs5m h4:where(.svelte-z6xs5m) {margin:0;}.detail-row.svelte-z6xs5m {display:flex;gap:8px;margin-bottom:4px;flex-shrink:0;}.detail-row.svelte-z6xs5m .label:where(.svelte-z6xs5m) {color:#888;min-width:50px;}.detail-row.svelte-z6xs5m .value.completed:where(.svelte-z6xs5m) {color:#22c55e;}.detail-row.svelte-z6xs5m .value.pending:where(.svelte-z6xs5m) {color:#a855f7;}.empty-hint.svelte-z6xs5m {flex:1;display:flex;align-items:center;justify-content:center;color:#888;font-size:13px;background:#2a2a2a;border-radius:8px;}.copy-btn.svelte-z6xs5m {padding:4px 10px;border:none;background:#444;color:#ccc;border-radius:4px;cursor:pointer;font-size:11px;transition:all 0.2s;}.copy-btn.svelte-z6xs5m:hover {background:#555;color:#fff;}.raw-text.svelte-z6xs5m {background:#1a1a1a;padding:12px;border-radius:6px;overflow-x:auto;font-size:11px;white-space:pre-wrap;word-break:break-all;max-height:120px;font-family:monospace;flex-shrink:0;}.json-tree.svelte-z6xs5m {flex:1;min-height:100px;background:#1a1a1a;padding:12px;border-radius:6px;overflow:auto;font-size:12px;}.json-tree.svelte-z6xs5m .json-formatter-row {line-height:1.4;}.light .block-item.svelte-z6xs5m:hover {background:#f5f5f5;}.light .block-item.selected.svelte-z6xs5m {background:#3b82f620;}.light .block-detail.svelte-z6xs5m {background:#f5f5f5;}.light .empty-hint.svelte-z6xs5m {background:#f5f5f5;}.light .copy-btn.svelte-z6xs5m {background:#ddd;color:#666;}.light .copy-btn.svelte-z6xs5m:hover {background:#ccc;color:#333;}.light .raw-text.svelte-z6xs5m,
3264
+ .light .json-tree.svelte-z6xs5m {background:#eee;}`
385
3265
  };
386
- var IncremarkDevTools = class {
387
- container = null;
388
- state = null;
389
- isOpen = false;
390
- activeTab = "overview";
391
- selectedBlockId = null;
392
- appendHistory = [];
393
- lastMarkdownLength = 0;
394
- options;
395
- styleElement = null;
396
- constructor(options = {}) {
397
- this.options = {
398
- open: options.open ?? false,
399
- position: options.position ?? "bottom-right",
400
- theme: options.theme ?? "dark"
3266
+ function zi(e, t) {
3267
+ Qe(t, !0), bt(e, qi);
3268
+ const n = {
3269
+ heading: "#3b82f6",
3270
+ paragraph: "#22c55e",
3271
+ code: "#f59e0b",
3272
+ list: "#8b5cf6",
3273
+ table: "#ec4899",
3274
+ blockquote: "#06b6d4",
3275
+ thematicBreak: "#6b7280"
3276
+ }, r = /* @__PURE__ */ Ot(() => t.devState.blocks.find((d) => d.id === t.selectedBlockId));
3277
+ let o = /* @__PURE__ */ W(void 0);
3278
+ function s(d, u) {
3279
+ return d.length > u ? d.slice(0, u) + "..." : d;
3280
+ }
3281
+ function i(d) {
3282
+ return d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3283
+ }
3284
+ async function a(d) {
3285
+ try {
3286
+ await navigator.clipboard.writeText(JSON.stringify(d, null, 2));
3287
+ } catch (u) {
3288
+ console.error("Copy failed:", u);
3289
+ }
3290
+ }
3291
+ Xr(() => {
3292
+ if (p(r) && p(o)) {
3293
+ const d = new js(p(r).node, 2, { theme: "dark", animateOpen: !1, animateClose: !1 });
3294
+ return p(o).innerHTML = "", p(o).appendChild(d.render()), () => {
3295
+ p(o) && (p(o).innerHTML = "");
3296
+ };
3297
+ }
3298
+ });
3299
+ var l = Oi(), f = m(l);
3300
+ $t(f, 21, () => t.devState.blocks, Qt, (d, u) => {
3301
+ var b = Ci();
3302
+ let E;
3303
+ b.__click = () => t.onSelectBlock(p(u).id);
3304
+ var A = m(b);
3305
+ let k;
3306
+ var x = C(A, 2), O = m(x), w = C(x, 2), j = m(w);
3307
+ Z(
3308
+ (y) => {
3309
+ E = vt(b, 1, "block-item svelte-z6xs5m", null, E, { selected: p(u).id === t.selectedBlockId }), k = vt(A, 1, "block-status svelte-z6xs5m", null, k, {
3310
+ completed: p(u).status === "completed",
3311
+ pending: p(u).status === "pending"
3312
+ }), gs(x, `color: ${(n[p(u).node.type] || "#9ca3af") ?? ""}`), S(O, p(u).node.type), S(j, y);
3313
+ },
3314
+ [() => s(p(u).rawText, 50)]
3315
+ ), D(d, b);
3316
+ });
3317
+ var g = C(f, 2);
3318
+ {
3319
+ var h = (d) => {
3320
+ var u = Si(), b = m(u), E = m(b), A = m(E), k = C(E, 2);
3321
+ k.__click = () => {
3322
+ var Ie;
3323
+ return a((Ie = p(r)) == null ? void 0 : Ie.node);
3324
+ };
3325
+ var x = m(k), O = C(b, 2), w = m(O), j = m(w), y = C(w, 2), M = m(y), L = C(O, 2), $ = m(L), _e = m($), ne = C($, 2), Pe = m(ne), wt = C(L, 2), et = m(wt), Ht = m(et), ue = C(et, 2);
3326
+ let He;
3327
+ var Ut = m(ue), de = C(wt, 2), be = m(de), je = C(de, 2), yt = m(je), xt = C(je, 2), kt = m(xt), jt = C(xt, 2);
3328
+ _s(jt, (Ie) => N(o, Ie), () => p(o)), Z(
3329
+ (Ie, An, On, qn, Ts, Cs, Ss, As) => {
3330
+ S(A, Ie), S(x, An), S(j, `${On ?? ""}:`), S(M, p(r).id), S(_e, `${qn ?? ""}:`), S(Pe, p(r).node.type), S(Ht, `${Ts ?? ""}:`), He = vt(ue, 1, "value svelte-z6xs5m", null, He, {
3331
+ completed: p(r).status === "completed",
3332
+ pending: p(r).status === "pending"
3333
+ }), S(Ut, p(r).status), S(be, Cs), S(yt, Ss), S(kt, As);
3334
+ },
3335
+ [
3336
+ () => t.store.i18n.t("blockDetails"),
3337
+ () => t.store.i18n.t("btnCopy"),
3338
+ () => t.store.i18n.t("blockId"),
3339
+ () => t.store.i18n.t("blockType"),
3340
+ () => t.store.i18n.t("blockStatus"),
3341
+ () => t.store.i18n.t("rawText"),
3342
+ () => i(p(r).rawText),
3343
+ () => t.store.i18n.t("astNode")
3344
+ ]
3345
+ ), D(d, u);
3346
+ }, v = (d) => {
3347
+ var u = Ai(), b = m(u);
3348
+ Z((E) => S(b, E), [() => t.store.i18n.t("selectBlockHint")]), D(d, u);
3349
+ };
3350
+ Ne(g, (d) => {
3351
+ p(r) ? d(h) : d(v, !1);
3352
+ });
3353
+ }
3354
+ D(e, l), $e();
3355
+ }
3356
+ fn(["click"]);
3357
+ var Pi = /* @__PURE__ */ H('<div class="ast-tab svelte-be0ue6"><div class="ast-header svelte-be0ue6"><span class="svelte-be0ue6">AST Tree</span> <button class="copy-btn svelte-be0ue6"> </button></div> <div class="json-tree svelte-be0ue6"></div></div>');
3358
+ const Ii = {
3359
+ hash: "svelte-be0ue6",
3360
+ code: ".ast-tab.svelte-be0ue6 {display:flex;flex-direction:column;flex:1;overflow:hidden;}.ast-header.svelte-be0ue6 {display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;flex-shrink:0;}.ast-header.svelte-be0ue6 span:where(.svelte-be0ue6) {font-weight:600;color:#fff;}.copy-btn.svelte-be0ue6 {padding:4px 10px;border:none;background:#444;color:#ccc;border-radius:4px;cursor:pointer;font-size:11px;transition:all 0.2s;}.copy-btn.svelte-be0ue6:hover {background:#555;color:#fff;}.json-tree.svelte-be0ue6 {flex:1;min-height:100px;background:#1a1a1a;padding:12px;border-radius:6px;overflow:auto;font-size:12px;}.json-tree.svelte-be0ue6 .json-formatter-row {line-height:1.4;}.light .ast-header.svelte-be0ue6 span:where(.svelte-be0ue6) {color:#333;}.light .copy-btn.svelte-be0ue6 {background:#ddd;color:#666;}.light .copy-btn.svelte-be0ue6:hover {background:#ccc;color:#333;}.light .json-tree.svelte-be0ue6 {background:#eee;}"
3361
+ };
3362
+ function Ni(e, t) {
3363
+ Qe(t, !0), bt(e, Ii);
3364
+ let n = /* @__PURE__ */ W(void 0);
3365
+ async function r() {
3366
+ try {
3367
+ await navigator.clipboard.writeText(JSON.stringify(t.ast, null, 2));
3368
+ } catch (f) {
3369
+ console.error("Copy failed:", f);
3370
+ }
3371
+ }
3372
+ Xr(() => {
3373
+ if (t.ast && p(n)) {
3374
+ const f = new js(t.ast, 1, { theme: "dark", animateOpen: !1, animateClose: !1 });
3375
+ return p(n).innerHTML = "", p(n).appendChild(f.render()), () => {
3376
+ p(n).innerHTML = "";
3377
+ };
3378
+ }
3379
+ });
3380
+ var o = Pi(), s = m(o), i = C(m(s), 2);
3381
+ i.__click = r;
3382
+ var a = m(i), l = C(s, 2);
3383
+ _s(l, (f) => N(n, f), () => p(n)), Z((f) => S(a, f), [() => t.store.i18n.t("btnCopy")]), D(e, o), $e();
3384
+ }
3385
+ fn(["click"]);
3386
+ var Mi = /* @__PURE__ */ H('<div class="timeline-item svelte-11jqy0n"><span class="time svelte-11jqy0n"> </span> <span class="chunk svelte-11jqy0n"> </span> <span class="stats svelte-11jqy0n"> </span></div>'), Li = /* @__PURE__ */ H('<div class="timeline-tab svelte-11jqy0n"><div class="timeline-header svelte-11jqy0n"><span> </span> <button class="svelte-11jqy0n"> </button></div> <div class="timeline-list svelte-11jqy0n"></div></div>');
3387
+ const Di = {
3388
+ hash: "svelte-11jqy0n",
3389
+ code: ".timeline-tab.svelte-11jqy0n {display:flex;flex-direction:column;flex:1;overflow:hidden;}.timeline-header.svelte-11jqy0n {display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;flex-shrink:0;}.timeline-header.svelte-11jqy0n button:where(.svelte-11jqy0n) {padding:4px 8px;border:none;background:#333;color:#888;border-radius:4px;cursor:pointer;}.timeline-header.svelte-11jqy0n button:where(.svelte-11jqy0n):hover {background:#444;color:#fff;}.timeline-list.svelte-11jqy0n {flex:1;min-height:0;overflow-y:auto;}.timeline-list.svelte-11jqy0n::-webkit-scrollbar {width:6px;}.timeline-list.svelte-11jqy0n::-webkit-scrollbar-track {background:transparent;}.timeline-list.svelte-11jqy0n::-webkit-scrollbar-thumb {background:#444;border-radius:3px;}.timeline-item.svelte-11jqy0n {display:flex;gap:12px;padding:8px 0;border-bottom:1px solid #333;font-size:12px;}.timeline-item.svelte-11jqy0n .time:where(.svelte-11jqy0n) {color:#888;min-width:70px;}.timeline-item.svelte-11jqy0n .chunk:where(.svelte-11jqy0n) {flex:1;color:#22c55e;font-family:monospace;}.timeline-item.svelte-11jqy0n .stats:where(.svelte-11jqy0n) {color:#888;}.light .timeline-item.svelte-11jqy0n {border-bottom-color:#e0e0e0;}.light .timeline-header.svelte-11jqy0n button:where(.svelte-11jqy0n) {background:#e5e5e5;color:#666;}.light .timeline-header.svelte-11jqy0n button:where(.svelte-11jqy0n):hover {background:#f5f5f5;}"
3390
+ };
3391
+ function Ri(e, t) {
3392
+ Qe(t, !0), bt(e, Di);
3393
+ function n(v) {
3394
+ return new Date(v).toLocaleTimeString();
3395
+ }
3396
+ function r(v, d) {
3397
+ return v.length > d ? v.slice(0, d) + "..." : v;
3398
+ }
3399
+ function o(v) {
3400
+ return v.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3401
+ }
3402
+ var s = Li(), i = m(s), a = m(i), l = m(a), f = C(a, 2);
3403
+ f.__click = function(...v) {
3404
+ var d;
3405
+ (d = t.onClearHistory) == null || d.apply(this, v);
3406
+ };
3407
+ var g = m(f), h = C(i, 2);
3408
+ $t(h, 21, () => t.appendHistory, Qt, (v, d) => {
3409
+ var u = Mi(), b = m(u), E = m(b), A = C(b, 2), k = m(A), x = C(A, 2), O = m(x);
3410
+ Z(
3411
+ (w, j) => {
3412
+ S(E, w), S(k, j), S(O, `C:${p(d).completedCount ?? ""} P:${p(d).pendingCount ?? ""}`);
3413
+ },
3414
+ [
3415
+ () => n(p(d).timestamp),
3416
+ () => o(r(p(d).chunk.replace(/\n/g, "↵"), 30))
3417
+ ]
3418
+ ), D(v, u);
3419
+ }), Z(
3420
+ (v, d) => {
3421
+ S(l, `Total ${t.appendHistory.length ?? ""} ${v ?? ""}`), S(g, d);
3422
+ },
3423
+ [
3424
+ () => t.store.i18n.t("totalAppends"),
3425
+ () => t.store.i18n.t("btnClear")
3426
+ ]
3427
+ ), D(e, s), $e();
3428
+ }
3429
+ fn(["click"]);
3430
+ var Bi = /* @__PURE__ */ H("<option> </option>"), Fi = /* @__PURE__ */ H('<select class="parser-selector svelte-1qjbavw"></select>'), Hi = /* @__PURE__ */ H("<button> </button>"), Ui = /* @__PURE__ */ H('<div class="empty-state svelte-1qjbavw"> </div>'), Ji = /* @__PURE__ */ H('<div><header class="devtools-header svelte-1qjbavw"><h3 class="svelte-1qjbavw"> </h3> <!> <div class="devtools-tabs svelte-1qjbavw"></div> <button class="close-btn svelte-1qjbavw"> </button></header> <main class="devtools-content svelte-1qjbavw"><!></main></div>');
3431
+ const Vi = {
3432
+ hash: "svelte-1qjbavw",
3433
+ code: `.devtools-panel.svelte-1qjbavw {position:absolute;width:450px;height:550px;background:#1e1e1e;border-radius:12px;box-shadow:0 8px 32px rgba(0, 0, 0, 0.4);overflow:hidden;display:none;flex-direction:column;}.devtools-panel.open.svelte-1qjbavw {display:flex;}.bottom-right .devtools-panel.svelte-1qjbavw,
3434
+ .bottom-left .devtools-panel.svelte-1qjbavw {bottom:60px;}.top-right .devtools-panel.svelte-1qjbavw,
3435
+ .top-left .devtools-panel.svelte-1qjbavw {top:60px;}.bottom-right .devtools-panel.svelte-1qjbavw,
3436
+ .top-right .devtools-panel.svelte-1qjbavw {right:0;}.bottom-left .devtools-panel.svelte-1qjbavw,
3437
+ .top-left .devtools-panel.svelte-1qjbavw {left:0;}.devtools-header.svelte-1qjbavw {display:flex;align-items:center;padding:12px 16px;background:#252525;border-bottom:1px solid #333;gap:12px;}.devtools-header.svelte-1qjbavw h3:where(.svelte-1qjbavw) {margin:0;font-size:14px;font-weight:600;color:#fff;white-space:nowrap;}.parser-selector.svelte-1qjbavw {padding:4px 8px;border:1px solid #444;border-radius:4px;background:#2a2a2a;color:#e0e0e0;font-size:12px;cursor:pointer;max-width:140px;}.parser-selector.svelte-1qjbavw:focus {outline:none;border-color:#3b82f6;}.devtools-tabs.svelte-1qjbavw {display:flex;gap:4px;margin-left:auto;margin-right:8px;}.devtools-tabs.svelte-1qjbavw button:where(.svelte-1qjbavw) {padding:4px 10px;border:none;background:transparent;color:#888;cursor:pointer;border-radius:4px;font-size:12px;text-transform:capitalize;}.devtools-tabs.svelte-1qjbavw button:where(.svelte-1qjbavw):hover {background:#333;color:#fff;}.devtools-tabs.svelte-1qjbavw button.active:where(.svelte-1qjbavw) {background:#3b82f6;color:white;}.close-btn.svelte-1qjbavw {width:24px;height:24px;border:none;background:transparent;color:#888;cursor:pointer;font-size:18px;line-height:1;border-radius:4px;}.close-btn.svelte-1qjbavw:hover {color:#fff;background:#333;}.devtools-content.svelte-1qjbavw {flex:1;overflow:hidden;padding:16px;color:#e0e0e0;min-height:200px;display:flex;flex-direction:column;}.empty-state.svelte-1qjbavw {color:#888;text-align:center;padding:40px 20px;}.light .devtools-panel.svelte-1qjbavw {background:#fff;box-shadow:0 8px 32px rgba(0, 0, 0, 0.15);}.light .devtools-header.svelte-1qjbavw {background:#f5f5f5;border-bottom:1px solid #e0e0e0;}.light .devtools-header.svelte-1qjbavw h3:where(.svelte-1qjbavw) {color:#333;}.light .parser-selector.svelte-1qjbavw {background:#fff;border-color:#ddd;color:#333;}.light .devtools-tabs.svelte-1qjbavw button:where(.svelte-1qjbavw) {color:#666;}.light .devtools-tabs.svelte-1qjbavw button:where(.svelte-1qjbavw):hover {background:#e5e5e5;}.light .devtools-content.svelte-1qjbavw {color:#333;}`
3438
+ };
3439
+ function Ki(e, t) {
3440
+ Qe(t, !0), bt(e, Vi);
3441
+ const n = ["overview", "blocks", "ast", "timeline"];
3442
+ function r(k) {
3443
+ const x = k.target;
3444
+ t.onSelectParser(x.value);
3445
+ }
3446
+ var o = Ji();
3447
+ let s;
3448
+ var i = m(o), a = m(i), l = m(a), f = C(a, 2);
3449
+ {
3450
+ var g = (k) => {
3451
+ var x = Fi();
3452
+ x.__change = r, $t(x, 21, () => t.parsers, Qt, (w, j) => {
3453
+ var y = Bi(), M = m(y), L = {};
3454
+ Z(() => {
3455
+ var $;
3456
+ S(M, `${p(j).label ?? ""} ${($ = p(j).state) != null && $.isLoading ? "⏳" : "✅"}`), L !== (L = p(j).id) && (y.value = (y.__value = p(j).id) ?? "");
3457
+ }), D(w, y);
3458
+ });
3459
+ var O;
3460
+ ni(x), Z(() => {
3461
+ O !== (O = t.selectedParserId) && (x.value = (x.__value = t.selectedParserId) ?? "", ms(x, t.selectedParserId));
3462
+ }), D(k, x);
3463
+ };
3464
+ Ne(f, (k) => {
3465
+ t.parsers.length > 1 && k(g);
3466
+ });
3467
+ }
3468
+ var h = C(f, 2);
3469
+ $t(h, 21, () => n, Qt, (k, x) => {
3470
+ var O = Hi();
3471
+ O.__click = () => t.onSetActiveTab(p(x));
3472
+ let w;
3473
+ var j = m(O);
3474
+ Z(
3475
+ (y) => {
3476
+ w = vt(O, 1, "svelte-1qjbavw", null, w, { active: t.activeTab === p(x) }), S(j, y);
3477
+ },
3478
+ [
3479
+ () => t.store.i18n.t(`tab${p(x).charAt(0).toUpperCase() + p(x).slice(1)}`)
3480
+ ]
3481
+ ), D(k, O);
3482
+ });
3483
+ var v = C(h, 2);
3484
+ v.__click = function(...k) {
3485
+ var x;
3486
+ (x = t.onClose) == null || x.apply(this, k);
3487
+ };
3488
+ var d = m(v), u = C(i, 2), b = m(u);
3489
+ {
3490
+ var E = (k) => {
3491
+ var x = vn(), O = un(x);
3492
+ {
3493
+ var w = (y) => {
3494
+ xi(y, {
3495
+ get store() {
3496
+ return t.store;
3497
+ },
3498
+ get devState() {
3499
+ return t.selectedParser.state;
3500
+ }
3501
+ });
3502
+ }, j = (y) => {
3503
+ var M = vn(), L = un(M);
3504
+ {
3505
+ var $ = (ne) => {
3506
+ zi(ne, {
3507
+ get store() {
3508
+ return t.store;
3509
+ },
3510
+ get devState() {
3511
+ return t.selectedParser.state;
3512
+ },
3513
+ get selectedBlockId() {
3514
+ return t.selectedBlockId;
3515
+ },
3516
+ get onSelectBlock() {
3517
+ return t.onSelectBlock;
3518
+ }
3519
+ });
3520
+ }, _e = (ne) => {
3521
+ var Pe = vn(), wt = un(Pe);
3522
+ {
3523
+ var et = (ue) => {
3524
+ Ni(ue, {
3525
+ get store() {
3526
+ return t.store;
3527
+ },
3528
+ get ast() {
3529
+ return t.selectedParser.state.ast;
3530
+ }
3531
+ });
3532
+ }, Ht = (ue) => {
3533
+ var He = vn(), Ut = un(He);
3534
+ {
3535
+ var de = (be) => {
3536
+ Ri(be, {
3537
+ get store() {
3538
+ return t.store;
3539
+ },
3540
+ get appendHistory() {
3541
+ return t.selectedParser.appendHistory;
3542
+ },
3543
+ get onClearHistory() {
3544
+ return t.onClearHistory;
3545
+ }
3546
+ });
3547
+ };
3548
+ Ne(
3549
+ Ut,
3550
+ (be) => {
3551
+ t.activeTab === "timeline" && be(de);
3552
+ },
3553
+ !0
3554
+ );
3555
+ }
3556
+ D(ue, He);
3557
+ };
3558
+ Ne(
3559
+ wt,
3560
+ (ue) => {
3561
+ t.activeTab === "ast" ? ue(et) : ue(Ht, !1);
3562
+ },
3563
+ !0
3564
+ );
3565
+ }
3566
+ D(ne, Pe);
3567
+ };
3568
+ Ne(
3569
+ L,
3570
+ (ne) => {
3571
+ t.activeTab === "blocks" ? ne($) : ne(_e, !1);
3572
+ },
3573
+ !0
3574
+ );
3575
+ }
3576
+ D(y, M);
3577
+ };
3578
+ Ne(O, (y) => {
3579
+ t.activeTab === "overview" ? y(w) : y(j, !1);
3580
+ });
3581
+ }
3582
+ D(k, x);
3583
+ }, A = (k) => {
3584
+ var x = Ui(), O = m(x);
3585
+ Z((w) => S(O, w), [() => t.store.i18n.t("waitingForData")]), D(k, x);
401
3586
  };
402
- this.isOpen = this.options.open;
3587
+ Ne(b, (k) => {
3588
+ var x;
3589
+ (x = t.selectedParser) != null && x.state ? k(E) : k(A, !1);
3590
+ });
3591
+ }
3592
+ Z(
3593
+ (k, x) => {
3594
+ s = vt(o, 1, "devtools-panel svelte-1qjbavw", null, s, { open: t.isOpen }), S(l, k), S(d, x);
3595
+ },
3596
+ [
3597
+ () => t.store.i18n.t("panelTitle"),
3598
+ () => t.store.i18n.t("btnClose")
3599
+ ]
3600
+ ), D(e, o), $e();
3601
+ }
3602
+ fn(["change", "click"]);
3603
+ var Yi = /* @__PURE__ */ H("<div><!> <!></div>");
3604
+ const Wi = {
3605
+ hash: "svelte-1dzy96q",
3606
+ code: ".incremark-devtools.svelte-1dzy96q {position:fixed;z-index:99999;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;font-size:13px;line-height:1.5;}.incremark-devtools.svelte-1dzy96q * {box-sizing:border-box;margin:0;padding:0;}.incremark-devtools.bottom-right.svelte-1dzy96q {bottom:20px;right:20px;}.incremark-devtools.bottom-left.svelte-1dzy96q {bottom:20px;left:20px;}.incremark-devtools.top-right.svelte-1dzy96q {top:20px;right:20px;}.incremark-devtools.top-left.svelte-1dzy96q {top:20px;left:20px;}"
3607
+ };
3608
+ function Gi(e, t) {
3609
+ Qe(t, !0), bt(e, Wi);
3610
+ let n = kr(t, "position", 3, "bottom-right"), r = kr(t, "theme", 3, "dark");
3611
+ var o = Yi(), s = m(o);
3612
+ _i(s, {
3613
+ get store() {
3614
+ return t.store;
3615
+ },
3616
+ get hasLoadingParser() {
3617
+ return t.store.hasLoadingParser;
3618
+ },
3619
+ get parserCount() {
3620
+ return t.store.parsersArray.length;
3621
+ },
3622
+ onToggle: () => t.store.toggle()
3623
+ });
3624
+ var i = C(s, 2);
3625
+ Ki(i, {
3626
+ get store() {
3627
+ return t.store;
3628
+ },
3629
+ get isOpen() {
3630
+ return t.store.isOpen;
3631
+ },
3632
+ get parsers() {
3633
+ return t.store.parsersArray;
3634
+ },
3635
+ get selectedParserId() {
3636
+ return t.store.selectedParserId;
3637
+ },
3638
+ get selectedParser() {
3639
+ return t.store.selectedParser;
3640
+ },
3641
+ get activeTab() {
3642
+ return t.store.activeTab;
3643
+ },
3644
+ get selectedBlockId() {
3645
+ return t.store.selectedBlockId;
3646
+ },
3647
+ onClose: () => t.store.close(),
3648
+ onSelectParser: (a) => t.store.selectParser(a),
3649
+ onSetActiveTab: (a) => t.store.setActiveTab(a),
3650
+ onSelectBlock: (a) => t.store.selectBlock(a),
3651
+ onClearHistory: () => t.store.clearHistory()
3652
+ }), Z(() => vt(o, 1, `incremark-devtools ${n() ?? ""} ${r() ?? ""}`, "svelte-1dzy96q")), D(e, o), $e();
3653
+ }
3654
+ const Er = typeof window < "u" && typeof document < "u";
3655
+ class Es {
3656
+ constructor(t = {}) {
3657
+ K(this, "container", null);
3658
+ K(this, "options");
3659
+ K(this, "svelteComponent", null);
3660
+ K(this, "store");
3661
+ // 挂载状态
3662
+ K(this, "isMounted", !1);
3663
+ // 待注册队列(在 mount 之前调用的 register)
3664
+ K(this, "pendingRegistrations", []);
3665
+ this.options = {
3666
+ open: t.open ?? !1,
3667
+ position: t.position ?? "bottom-right",
3668
+ theme: t.theme ?? "dark",
3669
+ locale: t.locale ?? "en-US"
3670
+ }, this.store = di(this.options);
403
3671
  }
404
3672
  /**
405
3673
  * 挂载 DevTools 到 DOM
3674
+ * 注意:此方法只能在浏览器环境中调用
3675
+ * @returns Promise 完成后返回 this
406
3676
  */
407
- mount(target = "body") {
408
- const parent = typeof target === "string" ? document.querySelector(target) : target;
409
- if (!parent) {
410
- console.warn("[IncremarkDevTools] Mount target not found");
3677
+ mount(t = "body") {
3678
+ if (!Er)
3679
+ return console.warn("[IncremarkDevTools] mount() can only be called in browser environment"), this;
3680
+ if (this.isMounted)
411
3681
  return this;
412
- }
413
- if (!this.styleElement) {
414
- this.styleElement = document.createElement("style");
415
- this.styleElement.textContent = styles;
416
- document.head.appendChild(this.styleElement);
417
- }
418
- this.container = document.createElement("div");
419
- this.container.className = `incremark-devtools ${this.options.position} ${this.options.theme}`;
420
- this.render();
421
- parent.appendChild(this.container);
422
- return this;
3682
+ const n = typeof t == "string" ? document.querySelector(t) : t;
3683
+ if (!n)
3684
+ return console.warn("[IncremarkDevTools] Mount target not found"), this;
3685
+ this.container = document.createElement("div"), this.container.id = "incremark-devtools-root", n.appendChild(this.container), this.svelteComponent = Ko(Gi, {
3686
+ target: this.container,
3687
+ props: {
3688
+ store: this.store,
3689
+ position: this.options.position,
3690
+ theme: this.options.theme
3691
+ }
3692
+ }), this.isMounted = !0;
3693
+ for (const { parser: r, options: o } of this.pendingRegistrations)
3694
+ this.register(r, o);
3695
+ return this.pendingRegistrations = [], this;
423
3696
  }
424
3697
  /**
425
3698
  * 卸载 DevTools
426
3699
  */
427
3700
  unmount() {
428
- if (this.container) {
429
- this.container.remove();
430
- this.container = null;
431
- }
432
- if (this.styleElement) {
433
- this.styleElement.remove();
434
- this.styleElement = null;
435
- }
436
- return this;
3701
+ return Er ? (this.store.destroy(), this.svelteComponent && (Wo(this.svelteComponent), this.svelteComponent = null), this.container && (this.container.remove(), this.container = null), this.isMounted = !1, this) : this;
437
3702
  }
438
3703
  /**
439
- * 更新状态
3704
+ * 注册一个 parser
440
3705
  */
441
- update(state) {
442
- if (state.markdown.length < this.lastMarkdownLength) {
443
- this.appendHistory = [];
444
- this.lastMarkdownLength = 0;
445
- }
446
- if (state.markdown.length > this.lastMarkdownLength) {
447
- const chunk = state.markdown.slice(this.lastMarkdownLength);
448
- this.appendHistory.push({
449
- timestamp: Date.now(),
450
- chunk,
451
- completedCount: state.completedBlocks.length,
452
- pendingCount: state.pendingBlocks.length
453
- });
454
- this.lastMarkdownLength = state.markdown.length;
455
- }
456
- this.state = state;
457
- this.render();
458
- return this;
3706
+ register(t, n) {
3707
+ return this.isMounted ? (this.store.register(t, n), this) : (this.pendingRegistrations.push({ parser: t, options: n }), this);
459
3708
  }
460
3709
  /**
461
- * 重置状态
3710
+ * 注销一个 parser
462
3711
  */
463
- reset() {
464
- this.state = null;
465
- this.appendHistory = [];
466
- this.lastMarkdownLength = 0;
467
- this.selectedBlockId = null;
468
- this.render();
469
- return this;
3712
+ unregister(t) {
3713
+ return this.store.unregister(t), this;
3714
+ }
3715
+ /**
3716
+ * 选择一个 parser
3717
+ */
3718
+ selectParser(t) {
3719
+ return this.store.selectParser(t), this;
470
3720
  }
471
3721
  /**
472
3722
  * 打开面板
473
3723
  */
474
3724
  open() {
475
- this.isOpen = true;
476
- this.render();
477
- return this;
3725
+ return this.store.open(), this;
478
3726
  }
479
3727
  /**
480
3728
  * 关闭面板
481
3729
  */
482
3730
  close() {
483
- this.isOpen = false;
484
- this.render();
485
- return this;
3731
+ return this.store.close(), this;
486
3732
  }
487
3733
  /**
488
3734
  * 切换面板
489
3735
  */
490
3736
  toggle() {
491
- this.isOpen = !this.isOpen;
492
- this.render();
493
- return this;
494
- }
495
- render() {
496
- if (!this.container) return;
497
- const state = this.state;
498
- this.container.innerHTML = `
499
- <button class="devtools-trigger" title="Incremark DevTools">
500
- <span>\u{1F527}</span>
501
- ${state?.isLoading ? '<span class="loading-dot"></span>' : ""}
502
- </button>
503
- <div class="devtools-panel ${this.isOpen ? "open" : ""}">
504
- <header class="devtools-header">
505
- <h3>Incremark DevTools</h3>
506
- <div class="devtools-tabs">
507
- ${["overview", "blocks", "ast", "timeline"].map((tab) => `
508
- <button class="${this.activeTab === tab ? "active" : ""}" data-tab="${tab}">
509
- ${tab}
510
- </button>
511
- `).join("")}
512
- </div>
513
- <button class="close-btn">\xD7</button>
514
- </header>
515
- <main class="devtools-content">
516
- ${this.renderTabContent()}
517
- </main>
518
- </div>
519
- `;
520
- this.bindEvents();
521
- }
522
- renderTabContent() {
523
- const state = this.state;
524
- if (!state) {
525
- return '<div style="color: #888; text-align: center;">\u7B49\u5F85\u6570\u636E...</div>';
526
- }
527
- switch (this.activeTab) {
528
- case "overview":
529
- return this.renderOverview(state);
530
- case "blocks":
531
- return this.renderBlocks(state);
532
- case "ast":
533
- return this.renderAst(state);
534
- case "timeline":
535
- return this.renderTimeline();
536
- default:
537
- return "";
538
- }
539
- }
540
- renderOverview(state) {
541
- const nodeTypeStats = {};
542
- for (const block of state.blocks) {
543
- const type = block.node.type;
544
- nodeTypeStats[type] = (nodeTypeStats[type] || 0) + 1;
545
- }
546
- return `
547
- <div class="stats-grid">
548
- <div class="stat-card">
549
- <div class="stat-value">${state.markdown.length}</div>
550
- <div class="stat-label">\u5B57\u7B26</div>
551
- </div>
552
- <div class="stat-card">
553
- <div class="stat-value">${state.blocks.length}</div>
554
- <div class="stat-label">\u603B\u5757\u6570</div>
555
- </div>
556
- <div class="stat-card completed">
557
- <div class="stat-value">${state.completedBlocks.length}</div>
558
- <div class="stat-label">\u5DF2\u5B8C\u6210</div>
559
- </div>
560
- <div class="stat-card pending">
561
- <div class="stat-value">${state.pendingBlocks.length}</div>
562
- <div class="stat-label">\u5F85\u5904\u7406</div>
563
- </div>
564
- </div>
565
-
566
- <div class="section">
567
- <h4>\u8282\u70B9\u7C7B\u578B\u5206\u5E03</h4>
568
- <div class="type-bars">
569
- ${Object.entries(nodeTypeStats).map(([type, count]) => `
570
- <div class="type-bar">
571
- <span class="type-color" style="background: ${NODE_TYPE_COLORS[type] || "#9ca3af"}"></span>
572
- <span class="type-name">${type}</span>
573
- <span class="type-count">${count}</span>
574
- </div>
575
- `).join("")}
576
- </div>
577
- </div>
578
-
579
- <div class="section">
580
- <h4>\u72B6\u6001</h4>
581
- <div class="status-indicator ${state.isLoading ? "loading" : ""}">
582
- ${state.isLoading ? "\u{1F504} \u89E3\u6790\u4E2D..." : "\u2705 \u7A7A\u95F2"}
583
- </div>
584
- </div>
585
- `;
586
- }
587
- renderBlocks(state) {
588
- const selectedBlock = state.blocks.find((b) => b.id === this.selectedBlockId);
589
- return `
590
- <div class="blocks-list">
591
- ${state.blocks.map((block) => `
592
- <div class="block-item ${block.id === this.selectedBlockId ? "selected" : ""}"
593
- data-block-id="${block.id}">
594
- <span class="block-status ${block.status}"></span>
595
- <span class="block-type" style="color: ${NODE_TYPE_COLORS[block.node.type] || "#9ca3af"}">
596
- ${block.node.type}
597
- </span>
598
- <span class="block-preview">${this.truncate(block.rawText, 50)}</span>
599
- </div>
600
- `).join("")}
601
- </div>
602
- ${selectedBlock ? `
603
- <div class="block-detail">
604
- <h4>\u5757\u8BE6\u60C5</h4>
605
- <div class="detail-row">
606
- <span class="label">ID:</span>
607
- <span class="value">${selectedBlock.id}</span>
608
- </div>
609
- <div class="detail-row">
610
- <span class="label">\u7C7B\u578B:</span>
611
- <span class="value">${selectedBlock.node.type}</span>
612
- </div>
613
- <div class="detail-row">
614
- <span class="label">\u72B6\u6001:</span>
615
- <span class="value ${selectedBlock.status}">${selectedBlock.status}</span>
616
- </div>
617
- <div class="detail-row">
618
- <span class="label">\u8303\u56F4:</span>
619
- <span class="value">${selectedBlock.startOffset} - ${selectedBlock.endOffset}</span>
620
- </div>
621
- <h5>\u539F\u59CB\u6587\u672C</h5>
622
- <pre class="raw-text">${this.escapeHtml(selectedBlock.rawText)}</pre>
623
- <h5>AST \u8282\u70B9</h5>
624
- <pre class="ast-json">${this.escapeHtml(JSON.stringify(selectedBlock.node, null, 2))}</pre>
625
- </div>
626
- ` : ""}
627
- `;
628
- }
629
- renderAst(state) {
630
- return `<pre class="ast-tree">${this.escapeHtml(JSON.stringify(state.ast, null, 2))}</pre>`;
631
- }
632
- renderTimeline() {
633
- return `
634
- <div class="timeline-header">
635
- <span>\u5171 ${this.appendHistory.length} \u6B21 append</span>
636
- <button data-action="clear-history">\u6E05\u7A7A</button>
637
- </div>
638
- <div class="timeline-list">
639
- ${this.appendHistory.map((record, i) => `
640
- <div class="timeline-item">
641
- <span class="time">${this.formatTime(record.timestamp)}</span>
642
- <span class="chunk">${this.escapeHtml(this.truncate(record.chunk.replace(/\n/g, "\u21B5"), 30))}</span>
643
- <span class="stats">\u2705${record.completedCount} \u23F3${record.pendingCount}</span>
644
- </div>
645
- `).join("")}
646
- </div>
647
- `;
648
- }
649
- bindEvents() {
650
- if (!this.container) return;
651
- const trigger = this.container.querySelector(".devtools-trigger");
652
- trigger?.addEventListener("click", () => this.toggle());
653
- const closeBtn = this.container.querySelector(".close-btn");
654
- closeBtn?.addEventListener("click", () => this.close());
655
- const tabs = this.container.querySelectorAll(".devtools-tabs button");
656
- tabs.forEach((tab) => {
657
- tab.addEventListener("click", () => {
658
- const tabName = tab.getAttribute("data-tab");
659
- if (tabName) {
660
- this.activeTab = tabName;
661
- this.render();
662
- }
663
- });
664
- });
665
- const blockItems = this.container.querySelectorAll(".block-item");
666
- blockItems.forEach((item) => {
667
- item.addEventListener("click", () => {
668
- const blockId = item.getAttribute("data-block-id");
669
- if (blockId) {
670
- this.selectedBlockId = blockId;
671
- this.render();
672
- }
673
- });
674
- });
675
- const clearBtn = this.container.querySelector('[data-action="clear-history"]');
676
- clearBtn?.addEventListener("click", () => {
677
- this.appendHistory = [];
678
- this.render();
679
- });
3737
+ return this.store.toggle(), this;
680
3738
  }
681
- truncate(str, len) {
682
- if (str.length <= len) return str;
683
- return str.slice(0, len) + "...";
684
- }
685
- formatTime(timestamp) {
686
- return new Date(timestamp).toLocaleTimeString();
687
- }
688
- escapeHtml(str) {
689
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
690
- }
691
- };
692
- function createDevTools(options) {
693
- return new IncremarkDevTools(options);
694
- }
695
- function mountDevTools(options) {
696
- const devtools = new IncremarkDevTools(options);
697
- if (typeof document !== "undefined") {
698
- if (document.readyState === "loading") {
699
- document.addEventListener("DOMContentLoaded", () => devtools.mount());
700
- } else {
701
- devtools.mount();
702
- }
703
- }
704
- return (state) => {
705
- const blocks = [
706
- ...state.completedBlocks,
707
- ...state.pendingBlocks
708
- ];
709
- devtools.update({
710
- blocks,
711
- completedBlocks: state.completedBlocks,
712
- pendingBlocks: state.pendingBlocks,
713
- markdown: state.markdown,
714
- ast: state.ast,
715
- isLoading: state.pendingBlocks.length > 0
716
- });
3739
+ }
3740
+ function ea(e) {
3741
+ return new Es(e);
3742
+ }
3743
+ function ta(e) {
3744
+ const t = new Es(e);
3745
+ return typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => t.mount()) : t.mount()), () => {
3746
+ console.warn("[IncremarkDevTools] mountDevTools callback is deprecated, use register() instead");
717
3747
  };
718
3748
  }
719
3749
  export {
720
- IncremarkDevTools,
721
- createDevTools,
722
- mountDevTools
3750
+ Es as IncremarkDevTools,
3751
+ ea as createDevTools,
3752
+ ui as createI18n,
3753
+ Qi as getLocale,
3754
+ ta as mountDevTools,
3755
+ ci as setLocale,
3756
+ $i as t
723
3757
  };
3758
+ //# sourceMappingURL=index.js.map