playlight-sdk 0.0.1

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.
@@ -0,0 +1,3737 @@
1
+ const e = false;
2
+ var t = Array.isArray, n = Array.prototype.indexOf, i = Array.from, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyDescriptors, l = Object.prototype, c = Array.prototype, u = Object.getPrototypeOf;
3
+ function is_function(e2) {
4
+ return "function" == typeof e2;
5
+ }
6
+ const noop = () => {
7
+ };
8
+ function run(e2) {
9
+ return e2();
10
+ }
11
+ function run_all(e2) {
12
+ for (var t2 = 0; t2 < e2.length; t2++) e2[t2]();
13
+ }
14
+ const d = 32, f = 128, p = 256, _ = 512, v = 1024, g = 2048, h = 4096, m = 8192, b = 16384, y = 65536, $ = 1 << 20, w = Symbol("$state"), x = Symbol("legacy props"), k = Symbol("");
15
+ function equals(e2) {
16
+ return e2 === this.v;
17
+ }
18
+ function safe_not_equal(e2, t2) {
19
+ return e2 != e2 ? t2 == t2 : e2 !== t2 || null !== e2 && "object" == typeof e2 || "function" == typeof e2;
20
+ }
21
+ function safe_equals(e2) {
22
+ return !safe_not_equal(e2, this.v);
23
+ }
24
+ let C = false;
25
+ const M = Symbol(), S = "http://www.w3.org/2000/svg";
26
+ function lifecycle_outside_component(e2) {
27
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
28
+ }
29
+ let T = null;
30
+ function set_component_context(e2) {
31
+ T = e2;
32
+ }
33
+ function push(e2, t2 = false, n2) {
34
+ T = {
35
+ p: T,
36
+ c: null,
37
+ e: null,
38
+ m: false,
39
+ s: e2,
40
+ x: null,
41
+ l: null
42
+ }, C && !t2 && (T.l = {
43
+ s: null,
44
+ u: null,
45
+ r1: [],
46
+ r2: source(false)
47
+ });
48
+ }
49
+ function pop(e2) {
50
+ const t2 = T;
51
+ if (null !== t2) {
52
+ const e3 = t2.e;
53
+ if (null !== e3) {
54
+ var n2 = H, i2 = F;
55
+ t2.e = null;
56
+ try {
57
+ for (var o2 = 0; o2 < e3.length; o2++) {
58
+ var s2 = e3[o2];
59
+ set_active_effect(s2.effect), set_active_reaction(s2.reaction), effect(s2.fn);
60
+ }
61
+ } finally {
62
+ set_active_effect(n2), set_active_reaction(i2);
63
+ }
64
+ }
65
+ T = t2.p, t2.m = true;
66
+ }
67
+ return {};
68
+ }
69
+ function is_runes() {
70
+ return !C || null !== T && null === T.l;
71
+ }
72
+ function source(e2, t2) {
73
+ return {
74
+ f: 0,
75
+ // TODO ideally we could skip this altogether, but it causes type errors
76
+ v: e2,
77
+ reactions: null,
78
+ equals,
79
+ rv: 0,
80
+ wv: 0
81
+ };
82
+ }
83
+ function state(e2) {
84
+ return /* @__PURE__ */ push_derived_source(source(e2));
85
+ }
86
+ // @__NO_SIDE_EFFECTS__
87
+ function mutable_source(e2, t2 = false) {
88
+ var _a;
89
+ const n2 = source(e2);
90
+ return t2 || (n2.equals = safe_equals), // bind the signal to the component context, in case we need to
91
+ // track updates to trigger beforeUpdate/afterUpdate callbacks
92
+ C && null !== T && null !== T.l && ((_a = T.l).s ?? (_a.s = [])).push(n2), n2;
93
+ }
94
+ function mutable_state(e2, t2 = false) {
95
+ return /* @__PURE__ */ push_derived_source(/* @__PURE__ */ mutable_source(e2, t2));
96
+ }
97
+ // @__NO_SIDE_EFFECTS__
98
+ function push_derived_source(e2) {
99
+ return null !== F && !G && 2 & F.f && (null === R ? (
100
+ /**
101
+ * @param {Source[] | null} sources
102
+ */
103
+ function set_derived_sources(e3) {
104
+ R = e3;
105
+ }([e2])
106
+ ) : R.push(e2)), e2;
107
+ }
108
+ function set(e2, t2) {
109
+ return null !== F && !G && is_runes() && 18 & F.f && // If the source was created locally within the current derived, then
110
+ // we allow the mutation.
111
+ (null === R || !R.includes(e2)) && /**
112
+ * Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
113
+ * @returns {never}
114
+ */
115
+ function state_unsafe_mutation() {
116
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
117
+ }(), internal_set(e2, t2);
118
+ }
119
+ function internal_set(e2, t2) {
120
+ return e2.equals(t2) || (e2.v, e2.v = t2, e2.wv = increment_write_version(), mark_reactions(e2, g), // It's possible that the current reaction might not have up-to-date dependencies
121
+ // whilst it's actively running. So in the case of ensuring it registers the reaction
122
+ // properly for itself, we need to ensure the current effect actually gets
123
+ // scheduled. i.e: `$effect(() => x++)`
124
+ is_runes() && null !== H && H.f & v && !(96 & H.f) && (null === U ? (
125
+ /** @param {null | Source[]} value */
126
+ function set_untracked_writes(e3) {
127
+ U = e3;
128
+ }([e2])
129
+ ) : U.push(e2))), t2;
130
+ }
131
+ function update(e2, t2 = 1) {
132
+ var n2 = get$1(e2), i2 = 1 === t2 ? n2++ : n2--;
133
+ return set(e2, n2), i2;
134
+ }
135
+ function mark_reactions(e2, t2) {
136
+ var n2 = e2.reactions;
137
+ if (null !== n2) for (var i2 = is_runes(), o2 = n2.length, s2 = 0; s2 < o2; s2++) {
138
+ var a2 = n2[s2], l2 = a2.f;
139
+ l2 & g || // In legacy mode, skip the current effect to prevent infinite loops
140
+ (i2 || a2 !== H) && (set_signal_status(a2, t2), // If the signal a) was previously clean or b) is an unowned derived, then mark it
141
+ 1280 & l2 && (2 & l2 ? mark_reactions(
142
+ /** @type {Derived} */
143
+ a2,
144
+ h
145
+ ) : schedule_effect(
146
+ /** @type {Effect} */
147
+ a2
148
+ )));
149
+ }
150
+ }
151
+ function proxy(e2, n2 = null, i2) {
152
+ if ("object" != typeof e2 || null === e2 || w in e2) return e2;
153
+ const o2 = u(e2);
154
+ if (o2 !== l && o2 !== c) return e2;
155
+ var a2, d2 = /* @__PURE__ */ new Map(), f2 = t(e2), p2 = source(0);
156
+ return f2 && // We need to create the length source eagerly to ensure that
157
+ // mutations to the array are properly synced with our proxy
158
+ d2.set("length", source(
159
+ /** @type {any[]} */
160
+ e2.length
161
+ )), new Proxy(
162
+ /** @type {any} */
163
+ e2,
164
+ {
165
+ defineProperty(e3, t2, n3) {
166
+ "value" in n3 && false !== n3.configurable && false !== n3.enumerable && false !== n3.writable || // we disallow non-basic descriptors, because unless they are applied to the
167
+ // target object — which we avoid, so that state can be forked — we will run
168
+ // afoul of the various invariants
169
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants
170
+ /**
171
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
172
+ * @returns {never}
173
+ */
174
+ function state_descriptors_fixed() {
175
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
176
+ }();
177
+ var i3 = d2.get(t2);
178
+ return void 0 === i3 ? (i3 = source(n3.value), d2.set(t2, i3)) : set(i3, proxy(n3.value, a2)), true;
179
+ },
180
+ deleteProperty(e3, t2) {
181
+ var n3 = d2.get(t2);
182
+ if (void 0 === n3) t2 in e3 && d2.set(t2, source(M));
183
+ else {
184
+ if (f2 && "string" == typeof t2) {
185
+ var i3 = (
186
+ /** @type {Source<number>} */
187
+ d2.get("length")
188
+ ), o3 = Number(t2);
189
+ Number.isInteger(o3) && o3 < i3.v && set(i3, o3);
190
+ }
191
+ set(n3, M), update_version(p2);
192
+ }
193
+ return true;
194
+ },
195
+ get(t2, n3, i3) {
196
+ var _a;
197
+ if (n3 === w) return e2;
198
+ var o3 = d2.get(n3), l2 = n3 in t2;
199
+ if (
200
+ // create a source, but only if it's an own property and not a prototype property
201
+ void 0 !== o3 || l2 && !((_a = s(t2, n3)) == null ? void 0 : _a.writable) || (o3 = source(proxy(l2 ? t2[n3] : M, a2)), d2.set(n3, o3)), void 0 !== o3
202
+ ) {
203
+ var c2 = get$1(o3);
204
+ return c2 === M ? void 0 : c2;
205
+ }
206
+ return Reflect.get(t2, n3, i3);
207
+ },
208
+ getOwnPropertyDescriptor(e3, t2) {
209
+ var n3 = Reflect.getOwnPropertyDescriptor(e3, t2);
210
+ if (n3 && "value" in n3) {
211
+ var i3 = d2.get(t2);
212
+ i3 && (n3.value = get$1(i3));
213
+ } else if (void 0 === n3) {
214
+ var o3 = d2.get(t2), s2 = o3 == null ? void 0 : o3.v;
215
+ if (void 0 !== o3 && s2 !== M) return {
216
+ enumerable: true,
217
+ configurable: true,
218
+ value: s2,
219
+ writable: true
220
+ };
221
+ }
222
+ return n3;
223
+ },
224
+ has(e3, t2) {
225
+ var _a;
226
+ if (t2 === w) return true;
227
+ var n3 = d2.get(t2), i3 = void 0 !== n3 && n3.v !== M || Reflect.has(e3, t2);
228
+ if ((void 0 !== n3 || null !== H && (!i3 || ((_a = s(e3, t2)) == null ? void 0 : _a.writable))) && (void 0 === n3 && (n3 = source(i3 ? proxy(e3[t2], a2) : M), d2.set(t2, n3)), get$1(n3) === M)) return false;
229
+ return i3;
230
+ },
231
+ set(e3, t2, n3, i3) {
232
+ var _a;
233
+ var o3 = d2.get(t2), l2 = t2 in e3;
234
+ if (f2 && "length" === t2) for (var c2 = n3; c2 < /** @type {Source<number>} */
235
+ o3.v; c2 += 1) {
236
+ var u2 = d2.get(c2 + "");
237
+ void 0 !== u2 ? set(u2, M) : c2 in e3 && // If the item exists in the original, we need to create a uninitialized source,
238
+ // else a later read of the property would result in a source being created with
239
+ // the value of the original item at that index.
240
+ (u2 = source(M), d2.set(c2 + "", u2));
241
+ }
242
+ void 0 === o3 ? l2 && !((_a = s(e3, t2)) == null ? void 0 : _a.writable) || (set(o3 = source(void 0), proxy(n3, a2)), d2.set(t2, o3)) : (l2 = o3.v !== M, set(o3, proxy(n3, a2)));
243
+ var _2 = Reflect.getOwnPropertyDescriptor(e3, t2);
244
+ if ((_2 == null ? void 0 : _2.set) && _2.set.call(i3, n3), !l2) {
245
+ if (f2 && "string" == typeof t2) {
246
+ var v2 = (
247
+ /** @type {Source<number>} */
248
+ d2.get("length")
249
+ ), g2 = Number(t2);
250
+ Number.isInteger(g2) && g2 >= v2.v && set(v2, g2 + 1);
251
+ }
252
+ update_version(p2);
253
+ }
254
+ return true;
255
+ },
256
+ ownKeys(e3) {
257
+ get$1(p2);
258
+ var t2 = Reflect.ownKeys(e3).filter((e4) => {
259
+ var t3 = d2.get(e4);
260
+ return void 0 === t3 || t3.v !== M;
261
+ });
262
+ for (var [n3, i3] of d2) i3.v === M || n3 in e3 || t2.push(n3);
263
+ return t2;
264
+ },
265
+ setPrototypeOf() {
266
+ !function state_prototype_fixed() {
267
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
268
+ }();
269
+ }
270
+ }
271
+ );
272
+ }
273
+ function update_version(e2, t2 = 1) {
274
+ set(e2, e2.v + t2);
275
+ }
276
+ var q, I, P, O, E;
277
+ function create_text(e2 = "") {
278
+ return document.createTextNode(e2);
279
+ }
280
+ // @__NO_SIDE_EFFECTS__
281
+ function get_first_child(e2) {
282
+ return O.call(e2);
283
+ }
284
+ // @__NO_SIDE_EFFECTS__
285
+ function get_next_sibling(e2) {
286
+ return E.call(e2);
287
+ }
288
+ function child(e2, t2) {
289
+ return /* @__PURE__ */ get_first_child(e2);
290
+ }
291
+ function first_child(e2, t2) {
292
+ var n2 = (
293
+ /** @type {DocumentFragment} */
294
+ /* @__PURE__ */ get_first_child(
295
+ /** @type {Node} */
296
+ e2
297
+ )
298
+ );
299
+ return n2 instanceof Comment && "" === n2.data ? /* @__PURE__ */ get_next_sibling(n2) : n2;
300
+ }
301
+ function sibling(e2, t2 = 1, n2 = false) {
302
+ let i2 = e2;
303
+ for (; t2--; ) i2 = /** @type {TemplateNode} */
304
+ /* @__PURE__ */ get_next_sibling(i2);
305
+ return i2;
306
+ }
307
+ // @__NO_SIDE_EFFECTS__
308
+ function derived(e2) {
309
+ var t2 = 2050, n2 = null !== F && 2 & F.f ? (
310
+ /** @type {Derived} */
311
+ F
312
+ ) : null;
313
+ null === H || null !== n2 && n2.f & p ? t2 |= p : (
314
+ // Since deriveds are evaluated lazily, any effects created inside them are
315
+ // created too late to ensure that the parent effect is added to the tree
316
+ H.f |= $
317
+ );
318
+ return {
319
+ ctx: T,
320
+ deps: null,
321
+ effects: null,
322
+ equals,
323
+ f: t2,
324
+ fn: e2,
325
+ reactions: null,
326
+ rv: 0,
327
+ v: (
328
+ /** @type {V} */
329
+ null
330
+ ),
331
+ wv: 0,
332
+ parent: n2 ?? H
333
+ };
334
+ }
335
+ // @__NO_SIDE_EFFECTS__
336
+ function derived_safe_equal(e2) {
337
+ const t2 = /* @__PURE__ */ derived(e2);
338
+ return t2.equals = safe_equals, t2;
339
+ }
340
+ function destroy_derived_effects(e2) {
341
+ var t2 = e2.effects;
342
+ if (null !== t2) {
343
+ e2.effects = null;
344
+ for (var n2 = 0; n2 < t2.length; n2 += 1) destroy_effect(
345
+ /** @type {Effect} */
346
+ t2[n2]
347
+ );
348
+ }
349
+ }
350
+ function update_derived(e2) {
351
+ var t2 = (
352
+ /**
353
+ * @template T
354
+ * @param {Derived} derived
355
+ * @returns {T}
356
+ */
357
+ function execute_derived(e3) {
358
+ var t3, n2 = H;
359
+ set_active_effect(function get_derived_parent_effect(e4) {
360
+ for (var t4 = e4.parent; null !== t4; ) {
361
+ if (!(2 & t4.f))
362
+ return t4;
363
+ t4 = t4.parent;
364
+ }
365
+ return null;
366
+ }(e3));
367
+ try {
368
+ destroy_derived_effects(e3), t3 = update_reaction(e3);
369
+ } finally {
370
+ set_active_effect(n2);
371
+ }
372
+ return t3;
373
+ }(e2)
374
+ );
375
+ set_signal_status(e2, (J || e2.f & p) && null !== e2.deps ? h : v), e2.equals(t2) || (e2.v = t2, e2.wv = increment_write_version());
376
+ }
377
+ function validate_effect(e2) {
378
+ null === H && null === F && /**
379
+ * `%rune%` can only be used inside an effect (e.g. during component initialisation)
380
+ * @param {string} rune
381
+ * @returns {never}
382
+ */
383
+ function effect_orphan(e3) {
384
+ throw new Error("https://svelte.dev/e/effect_orphan");
385
+ }(), null !== F && F.f & p && null === H && /**
386
+ * Effect cannot be created inside a `$derived` value that was not itself created inside an effect
387
+ * @returns {never}
388
+ */
389
+ function effect_in_unowned_derived() {
390
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
391
+ }(), L && function effect_in_teardown(e3) {
392
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
393
+ }();
394
+ }
395
+ function create_effect(e2, t2, n2, i2 = true) {
396
+ var o2 = !!(64 & e2), s2 = H, a2 = {
397
+ ctx: T,
398
+ deps: null,
399
+ nodes_start: null,
400
+ nodes_end: null,
401
+ f: e2 | g,
402
+ first: null,
403
+ fn: t2,
404
+ last: null,
405
+ next: null,
406
+ parent: o2 ? null : s2,
407
+ prev: null,
408
+ teardown: null,
409
+ transitions: null,
410
+ wv: 0
411
+ };
412
+ if (n2) try {
413
+ update_effect(a2), a2.f |= 32768;
414
+ } catch (e3) {
415
+ throw destroy_effect(a2), e3;
416
+ }
417
+ else null !== t2 && schedule_effect(a2);
418
+ if (!(n2 && null === a2.deps && null === a2.first && null === a2.nodes_start && null === a2.teardown && !(1048704 & a2.f)) && !o2 && i2 && (null !== s2 && function push_effect(e3, t3) {
419
+ var n3 = t3.last;
420
+ null === n3 ? t3.last = t3.first = e3 : (n3.next = e3, e3.prev = n3, t3.last = e3);
421
+ }(a2, s2), null !== F && 2 & F.f)) {
422
+ var l2 = (
423
+ /** @type {Derived} */
424
+ F
425
+ );
426
+ (l2.effects ?? (l2.effects = [])).push(a2);
427
+ }
428
+ return a2;
429
+ }
430
+ function teardown(e2) {
431
+ const t2 = create_effect(8, null, false);
432
+ return set_signal_status(t2, v), t2.teardown = e2, t2;
433
+ }
434
+ function user_effect(e2) {
435
+ if (validate_effect(), !(null !== H && !!(H.f & d) && null !== T && !T.m)) return effect(e2);
436
+ var t2 = (
437
+ /** @type {ComponentContext} */
438
+ T
439
+ );
440
+ (t2.e ?? (t2.e = [])).push({
441
+ fn: e2,
442
+ effect: H,
443
+ reaction: F
444
+ });
445
+ }
446
+ function effect(e2) {
447
+ return create_effect(4, e2, false);
448
+ }
449
+ function legacy_pre_effect(e2, t2) {
450
+ var n2 = (
451
+ /** @type {ComponentContextLegacy} */
452
+ T
453
+ ), i2 = {
454
+ effect: null,
455
+ ran: false
456
+ };
457
+ n2.l.r1.push(i2), i2.effect = render_effect(() => {
458
+ e2(), // If this legacy pre effect has already run before the end of the reset, then
459
+ // bail out to emulate the same behavior.
460
+ i2.ran || (i2.ran = true, set(n2.l.r2, true), untrack(t2));
461
+ });
462
+ }
463
+ function legacy_pre_effect_reset() {
464
+ var e2 = (
465
+ /** @type {ComponentContextLegacy} */
466
+ T
467
+ );
468
+ render_effect(() => {
469
+ if (get$1(e2.l.r2)) {
470
+ for (var t2 of e2.l.r1) {
471
+ var n2 = t2.effect;
472
+ n2.f & v && set_signal_status(n2, h), check_dirtiness(n2) && update_effect(n2), t2.ran = false;
473
+ }
474
+ e2.l.r2.v = false;
475
+ }
476
+ });
477
+ }
478
+ function render_effect(e2) {
479
+ return create_effect(8, e2, true);
480
+ }
481
+ function template_effect(e2, t2 = [], n2 = derived) {
482
+ const i2 = t2.map(n2);
483
+ return block(() => e2(...i2.map(get$1)));
484
+ }
485
+ function block(e2, t2 = 0) {
486
+ return create_effect(24 | t2, e2, true);
487
+ }
488
+ function branch(e2, t2 = true) {
489
+ return create_effect(40, e2, true, t2);
490
+ }
491
+ function execute_effect_teardown(e2) {
492
+ var t2 = e2.teardown;
493
+ if (null !== t2) {
494
+ const e3 = L, n2 = F;
495
+ set_is_destroying_effect(true), set_active_reaction(null);
496
+ try {
497
+ t2.call(null);
498
+ } finally {
499
+ set_is_destroying_effect(e3), set_active_reaction(n2);
500
+ }
501
+ }
502
+ }
503
+ function destroy_effect_children(e2, t2 = false) {
504
+ var n2 = e2.first;
505
+ for (e2.first = e2.last = null; null !== n2; ) {
506
+ var i2 = n2.next;
507
+ destroy_effect(n2, t2), n2 = i2;
508
+ }
509
+ }
510
+ function destroy_effect(e2, t2 = true) {
511
+ var n2 = false;
512
+ if ((t2 || 524288 & e2.f) && null !== e2.nodes_start) {
513
+ for (var i2 = e2.nodes_start, o2 = e2.nodes_end; null !== i2; ) {
514
+ var s2 = i2 === o2 ? null : (
515
+ /** @type {TemplateNode} */
516
+ /* @__PURE__ */ get_next_sibling(i2)
517
+ );
518
+ i2.remove(), i2 = s2;
519
+ }
520
+ n2 = true;
521
+ }
522
+ destroy_effect_children(e2, t2 && !n2), remove_reactions(e2, 0), set_signal_status(e2, b);
523
+ var a2 = e2.transitions;
524
+ if (null !== a2) for (const e3 of a2) e3.stop();
525
+ execute_effect_teardown(e2);
526
+ var l2 = e2.parent;
527
+ null !== l2 && null !== l2.first && unlink_effect(e2), // `first` and `child` are nulled out in destroy_effect_children
528
+ // we don't null out `parent` so that error propagation can work correctly
529
+ e2.next = e2.prev = e2.teardown = e2.ctx = e2.deps = e2.fn = e2.nodes_start = e2.nodes_end = null;
530
+ }
531
+ function unlink_effect(e2) {
532
+ var t2 = e2.parent, n2 = e2.prev, i2 = e2.next;
533
+ null !== n2 && (n2.next = i2), null !== i2 && (i2.prev = n2), null !== t2 && (t2.first === e2 && (t2.first = i2), t2.last === e2 && (t2.last = n2));
534
+ }
535
+ function pause_effect(e2, t2) {
536
+ var n2 = [];
537
+ pause_children(e2, n2, true), run_out_transitions(n2, () => {
538
+ destroy_effect(e2), t2 && t2();
539
+ });
540
+ }
541
+ function run_out_transitions(e2, t2) {
542
+ var n2 = e2.length;
543
+ if (n2 > 0) {
544
+ var check = () => --n2 || t2();
545
+ for (var i2 of e2) i2.out(check);
546
+ } else t2();
547
+ }
548
+ function pause_children(e2, t2, n2) {
549
+ if (!(e2.f & m)) {
550
+ if (e2.f ^= m, null !== e2.transitions) for (const i3 of e2.transitions) (i3.is_global || n2) && t2.push(i3);
551
+ for (var i2 = e2.first; null !== i2; ) {
552
+ var o2 = i2.next;
553
+ pause_children(i2, t2, !!(!!(i2.f & y) || !!(i2.f & d)) && n2), i2 = o2;
554
+ }
555
+ }
556
+ }
557
+ function resume_effect(e2) {
558
+ resume_children(e2, true);
559
+ }
560
+ function resume_children(e2, t2) {
561
+ if (e2.f & m) {
562
+ e2.f ^= m, // Ensure the effect is marked as clean again so that any dirty child
563
+ // effects can schedule themselves for execution
564
+ e2.f & v || (e2.f ^= v), // If a dependency of this effect changed while it was paused,
565
+ // schedule the effect to update
566
+ check_dirtiness(e2) && (set_signal_status(e2, g), schedule_effect(e2));
567
+ for (var n2 = e2.first; null !== n2; ) {
568
+ var i2 = n2.next;
569
+ resume_children(n2, !!(!!(n2.f & y) || !!(n2.f & d)) && t2), n2 = i2;
570
+ }
571
+ if (null !== e2.transitions) for (const n3 of e2.transitions) (n3.is_global || t2) && n3.in();
572
+ }
573
+ }
574
+ let j = [], N = [];
575
+ function run_micro_tasks() {
576
+ var e2 = j;
577
+ j = [], run_all(e2);
578
+ }
579
+ function queue_micro_task(e2) {
580
+ 0 === j.length && queueMicrotask(run_micro_tasks), j.push(e2);
581
+ }
582
+ function flush_tasks() {
583
+ j.length > 0 && run_micro_tasks(), N.length > 0 && function run_idle_tasks() {
584
+ var e2 = N;
585
+ N = [], run_all(e2);
586
+ }();
587
+ }
588
+ let B = false, z = false, D = null, A = false, L = false;
589
+ function set_is_destroying_effect(e2) {
590
+ L = e2;
591
+ }
592
+ let W = [], F = null, G = false;
593
+ function set_active_reaction(e2) {
594
+ F = e2;
595
+ }
596
+ let H = null;
597
+ function set_active_effect(e2) {
598
+ H = e2;
599
+ }
600
+ let R = null;
601
+ let V = null, K = 0, U = null;
602
+ let Z = 1, Y = 0, J = false;
603
+ function increment_write_version() {
604
+ return ++Z;
605
+ }
606
+ function check_dirtiness(e2) {
607
+ var _a;
608
+ var t2 = e2.f;
609
+ if (t2 & g) return true;
610
+ if (t2 & h) {
611
+ var n2 = e2.deps, i2 = !!(t2 & p);
612
+ if (null !== n2) {
613
+ var o2, s2, a2 = !!(t2 & _), l2 = i2 && null !== H && !J, c2 = n2.length;
614
+ if (a2 || l2) {
615
+ var u2 = (
616
+ /** @type {Derived} */
617
+ e2
618
+ ), d2 = u2.parent;
619
+ for (o2 = 0; o2 < c2; o2++) s2 = n2[o2], // We always re-add all reactions (even duplicates) if the derived was
620
+ // previously disconnected, however we don't if it was unowned as we
621
+ // de-duplicate dependencies in that case
622
+ !a2 && ((_a = s2 == null ? void 0 : s2.reactions) == null ? void 0 : _a.includes(u2)) || (s2.reactions ?? (s2.reactions = [])).push(u2);
623
+ a2 && (u2.f ^= _), // If the unowned derived is now fully connected to the graph again (it's unowned and reconnected, has a parent
624
+ // and the parent is not unowned), then we can mark it as connected again, removing the need for the unowned
625
+ // flag
626
+ !l2 || null === d2 || d2.f & p || (u2.f ^= p);
627
+ }
628
+ for (o2 = 0; o2 < c2; o2++) if (check_dirtiness(s2 = n2[o2]) && update_derived(
629
+ /** @type {Derived} */
630
+ s2
631
+ ), s2.wv > e2.wv) return true;
632
+ }
633
+ i2 && (null === H || J) || set_signal_status(e2, v);
634
+ }
635
+ return false;
636
+ }
637
+ function handle_error(e2, t2, n2, i2) {
638
+ if (B) {
639
+ if (null === n2 && (B = false), /**
640
+ * @param {Effect} effect
641
+ */
642
+ function should_rethrow_error(e3) {
643
+ return !(e3.f & b || null !== e3.parent && e3.parent.f & f);
644
+ }(t2)) throw e2;
645
+ } else null !== n2 && (B = true), function propagate_error(e3, t3) {
646
+ for (var n3 = t3; null !== n3; ) {
647
+ if (n3.f & f) try {
648
+ return void n3.fn(e3);
649
+ } catch {
650
+ n3.f ^= f;
651
+ }
652
+ n3 = n3.parent;
653
+ }
654
+ throw B = false, e3;
655
+ }(e2, t2);
656
+ }
657
+ function schedule_possible_effect_self_invalidation(e2, t2, n2 = true) {
658
+ var i2 = e2.reactions;
659
+ if (null !== i2) for (var o2 = 0; o2 < i2.length; o2++) {
660
+ var s2 = i2[o2];
661
+ 2 & s2.f ? schedule_possible_effect_self_invalidation(
662
+ /** @type {Derived} */
663
+ s2,
664
+ t2,
665
+ false
666
+ ) : t2 === s2 && (n2 ? set_signal_status(s2, g) : s2.f & v && set_signal_status(s2, h), schedule_effect(
667
+ /** @type {Effect} */
668
+ s2
669
+ ));
670
+ }
671
+ }
672
+ function update_reaction(e2) {
673
+ var _a;
674
+ var t2 = V, n2 = K, i2 = U, o2 = F, s2 = J, a2 = R, l2 = T, c2 = G, u2 = e2.f;
675
+ V = /** @type {null | Value[]} */
676
+ null, K = 0, U = null, J = !!(u2 & p) && (G || !A || null === F), F = 96 & u2 ? null : e2, R = null, set_component_context(e2.ctx), G = false, Y++;
677
+ try {
678
+ var d2 = (
679
+ /** @type {Function} */
680
+ /** @type {Function} */
681
+ (0, e2.fn)()
682
+ ), f2 = e2.deps;
683
+ if (null !== V) {
684
+ var _2;
685
+ if (remove_reactions(e2, K), null !== f2 && K > 0) for (f2.length = K + V.length, _2 = 0; _2 < V.length; _2++) f2[K + _2] = V[_2];
686
+ else e2.deps = f2 = V;
687
+ if (!J) for (_2 = K; _2 < f2.length; _2++) ((_a = f2[_2]).reactions ?? (_a.reactions = [])).push(e2);
688
+ } else null !== f2 && K < f2.length && (remove_reactions(e2, K), f2.length = K);
689
+ if (is_runes() && null !== U && !G && null !== f2 && !(6146 & e2.f)) for (_2 = 0; _2 < /** @type {Source[]} */
690
+ U.length; _2++) schedule_possible_effect_self_invalidation(
691
+ U[_2],
692
+ /** @type {Effect} */
693
+ e2
694
+ );
695
+ return null !== o2 && Y++, d2;
696
+ } finally {
697
+ V = t2, K = n2, U = i2, F = o2, J = s2, R = a2, set_component_context(l2), G = c2;
698
+ }
699
+ }
700
+ function remove_reaction(e2, t2) {
701
+ let i2 = t2.reactions;
702
+ if (null !== i2) {
703
+ var o2 = n.call(i2, e2);
704
+ if (-1 !== o2) {
705
+ var s2 = i2.length - 1;
706
+ 0 === s2 ? i2 = t2.reactions = null : (
707
+ // Swap with last element and then remove.
708
+ (i2[o2] = i2[s2], i2.pop())
709
+ );
710
+ }
711
+ }
712
+ null === i2 && 2 & t2.f && // Destroying a child effect while updating a parent effect can cause a dependency to appear
713
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
714
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
715
+ (null === V || !V.includes(t2)) && (set_signal_status(t2, h), // If we are working with a derived that is owned by an effect, then mark it as being
716
+ // disconnected.
717
+ 768 & t2.f || (t2.f ^= _), // Disconnect any reactions owned by this reaction
718
+ destroy_derived_effects(
719
+ /** @type {Derived} **/
720
+ t2
721
+ ), remove_reactions(
722
+ /** @type {Derived} **/
723
+ t2,
724
+ 0
725
+ ));
726
+ }
727
+ function remove_reactions(e2, t2) {
728
+ var n2 = e2.deps;
729
+ if (null !== n2) for (var i2 = t2; i2 < n2.length; i2++) remove_reaction(e2, n2[i2]);
730
+ }
731
+ function update_effect(t2) {
732
+ var n2 = t2.f;
733
+ if (!(n2 & b)) {
734
+ set_signal_status(t2, v);
735
+ var i2 = H, o2 = T, s2 = A;
736
+ H = t2, A = true;
737
+ try {
738
+ 16 & n2 ? function destroy_block_effect_children(e2) {
739
+ for (var t3 = e2.first; null !== t3; ) {
740
+ var n3 = t3.next;
741
+ t3.f & d || destroy_effect(t3), t3 = n3;
742
+ }
743
+ }(t2) : destroy_effect_children(t2), execute_effect_teardown(t2);
744
+ var a2 = update_reaction(t2);
745
+ t2.teardown = "function" == typeof a2 ? a2 : null, t2.wv = Z;
746
+ t2.deps;
747
+ e;
748
+ } catch (e2) {
749
+ handle_error(e2, t2, i2, o2 || t2.ctx);
750
+ } finally {
751
+ A = s2, H = i2;
752
+ }
753
+ }
754
+ }
755
+ function infinite_loop_guard() {
756
+ try {
757
+ !function effect_update_depth_exceeded() {
758
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
759
+ }();
760
+ } catch (e2) {
761
+ if (null === D) throw e2;
762
+ handle_error(e2, D, null);
763
+ }
764
+ }
765
+ function flush_queued_root_effects() {
766
+ try {
767
+ for (var e2 = 0; W.length > 0; ) {
768
+ e2++ > 1e3 && infinite_loop_guard();
769
+ var t2 = W, n2 = t2.length;
770
+ W = [];
771
+ for (var i2 = 0; i2 < n2; i2++) {
772
+ var o2 = t2[i2];
773
+ o2.f & v || (o2.f ^= v), flush_queued_effects(process_effects(o2));
774
+ }
775
+ }
776
+ } finally {
777
+ z = false, D = null;
778
+ }
779
+ }
780
+ function flush_queued_effects(e2) {
781
+ var t2 = e2.length;
782
+ if (0 !== t2) for (var n2 = 0; n2 < t2; n2++) {
783
+ var i2 = e2[n2];
784
+ if (!(24576 & i2.f)) try {
785
+ check_dirtiness(i2) && (update_effect(i2), // Effects with no dependencies or teardown do not get added to the effect tree.
786
+ // Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we
787
+ // don't know if we need to keep them until they are executed. Doing the check
788
+ // here (rather than in `update_effect`) allows us to skip the work for
789
+ // immediate effects.
790
+ null === i2.deps && null === i2.first && null === i2.nodes_start && (null === i2.teardown ? (
791
+ // remove this effect from the graph
792
+ unlink_effect(i2)
793
+ ) : (
794
+ // keep the effect in the graph, but free up some memory
795
+ i2.fn = null
796
+ )));
797
+ } catch (e3) {
798
+ handle_error(e3, i2, null, i2.ctx);
799
+ }
800
+ }
801
+ }
802
+ function schedule_effect(e2) {
803
+ z || (z = true, queueMicrotask(flush_queued_root_effects));
804
+ for (var t2 = D = e2; null !== t2.parent; ) {
805
+ var n2 = (t2 = t2.parent).f;
806
+ if (96 & n2) {
807
+ if (!(n2 & v)) return;
808
+ t2.f ^= v;
809
+ }
810
+ }
811
+ W.push(t2);
812
+ }
813
+ function process_effects(e2) {
814
+ for (var t2 = [], n2 = e2.first; null !== n2; ) {
815
+ var i2 = n2.f, o2 = !!(i2 & d);
816
+ if (!(o2 && !!(i2 & v) || i2 & m)) {
817
+ if (4 & i2) t2.push(n2);
818
+ else if (o2) n2.f ^= v;
819
+ else {
820
+ var s2 = F;
821
+ try {
822
+ F = n2, check_dirtiness(n2) && update_effect(n2);
823
+ } catch (e3) {
824
+ handle_error(e3, n2, null, n2.ctx);
825
+ } finally {
826
+ F = s2;
827
+ }
828
+ }
829
+ var a2 = n2.first;
830
+ if (null !== a2) {
831
+ n2 = a2;
832
+ continue;
833
+ }
834
+ }
835
+ var l2 = n2.parent;
836
+ for (n2 = n2.next; null === n2 && null !== l2; ) n2 = l2.next, l2 = l2.parent;
837
+ }
838
+ return t2;
839
+ }
840
+ async function tick() {
841
+ await Promise.resolve(), // By calling flushSync we guarantee that any pending state changes are applied after one tick.
842
+ // TODO look into whether we can make flushing subsequent updates synchronously in the future.
843
+ function flushSync(e2) {
844
+ for (flush_tasks(); W.length > 0; ) z = true, flush_queued_root_effects(), flush_tasks();
845
+ }();
846
+ }
847
+ function get$1(e2) {
848
+ var t2 = !!(2 & e2.f);
849
+ if (null === F || G) {
850
+ if (t2 && /** @type {Derived} */
851
+ null === e2.deps && /** @type {Derived} */
852
+ null === e2.effects) {
853
+ var n2 = (
854
+ /** @type {Derived} */
855
+ e2
856
+ ), i2 = n2.parent;
857
+ null === i2 || i2.f & p || // If the derived is owned by another derived then mark it as unowned
858
+ // as the derived value might have been referenced in a different context
859
+ // since and thus its parent might not be its true owner anymore
860
+ (n2.f ^= p);
861
+ }
862
+ } else {
863
+ null !== R && R.includes(e2) && function state_unsafe_local_read() {
864
+ throw new Error("https://svelte.dev/e/state_unsafe_local_read");
865
+ }();
866
+ var o2 = F.deps;
867
+ e2.rv < Y && (e2.rv = Y, // If the signal is accessing the same dependencies in the same
868
+ // order as it did last time, increment `skipped_deps`
869
+ // rather than updating `new_deps`, which creates GC cost
870
+ null === V && null !== o2 && o2[K] === e2 ? K++ : null === V ? V = [e2] : J && V.includes(e2) || // Normally we can push duplicated dependencies to `new_deps`, but if we're inside
871
+ // an unowned derived because skip_reaction is true, then we need to ensure that
872
+ // we don't have duplicates
873
+ V.push(e2));
874
+ }
875
+ return t2 && check_dirtiness(n2 = /** @type {Derived} */
876
+ e2) && update_derived(n2), e2.v;
877
+ }
878
+ function untrack(e2) {
879
+ var t2 = G;
880
+ try {
881
+ return G = true, e2();
882
+ } finally {
883
+ G = t2;
884
+ }
885
+ }
886
+ const Q = -7169;
887
+ function set_signal_status(e2, t2) {
888
+ e2.f = e2.f & Q | t2;
889
+ }
890
+ function deep_read_state(e2) {
891
+ if ("object" == typeof e2 && e2 && !(e2 instanceof EventTarget)) {
892
+ if (w in e2) deep_read(e2);
893
+ else if (!Array.isArray(e2)) for (let t2 in e2) {
894
+ const n2 = e2[t2];
895
+ "object" == typeof n2 && n2 && w in n2 && deep_read(n2);
896
+ }
897
+ }
898
+ }
899
+ function deep_read(e2, t2 = /* @__PURE__ */ new Set()) {
900
+ if (!("object" != typeof e2 || null === e2 || e2 instanceof EventTarget || t2.has(e2))) {
901
+ t2.add(e2), // When working with a possible SvelteDate, this
902
+ // will ensure we capture changes to it.
903
+ e2 instanceof Date && e2.getTime();
904
+ for (let n3 in e2) try {
905
+ deep_read(e2[n3], t2);
906
+ } catch (e3) {
907
+ }
908
+ const n2 = u(e2);
909
+ if (n2 !== Object.prototype && n2 !== Array.prototype && n2 !== Map.prototype && n2 !== Set.prototype && n2 !== Date.prototype) {
910
+ const t3 = a(n2);
911
+ for (let n3 in t3) {
912
+ const i2 = t3[n3].get;
913
+ if (i2) try {
914
+ i2.call(e2);
915
+ } catch (e3) {
916
+ }
917
+ }
918
+ }
919
+ }
920
+ }
921
+ function is_capture_event(e2) {
922
+ return e2.endsWith("capture") && "gotpointercapture" !== e2 && "lostpointercapture" !== e2;
923
+ }
924
+ const ee = ["beforeinput", "click", "change", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"];
925
+ function is_delegated(e2) {
926
+ return ee.includes(e2);
927
+ }
928
+ const te = {
929
+ // no `class: 'className'` because we handle that separately
930
+ formnovalidate: "formNoValidate",
931
+ ismap: "isMap",
932
+ nomodule: "noModule",
933
+ playsinline: "playsInline",
934
+ readonly: "readOnly",
935
+ defaultvalue: "defaultValue",
936
+ defaultchecked: "defaultChecked",
937
+ srcobject: "srcObject",
938
+ novalidate: "noValidate",
939
+ allowfullscreen: "allowFullscreen",
940
+ disablepictureinpicture: "disablePictureInPicture",
941
+ disableremoteplayback: "disableRemotePlayback"
942
+ };
943
+ function normalize_attribute(e2) {
944
+ return e2 = e2.toLowerCase(), te[e2] ?? e2;
945
+ }
946
+ const ne = ["touchstart", "touchmove"];
947
+ function is_passive_event(e2) {
948
+ return ne.includes(e2);
949
+ }
950
+ function autofocus(e2, t2) {
951
+ if (t2) {
952
+ const t3 = document.body;
953
+ e2.autofocus = true, queue_micro_task(() => {
954
+ document.activeElement === t3 && e2.focus();
955
+ });
956
+ }
957
+ }
958
+ let re = false;
959
+ function without_reactive_context(e2) {
960
+ var t2 = F, n2 = H;
961
+ set_active_reaction(null), set_active_effect(null);
962
+ try {
963
+ return e2();
964
+ } finally {
965
+ set_active_reaction(t2), set_active_effect(n2);
966
+ }
967
+ }
968
+ function listen_to_event_and_reset_event(e2, t2, n2, i2 = n2) {
969
+ e2.addEventListener(t2, () => without_reactive_context(n2));
970
+ const o2 = e2.__on_r;
971
+ e2.__on_r = o2 ? () => {
972
+ o2(), i2(true);
973
+ } : () => i2(true), function add_form_reset_listener() {
974
+ re || (re = true, document.addEventListener(
975
+ "reset",
976
+ (e3) => {
977
+ Promise.resolve().then(() => {
978
+ var _a;
979
+ if (!e3.defaultPrevented) for (
980
+ const t3 of
981
+ /**@type {HTMLFormElement} */
982
+ e3.target.elements
983
+ )
984
+ (_a = t3.__on_r) == null ? void 0 : _a.call(t3);
985
+ });
986
+ },
987
+ // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
988
+ {
989
+ capture: true
990
+ }
991
+ ));
992
+ }();
993
+ }
994
+ const ie = /* @__PURE__ */ new Set(), oe = /* @__PURE__ */ new Set();
995
+ function create_event(e2, t2, n2, i2 = {}) {
996
+ function target_handler(e3) {
997
+ if (i2.capture || // Only call in the bubble phase, else delegated events would be called before the capturing events
998
+ handle_event_propagation.call(t2, e3), !e3.cancelBubble) return without_reactive_context(() => n2 == null ? void 0 : n2.call(this, e3));
999
+ }
1000
+ return e2.startsWith("pointer") || e2.startsWith("touch") || "wheel" === e2 ? queue_micro_task(() => {
1001
+ t2.addEventListener(e2, target_handler, i2);
1002
+ }) : t2.addEventListener(e2, target_handler, i2), target_handler;
1003
+ }
1004
+ function event(e2, t2, n2, i2, o2) {
1005
+ var s2 = {
1006
+ capture: i2,
1007
+ passive: o2
1008
+ }, a2 = create_event(e2, t2, n2, s2);
1009
+ t2 !== document.body && t2 !== window && t2 !== document || teardown(() => {
1010
+ t2.removeEventListener(e2, a2, s2);
1011
+ });
1012
+ }
1013
+ function delegate(e2) {
1014
+ for (var t2 = 0; t2 < e2.length; t2++) ie.add(e2[t2]);
1015
+ for (var n2 of oe) n2(e2);
1016
+ }
1017
+ function handle_event_propagation(e2) {
1018
+ var _a;
1019
+ var n2 = this, i2 = (
1020
+ /** @type {Node} */
1021
+ n2.ownerDocument
1022
+ ), s2 = e2.type, a2 = ((_a = e2.composedPath) == null ? void 0 : _a.call(e2)) || [], l2 = (
1023
+ /** @type {null | Element} */
1024
+ a2[0] || e2.target
1025
+ ), c2 = 0, u2 = e2.__root;
1026
+ if (u2) {
1027
+ var d2 = a2.indexOf(u2);
1028
+ if (-1 !== d2 && (n2 === document || n2 === /** @type {any} */
1029
+ window))
1030
+ return void (e2.__root = n2);
1031
+ var f2 = a2.indexOf(n2);
1032
+ if (-1 === f2)
1033
+ return;
1034
+ d2 <= f2 && (c2 = d2);
1035
+ }
1036
+ if ((l2 = /** @type {Element} */
1037
+ a2[c2] || e2.target) !== n2) {
1038
+ o(e2, "currentTarget", {
1039
+ configurable: true,
1040
+ get: () => l2 || i2
1041
+ });
1042
+ var p2 = F, _2 = H;
1043
+ set_active_reaction(null), set_active_effect(null);
1044
+ try {
1045
+ for (var v2, g2 = []; null !== l2; ) {
1046
+ var h2 = l2.assignedSlot || l2.parentNode || /** @type {any} */
1047
+ l2.host || null;
1048
+ try {
1049
+ var m2 = l2["__" + s2];
1050
+ if (void 0 !== m2 && (!/** @type {any} */
1051
+ l2.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1052
+ // -> the target could not have been disabled because it emits the event in the first place
1053
+ e2.target === l2)) if (t(m2)) {
1054
+ var [b2, ...y2] = m2;
1055
+ b2.apply(l2, [e2, ...y2]);
1056
+ } else m2.call(l2, e2);
1057
+ } catch (e3) {
1058
+ v2 ? g2.push(e3) : v2 = e3;
1059
+ }
1060
+ if (e2.cancelBubble || h2 === n2 || null === h2) break;
1061
+ l2 = h2;
1062
+ }
1063
+ if (v2) {
1064
+ for (let e3 of g2)
1065
+ queueMicrotask(() => {
1066
+ throw e3;
1067
+ });
1068
+ throw v2;
1069
+ }
1070
+ } finally {
1071
+ e2.__root = n2, // @ts-ignore remove proxy on currentTarget
1072
+ delete e2.currentTarget, set_active_reaction(p2), set_active_effect(_2);
1073
+ }
1074
+ }
1075
+ }
1076
+ function create_fragment_from_html(e2) {
1077
+ var t2 = document.createElement("template");
1078
+ return t2.innerHTML = e2, t2.content;
1079
+ }
1080
+ function assign_nodes(e2, t2) {
1081
+ var n2 = (
1082
+ /** @type {Effect} */
1083
+ H
1084
+ );
1085
+ null === n2.nodes_start && (n2.nodes_start = e2, n2.nodes_end = t2);
1086
+ }
1087
+ // @__NO_SIDE_EFFECTS__
1088
+ function template(e2, t2) {
1089
+ var n2, i2 = !!(1 & t2), o2 = !!(2 & t2), s2 = !e2.startsWith("<!>");
1090
+ return () => {
1091
+ void 0 === n2 && (n2 = create_fragment_from_html(s2 ? e2 : "<!>" + e2), i2 || (n2 = /** @type {Node} */
1092
+ /* @__PURE__ */ get_first_child(n2)));
1093
+ var t3 = (
1094
+ /** @type {TemplateNode} */
1095
+ o2 || P ? document.importNode(n2, true) : n2.cloneNode(true)
1096
+ );
1097
+ i2 ? assign_nodes(
1098
+ /** @type {TemplateNode} */
1099
+ /* @__PURE__ */ get_first_child(t3),
1100
+ /** @type {TemplateNode} */
1101
+ t3.lastChild
1102
+ ) : assign_nodes(t3, t3);
1103
+ return t3;
1104
+ };
1105
+ }
1106
+ // @__NO_SIDE_EFFECTS__
1107
+ function ns_template(e2, t2, n2 = "svg") {
1108
+ var i2, o2 = `<${n2}>${!e2.startsWith("<!>") ? e2 : "<!>" + e2}</${n2}>`;
1109
+ return () => {
1110
+ if (!i2) {
1111
+ var e3 = (
1112
+ /** @type {Element} */
1113
+ /* @__PURE__ */ get_first_child(
1114
+ /** @type {DocumentFragment} */
1115
+ create_fragment_from_html(o2)
1116
+ )
1117
+ );
1118
+ i2 = /** @type {Element} */
1119
+ /* @__PURE__ */ get_first_child(e3);
1120
+ }
1121
+ var t3 = (
1122
+ /** @type {TemplateNode} */
1123
+ i2.cloneNode(true)
1124
+ );
1125
+ return assign_nodes(t3, t3), t3;
1126
+ };
1127
+ }
1128
+ function text(e2 = "") {
1129
+ var t2 = create_text(e2 + "");
1130
+ return assign_nodes(t2, t2), t2;
1131
+ }
1132
+ function comment() {
1133
+ var e2 = document.createDocumentFragment(), t2 = document.createComment(""), n2 = create_text();
1134
+ return e2.append(t2, n2), assign_nodes(t2, n2), e2;
1135
+ }
1136
+ function append(e2, t2) {
1137
+ null !== e2 && e2.before(
1138
+ /** @type {Node} */
1139
+ t2
1140
+ );
1141
+ }
1142
+ let se = true;
1143
+ function set_should_intro(e2) {
1144
+ se = e2;
1145
+ }
1146
+ function set_text(e2, t2) {
1147
+ var n2 = null == t2 ? "" : "object" == typeof t2 ? t2 + "" : t2;
1148
+ n2 !== (e2.__t ?? (e2.__t = e2.nodeValue)) && // @ts-expect-error
1149
+ (e2.__t = n2, e2.nodeValue = n2 + "");
1150
+ }
1151
+ function mount(e2, t2) {
1152
+ return function _mount(e3, { target: t3, anchor: n2, props: o2 = {}, events: a2, context: l2, intro: c2 = true }) {
1153
+ !/**
1154
+ * Initialize these lazily to avoid issues when using the runtime in a server context
1155
+ * where these globals are not available while avoiding a separate server entry point
1156
+ */
1157
+ function init_operations() {
1158
+ if (void 0 === q) {
1159
+ q = window, I = document, P = /Firefox/.test(navigator.userAgent);
1160
+ var e4 = Element.prototype, t4 = Node.prototype;
1161
+ O = s(t4, "firstChild").get, // @ts-ignore
1162
+ E = s(t4, "nextSibling").get, // the following assignments improve perf of lookups on DOM nodes
1163
+ // @ts-expect-error
1164
+ e4.__click = void 0, // @ts-expect-error
1165
+ e4.__className = void 0, // @ts-expect-error
1166
+ e4.__attributes = null, // @ts-expect-error
1167
+ e4.__styles = null, // @ts-expect-error
1168
+ e4.__e = void 0, // @ts-expect-error
1169
+ Text.prototype.__t = void 0;
1170
+ }
1171
+ }();
1172
+ var u2 = /* @__PURE__ */ new Set(), event_handle = (e4) => {
1173
+ for (var n3 = 0; n3 < e4.length; n3++) {
1174
+ var i2 = e4[n3];
1175
+ if (!u2.has(i2)) {
1176
+ u2.add(i2);
1177
+ var o3 = is_passive_event(i2);
1178
+ t3.addEventListener(i2, handle_event_propagation, {
1179
+ passive: o3
1180
+ });
1181
+ var s2 = ae.get(i2);
1182
+ void 0 === s2 ? (
1183
+ // The document listener ensures we catch events that originate from elements that were
1184
+ // manually moved outside of the container (e.g. via manual portals).
1185
+ (document.addEventListener(i2, handle_event_propagation, {
1186
+ passive: o3
1187
+ }), ae.set(i2, 1))
1188
+ ) : ae.set(i2, s2 + 1);
1189
+ }
1190
+ }
1191
+ };
1192
+ event_handle(i(ie)), oe.add(event_handle);
1193
+ var d2 = void 0, f2 = (
1194
+ /**
1195
+ * An effect root whose children can transition out
1196
+ * @param {() => void} fn
1197
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
1198
+ */
1199
+ function component_root(e4) {
1200
+ const t4 = create_effect(64, e4, true);
1201
+ return (e5 = {}) => new Promise((n3) => {
1202
+ e5.outro ? pause_effect(t4, () => {
1203
+ destroy_effect(t4), n3(void 0);
1204
+ }) : (destroy_effect(t4), n3(void 0));
1205
+ });
1206
+ }(() => {
1207
+ var i2 = n2 ?? t3.appendChild(create_text());
1208
+ return branch(() => {
1209
+ l2 && (push({}), /** @type {ComponentContext} */
1210
+ T.c = l2);
1211
+ a2 && // We can't spread the object or else we'd lose the state proxy stuff, if it is one
1212
+ /** @type {any} */
1213
+ (o2.$$events = a2), se = c2, // @ts-expect-error the public typings are not what the actual function looks like
1214
+ d2 = e3(i2, o2) || {}, se = true, l2 && pop();
1215
+ }), () => {
1216
+ var _a;
1217
+ for (var e4 of u2) {
1218
+ t3.removeEventListener(e4, handle_event_propagation);
1219
+ var o3 = (
1220
+ /** @type {number} */
1221
+ ae.get(e4)
1222
+ );
1223
+ 0 == --o3 ? (document.removeEventListener(e4, handle_event_propagation), ae.delete(e4)) : ae.set(e4, o3);
1224
+ }
1225
+ oe.delete(event_handle), i2 !== n2 && ((_a = i2.parentNode) == null ? void 0 : _a.removeChild(i2));
1226
+ };
1227
+ })
1228
+ );
1229
+ return le.set(d2, f2), d2;
1230
+ }(e2, t2);
1231
+ }
1232
+ const ae = /* @__PURE__ */ new Map();
1233
+ let le = /* @__PURE__ */ new WeakMap();
1234
+ function if_block(e2, t2, n2 = false) {
1235
+ var i2 = e2, o2 = null, s2 = null, a2 = M, l2 = false;
1236
+ const set_branch = (e3, t3 = true) => {
1237
+ l2 = true, update_branch(t3, e3);
1238
+ }, update_branch = (e3, t3) => {
1239
+ a2 !== (a2 = e3) && (a2 ? (o2 ? resume_effect(o2) : t3 && (o2 = branch(() => t3(i2))), s2 && pause_effect(s2, () => {
1240
+ s2 = null;
1241
+ })) : (s2 ? resume_effect(s2) : t3 && (s2 = branch(() => t3(i2))), o2 && pause_effect(o2, () => {
1242
+ o2 = null;
1243
+ })));
1244
+ };
1245
+ block(() => {
1246
+ l2 = false, t2(set_branch), l2 || update_branch(null, null);
1247
+ }, n2 ? y : 0);
1248
+ }
1249
+ let ce = null;
1250
+ function set_current_each_item(e2) {
1251
+ ce = e2;
1252
+ }
1253
+ function index(e2, t2) {
1254
+ return t2;
1255
+ }
1256
+ function each(e2, n2, o2, s2, a2, l2 = null) {
1257
+ var c2 = e2, u2 = {
1258
+ flags: n2,
1259
+ items: /* @__PURE__ */ new Map(),
1260
+ first: null
1261
+ };
1262
+ !(4 & n2) || (c2 = /** @type {Element} */
1263
+ e2.appendChild(create_text()));
1264
+ var d2 = null, f2 = false, p2 = /* @__PURE__ */ derived_safe_equal(() => {
1265
+ var e3 = o2();
1266
+ return t(e3) ? e3 : null == e3 ? [] : i(e3);
1267
+ });
1268
+ block(() => {
1269
+ var e3 = get$1(p2), t2 = e3.length;
1270
+ f2 && 0 === t2 || (f2 = 0 === t2, /**
1271
+ * Add, remove, or reorder items output by an each block as its input changes
1272
+ * @template V
1273
+ * @param {Array<V>} array
1274
+ * @param {EachState} state
1275
+ * @param {Element | Comment | Text} anchor
1276
+ * @param {(anchor: Node, item: MaybeSource<V>, index: number | Source<number>, collection: () => V[]) => void} render_fn
1277
+ * @param {number} flags
1278
+ * @param {(value: V, index: number) => any} get_key
1279
+ * @param {() => V[]} get_collection
1280
+ * @returns {void}
1281
+ */
1282
+ function reconcile(e4, t3, n3, o3, s3, a3, l3) {
1283
+ var _a, _b, _c, _d;
1284
+ var c3, u3, d3, f3, p3, _2, v2 = !!(8 & s3), g2 = !!(3 & s3), h2 = e4.length, b2 = t3.items, y2 = t3.first, $2 = y2, w2 = null, x2 = [], k2 = [];
1285
+ if (v2) for (_2 = 0; _2 < h2; _2 += 1) f3 = a3(d3 = e4[_2], _2), void 0 !== (p3 = b2.get(f3)) && ((_a = p3.a) == null ? void 0 : _a.measure(), (u3 ?? (u3 = /* @__PURE__ */ new Set())).add(p3));
1286
+ for (_2 = 0; _2 < h2; _2 += 1) if (f3 = a3(d3 = e4[_2], _2), void 0 !== (p3 = b2.get(f3))) {
1287
+ if (g2 && update_item(p3, d3, _2, s3), p3.e.f & m && (resume_effect(p3.e), v2 && ((_b = p3.a) == null ? void 0 : _b.unfix(), (u3 ?? (u3 = /* @__PURE__ */ new Set())).delete(p3))), p3 !== $2) {
1288
+ if (void 0 !== c3 && c3.has(p3)) {
1289
+ if (x2.length < k2.length) {
1290
+ var C2, M2 = k2[0];
1291
+ w2 = M2.prev;
1292
+ var S2 = x2[0], T2 = x2[x2.length - 1];
1293
+ for (C2 = 0; C2 < x2.length; C2 += 1) move(x2[C2], M2, n3);
1294
+ for (C2 = 0; C2 < k2.length; C2 += 1) c3.delete(k2[C2]);
1295
+ link(t3, S2.prev, T2.next), link(t3, w2, S2), link(t3, T2, M2), $2 = M2, w2 = T2, _2 -= 1, x2 = [], k2 = [];
1296
+ } else
1297
+ c3.delete(p3), move(p3, $2, n3), link(t3, p3.prev, p3.next), link(t3, p3, null === w2 ? t3.first : w2.next), link(t3, w2, p3), w2 = p3;
1298
+ continue;
1299
+ }
1300
+ for (x2 = [], k2 = []; null !== $2 && $2.k !== f3; )
1301
+ $2.e.f & m || (c3 ?? (c3 = /* @__PURE__ */ new Set())).add($2), k2.push($2), $2 = $2.next;
1302
+ if (null === $2) continue;
1303
+ p3 = $2;
1304
+ }
1305
+ x2.push(p3), w2 = p3, $2 = p3.next;
1306
+ } else {
1307
+ w2 = create_item($2 ? (
1308
+ /** @type {TemplateNode} */
1309
+ $2.e.nodes_start
1310
+ ) : n3, t3, w2, null === w2 ? t3.first : w2.next, d3, f3, _2, o3, s3, l3), b2.set(f3, w2), x2 = [], k2 = [], $2 = w2.next;
1311
+ }
1312
+ if (null !== $2 || void 0 !== c3) {
1313
+ for (var q2 = void 0 === c3 ? [] : i(c3); null !== $2; )
1314
+ $2.e.f & m || q2.push($2), $2 = $2.next;
1315
+ var I2 = q2.length;
1316
+ if (I2 > 0) {
1317
+ var P2 = 4 & s3 && 0 === h2 ? n3 : null;
1318
+ if (v2) {
1319
+ for (_2 = 0; _2 < I2; _2 += 1) (_c = q2[_2].a) == null ? void 0 : _c.measure();
1320
+ for (_2 = 0; _2 < I2; _2 += 1) (_d = q2[_2].a) == null ? void 0 : _d.fix();
1321
+ }
1322
+ !function pause_effects(e5, t4, n4, i2) {
1323
+ for (var o4 = [], s4 = t4.length, a4 = 0; a4 < s4; a4++) pause_children(t4[a4].e, o4, true);
1324
+ var l4 = s4 > 0 && 0 === o4.length && null !== n4;
1325
+ if (l4) {
1326
+ var c4 = (
1327
+ /** @type {Element} */
1328
+ /** @type {Element} */
1329
+ n4.parentNode
1330
+ );
1331
+ !function clear_text_content(e6) {
1332
+ e6.textContent = "";
1333
+ }(c4), c4.append(
1334
+ /** @type {Element} */
1335
+ n4
1336
+ ), i2.clear(), link(e5, t4[0].prev, t4[s4 - 1].next);
1337
+ }
1338
+ run_out_transitions(o4, () => {
1339
+ for (var n5 = 0; n5 < s4; n5++) {
1340
+ var o5 = t4[n5];
1341
+ l4 || (i2.delete(o5.k), link(e5, o5.prev, o5.next)), destroy_effect(o5.e, !l4);
1342
+ }
1343
+ });
1344
+ }(t3, q2, P2, b2);
1345
+ }
1346
+ }
1347
+ v2 && queue_micro_task(() => {
1348
+ var _a2;
1349
+ if (void 0 !== u3) for (p3 of u3) (_a2 = p3.a) == null ? void 0 : _a2.apply();
1350
+ });
1351
+ H.first = t3.first && t3.first.e, /** @type {Effect} */
1352
+ H.last = w2 && w2.e;
1353
+ }(e3, u2, c2, a2, n2, s2, o2), null !== l2 && (0 === t2 ? d2 ? resume_effect(d2) : d2 = branch(() => l2(c2)) : null !== d2 && pause_effect(d2, () => {
1354
+ d2 = null;
1355
+ })), // When we mount the each block for the first time, the collection won't be
1356
+ // connected to this effect as the effect hasn't finished running yet and its deps
1357
+ // won't be assigned. However, it's possible that when reconciling the each block
1358
+ // that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the
1359
+ // collection again can provide consistency to the reactive graph again as the deriveds
1360
+ // will now be `CLEAN`.
1361
+ get$1(p2));
1362
+ });
1363
+ }
1364
+ function update_item(e2, t2, n2, i2) {
1365
+ 1 & i2 && internal_set(e2.v, t2), 2 & i2 ? internal_set(
1366
+ /** @type {Value<number>} */
1367
+ e2.i,
1368
+ n2
1369
+ ) : e2.i = n2;
1370
+ }
1371
+ function create_item(e2, t2, n2, i2, o2, s2, a2, l2, c2, u2) {
1372
+ var d2 = ce, f2 = !!(1 & c2) ? !(16 & c2) ? /* @__PURE__ */ mutable_source(o2) : source(o2) : o2, p2 = 2 & c2 ? source(a2) : a2, _2 = {
1373
+ i: p2,
1374
+ v: f2,
1375
+ k: s2,
1376
+ a: null,
1377
+ // @ts-expect-error
1378
+ e: null,
1379
+ prev: n2,
1380
+ next: i2
1381
+ };
1382
+ ce = _2;
1383
+ try {
1384
+ return _2.e = branch(() => l2(e2, f2, p2, u2), false), _2.e.prev = n2 && n2.e, _2.e.next = i2 && i2.e, null === n2 ? t2.first = _2 : (n2.next = _2, n2.e.next = _2.e), null !== i2 && (i2.prev = _2, i2.e.prev = _2.e), _2;
1385
+ } finally {
1386
+ ce = d2;
1387
+ }
1388
+ }
1389
+ function move(e2, t2, n2) {
1390
+ for (var i2 = e2.next ? (
1391
+ /** @type {TemplateNode} */
1392
+ e2.next.e.nodes_start
1393
+ ) : n2, o2 = t2 ? (
1394
+ /** @type {TemplateNode} */
1395
+ t2.e.nodes_start
1396
+ ) : n2, s2 = (
1397
+ /** @type {TemplateNode} */
1398
+ e2.e.nodes_start
1399
+ ); s2 !== i2; ) {
1400
+ var a2 = (
1401
+ /** @type {TemplateNode} */
1402
+ /* @__PURE__ */ get_next_sibling(s2)
1403
+ );
1404
+ o2.before(s2), s2 = a2;
1405
+ }
1406
+ }
1407
+ function link(e2, t2, n2) {
1408
+ null === t2 ? e2.first = n2 : (t2.next = n2, t2.e.next = n2 && n2.e), null !== n2 && (n2.prev = t2, n2.e.prev = t2 && t2.e);
1409
+ }
1410
+ function slot(e2, t2, n2, i2, o2) {
1411
+ var _a;
1412
+ var s2 = (_a = t2.$$slots) == null ? void 0 : _a[n2], a2 = false;
1413
+ true === s2 && (s2 = t2["default" === n2 ? "children" : n2], a2 = true), void 0 === s2 ? null !== o2 && o2(e2) : s2(e2, a2 ? () => i2 : i2);
1414
+ }
1415
+ function component(e2, t2, n2) {
1416
+ var i2, o2, s2 = e2;
1417
+ block(() => {
1418
+ i2 !== (i2 = t2()) && (o2 && (pause_effect(o2), o2 = null), i2 && (o2 = branch(() => n2(s2, i2))));
1419
+ }, y);
1420
+ }
1421
+ function r(e2) {
1422
+ var t2, n2, i2 = "";
1423
+ if ("string" == typeof e2 || "number" == typeof e2) i2 += e2;
1424
+ else if ("object" == typeof e2) if (Array.isArray(e2)) {
1425
+ var o2 = e2.length;
1426
+ for (t2 = 0; t2 < o2; t2++) e2[t2] && (n2 = r(e2[t2])) && (i2 && (i2 += " "), i2 += n2);
1427
+ } else for (n2 in e2) e2[n2] && (i2 && (i2 += " "), i2 += n2);
1428
+ return i2;
1429
+ }
1430
+ function clsx(e2) {
1431
+ return "object" == typeof e2 ? function clsx$1() {
1432
+ for (var e3, t2, n2 = 0, i2 = "", o2 = arguments.length; n2 < o2; n2++) (e3 = arguments[n2]) && (t2 = r(e3)) && (i2 && (i2 += " "), i2 += t2);
1433
+ return i2;
1434
+ }(e2) : e2 ?? "";
1435
+ }
1436
+ const ue = [..." \n\r\f \v\uFEFF"];
1437
+ function set_class(e2, t2, n2, i2, o2, s2) {
1438
+ if (e2.__className !== n2) {
1439
+ var a2 = function to_class(e3, t3, n3) {
1440
+ var i3 = null == e3 ? "" : "" + e3;
1441
+ if (t3 && (i3 = i3 ? i3 + " " + t3 : t3), n3) {
1442
+ for (var o3 in n3) if (n3[o3]) i3 = i3 ? i3 + " " + o3 : o3;
1443
+ else if (i3.length) for (var s3 = o3.length, a3 = 0; (a3 = i3.indexOf(o3, a3)) >= 0; ) {
1444
+ var l3 = a3 + s3;
1445
+ 0 !== a3 && !ue.includes(i3[a3 - 1]) || l3 !== i3.length && !ue.includes(i3[l3]) ? a3 = l3 : i3 = (0 === a3 ? "" : i3.substring(0, a3)) + i3.substring(l3 + 1);
1446
+ }
1447
+ }
1448
+ return "" === i3 ? null : i3;
1449
+ }(n2, i2, s2);
1450
+ null == a2 ? e2.removeAttribute("class") : t2 ? e2.className = a2 : e2.setAttribute("class", a2), // @ts-expect-error need to add __className to patched prototype
1451
+ e2.__className = n2;
1452
+ } else if (s2) for (var l2 in s2) {
1453
+ var c2 = !!s2[l2];
1454
+ null != o2 && c2 === !!o2[l2] || e2.classList.toggle(l2, c2);
1455
+ }
1456
+ return s2;
1457
+ }
1458
+ const de = Symbol("class");
1459
+ function set_selected(e2, t2) {
1460
+ t2 ? (
1461
+ // The selected option could've changed via user selection, and
1462
+ // setting the value without this check would set it back.
1463
+ e2.hasAttribute("selected") || e2.setAttribute("selected", "")
1464
+ ) : e2.removeAttribute("selected");
1465
+ }
1466
+ function set_attribute(e2, t2, n2, i2) {
1467
+ var o2 = e2.__attributes ?? (e2.__attributes = {});
1468
+ o2[t2] !== (o2[t2] = n2) && ("style" === t2 && "__styles" in e2 && // reset styles to force style: directive to update
1469
+ (e2.__styles = {}), "loading" === t2 && // @ts-expect-error
1470
+ (e2[k] = n2), null == n2 ? e2.removeAttribute(t2) : "string" != typeof n2 && get_setters(e2).includes(t2) ? (
1471
+ // @ts-ignore
1472
+ e2[t2] = n2
1473
+ ) : e2.setAttribute(t2, n2));
1474
+ }
1475
+ function set_attributes(e2, t2, n2, i2, o2 = false, s2 = false, a2 = false) {
1476
+ var l2 = t2 || {}, c2 = "OPTION" === e2.tagName;
1477
+ for (var u2 in t2) u2 in n2 || (n2[u2] = null);
1478
+ n2.class ? n2.class = clsx(n2.class) : (i2 || n2[de]) && (n2.class = null);
1479
+ var d2 = get_setters(e2), f2 = (
1480
+ /** @type {Record<string, unknown>} **/
1481
+ e2.__attributes ?? (e2.__attributes = {})
1482
+ );
1483
+ for (const m2 in n2) {
1484
+ let b2 = n2[m2];
1485
+ if (c2 && "value" === m2 && null == b2)
1486
+ e2.value = e2.__value = "", l2[m2] = b2;
1487
+ else if ("class" !== m2) {
1488
+ var p2 = l2[m2];
1489
+ if (b2 !== p2) {
1490
+ l2[m2] = b2;
1491
+ var _2 = m2[0] + m2[1];
1492
+ if ("$$" !== _2) {
1493
+ if ("on" === _2) {
1494
+ const y2 = {}, $2 = "$$" + m2;
1495
+ let w2 = m2.slice(2);
1496
+ var v2 = is_delegated(w2);
1497
+ if (is_capture_event(w2) && (w2 = w2.slice(0, -7), y2.capture = true), !v2 && p2) {
1498
+ if (null != b2) continue;
1499
+ e2.removeEventListener(w2, l2[$2], y2), l2[$2] = null;
1500
+ }
1501
+ if (null != b2) if (v2)
1502
+ e2[`__${w2}`] = b2, delegate([w2]);
1503
+ else {
1504
+ let handle = function(e3) {
1505
+ l2[m2].call(this, e3);
1506
+ };
1507
+ l2[$2] = create_event(w2, e2, handle, y2);
1508
+ }
1509
+ else v2 && // @ts-ignore
1510
+ (e2[`__${w2}`] = void 0);
1511
+ } else if ("style" === m2 && null != b2) e2.style.cssText = b2 + "";
1512
+ else if ("autofocus" === m2) autofocus(
1513
+ /** @type {HTMLElement} */
1514
+ e2,
1515
+ Boolean(b2)
1516
+ );
1517
+ else if (s2 || "__value" !== m2 && ("value" !== m2 || null == b2)) if ("selected" === m2 && c2) set_selected(
1518
+ /** @type {HTMLOptionElement} */
1519
+ e2,
1520
+ b2
1521
+ );
1522
+ else {
1523
+ var g2 = m2;
1524
+ o2 || (g2 = normalize_attribute(g2));
1525
+ var h2 = "defaultValue" === g2 || "defaultChecked" === g2;
1526
+ if (null != b2 || s2 || h2) h2 || d2.includes(g2) && (s2 || "string" != typeof b2) ? (
1527
+ // @ts-ignore
1528
+ e2[g2] = b2
1529
+ ) : "function" != typeof b2 && set_attribute(e2, g2, b2);
1530
+ else if (f2[m2] = null, "value" === g2 || "checked" === g2) {
1531
+ let x2 = (
1532
+ /** @type {HTMLInputElement} */
1533
+ e2
1534
+ );
1535
+ const k2 = void 0 === t2;
1536
+ if ("value" === g2) {
1537
+ let C2 = x2.defaultValue;
1538
+ x2.removeAttribute(g2), x2.defaultValue = C2, // @ts-ignore
1539
+ x2.value = x2.__value = k2 ? C2 : null;
1540
+ } else {
1541
+ let M2 = x2.defaultChecked;
1542
+ x2.removeAttribute(g2), x2.defaultChecked = M2, x2.checked = !!k2 && M2;
1543
+ }
1544
+ } else e2.removeAttribute(m2);
1545
+ }
1546
+ else
1547
+ e2.value = e2.__value = b2;
1548
+ "style" === m2 && "__styles" in e2 && // reset styles to force style: directive to update
1549
+ (e2.__styles = {});
1550
+ }
1551
+ }
1552
+ } else {
1553
+ set_class(e2, "http://www.w3.org/1999/xhtml" === e2.namespaceURI, b2, i2, t2 == null ? void 0 : t2[de], n2[de]), l2[m2] = b2, l2[de] = n2[de];
1554
+ }
1555
+ }
1556
+ return l2;
1557
+ }
1558
+ var fe = /* @__PURE__ */ new Map();
1559
+ function get_setters(e2) {
1560
+ var t2, n2 = fe.get(e2.nodeName);
1561
+ if (n2) return n2;
1562
+ fe.set(e2.nodeName, n2 = []);
1563
+ for (var i2 = e2, o2 = Element.prototype; o2 !== i2; ) {
1564
+ for (var s2 in t2 = a(i2)) t2[s2].set && n2.push(s2);
1565
+ i2 = u(i2);
1566
+ }
1567
+ return n2;
1568
+ }
1569
+ function set_style(e2, t2, n2, i2) {
1570
+ var o2 = e2.__styles ?? (e2.__styles = {});
1571
+ o2[t2] !== n2 && (o2[t2] = n2, null == n2 ? e2.style.removeProperty(t2) : e2.style.setProperty(t2, n2, ""));
1572
+ }
1573
+ const pe = {
1574
+ // don't access requestAnimationFrame eagerly outside method
1575
+ // this allows basic testing of user code without JSDOM
1576
+ // bunder will eval and remove ternary when the user's app is built
1577
+ tick: (
1578
+ /** @param {any} _ */
1579
+ (e2) => requestAnimationFrame(e2)
1580
+ ),
1581
+ now: () => performance.now(),
1582
+ tasks: /* @__PURE__ */ new Set()
1583
+ };
1584
+ function run_tasks() {
1585
+ const e2 = pe.now();
1586
+ pe.tasks.forEach((t2) => {
1587
+ t2.c(e2) || (pe.tasks.delete(t2), t2.f());
1588
+ }), 0 !== pe.tasks.size && pe.tick(run_tasks);
1589
+ }
1590
+ function dispatch_event(e2, t2) {
1591
+ without_reactive_context(() => {
1592
+ e2.dispatchEvent(new CustomEvent(t2));
1593
+ });
1594
+ }
1595
+ function css_property_to_camelcase(e2) {
1596
+ if ("float" === e2) return "cssFloat";
1597
+ if ("offset" === e2) return "cssOffset";
1598
+ if (e2.startsWith("--")) return e2;
1599
+ const t2 = e2.split("-");
1600
+ return 1 === t2.length ? t2[0] : t2[0] + t2.slice(1).map(
1601
+ /** @param {any} word */
1602
+ (e3) => e3[0].toUpperCase() + e3.slice(1)
1603
+ ).join("");
1604
+ }
1605
+ function css_to_keyframe(e2) {
1606
+ const t2 = {}, n2 = e2.split(";");
1607
+ for (const e3 of n2) {
1608
+ const [n3, i2] = e3.split(":");
1609
+ if (!n3 || void 0 === i2) break;
1610
+ t2[css_property_to_camelcase(n3.trim())] = i2.trim();
1611
+ }
1612
+ return t2;
1613
+ }
1614
+ const linear = (e2) => e2;
1615
+ function transition(e2, t2, n2, i2) {
1616
+ var o2, s2, a2, l2 = !!(4 & e2), c2 = t2.inert, u2 = t2.style.overflow;
1617
+ function get_options() {
1618
+ var e3 = F, s3 = H;
1619
+ set_active_reaction(null), set_active_effect(null);
1620
+ try {
1621
+ return o2 ?? (o2 = n2()(t2, (i2 == null ? void 0 : i2()) ?? /** @type {P} */
1622
+ {}, {
1623
+ direction: "both"
1624
+ }));
1625
+ } finally {
1626
+ set_active_reaction(e3), set_active_effect(s3);
1627
+ }
1628
+ }
1629
+ var d2 = {
1630
+ is_global: l2,
1631
+ in() {
1632
+ t2.inert = c2, dispatch_event(t2, "introstart"), s2 = animate(t2, get_options(), a2, 1, () => {
1633
+ dispatch_event(t2, "introend"), // Ensure we cancel the animation to prevent leaking
1634
+ s2 == null ? void 0 : s2.abort(), s2 = o2 = void 0, t2.style.overflow = u2;
1635
+ });
1636
+ },
1637
+ out(e3) {
1638
+ t2.inert = true, dispatch_event(t2, "outrostart"), a2 = animate(t2, get_options(), s2, 0, () => {
1639
+ dispatch_event(t2, "outroend"), e3 == null ? void 0 : e3();
1640
+ });
1641
+ },
1642
+ stop: () => {
1643
+ s2 == null ? void 0 : s2.abort(), a2 == null ? void 0 : a2.abort();
1644
+ }
1645
+ }, f2 = (
1646
+ /** @type {Effect} */
1647
+ H
1648
+ );
1649
+ if ((f2.transitions ?? (f2.transitions = [])).push(d2), se) {
1650
+ var p2 = l2;
1651
+ if (!p2) {
1652
+ for (var _2 = (
1653
+ /** @type {Effect | null} */
1654
+ f2.parent
1655
+ ); _2 && _2.f & y; ) for (; (_2 = _2.parent) && !(16 & _2.f); ) ;
1656
+ p2 = !_2 || !!(32768 & _2.f);
1657
+ }
1658
+ p2 && effect(() => {
1659
+ untrack(() => d2.in());
1660
+ });
1661
+ }
1662
+ }
1663
+ function animate(e2, t2, n2, i2, o2) {
1664
+ var s2 = 1 === i2;
1665
+ if (is_function(t2)) {
1666
+ var a2, l2 = false;
1667
+ return queue_micro_task(() => {
1668
+ if (!l2) {
1669
+ var c3 = t2({
1670
+ direction: s2 ? "in" : "out"
1671
+ });
1672
+ a2 = animate(e2, c3, n2, i2, o2);
1673
+ }
1674
+ }), {
1675
+ abort: () => {
1676
+ l2 = true, a2 == null ? void 0 : a2.abort();
1677
+ },
1678
+ deactivate: () => a2.deactivate(),
1679
+ reset: () => a2.reset(),
1680
+ t: () => a2.t()
1681
+ };
1682
+ }
1683
+ if (n2 == null ? void 0 : n2.deactivate(), !(t2 == null ? void 0 : t2.duration)) return o2(), {
1684
+ abort: noop,
1685
+ deactivate: noop,
1686
+ reset: noop,
1687
+ t: () => i2
1688
+ };
1689
+ const { delay: c2 = 0, css: u2, tick: d2, easing: f2 = linear } = t2;
1690
+ var p2 = [];
1691
+ if (s2 && void 0 === n2 && (d2 && d2(0, 1), u2)) {
1692
+ var _2 = css_to_keyframe(u2(0, 1));
1693
+ p2.push(_2, _2);
1694
+ }
1695
+ var get_t = () => 1 - i2, v2 = e2.animate(p2, {
1696
+ duration: c2
1697
+ });
1698
+ return v2.onfinish = () => {
1699
+ var s3 = (n2 == null ? void 0 : n2.t()) ?? 1 - i2;
1700
+ n2 == null ? void 0 : n2.abort();
1701
+ var a3 = i2 - s3, l3 = (
1702
+ /** @type {number} */
1703
+ t2.duration * Math.abs(a3)
1704
+ ), c3 = [];
1705
+ if (l3 > 0) {
1706
+ var p3 = false;
1707
+ if (u2)
1708
+ for (var _3 = Math.ceil(l3 / (1e3 / 60)), g2 = 0; g2 <= _3; g2 += 1) {
1709
+ var h2 = s3 + a3 * f2(g2 / _3), m2 = css_to_keyframe(u2(h2, 1 - h2));
1710
+ c3.push(m2), p3 || (p3 = "hidden" === m2.overflow);
1711
+ }
1712
+ p3 && /** @type {HTMLElement} */
1713
+ (e2.style.overflow = "hidden"), get_t = () => {
1714
+ var e3 = (
1715
+ /** @type {number} */
1716
+ /** @type {globalThis.Animation} */
1717
+ v2.currentTime
1718
+ );
1719
+ return s3 + a3 * f2(e3 / l3);
1720
+ }, d2 && function loop(e3) {
1721
+ let t3;
1722
+ return 0 === pe.tasks.size && pe.tick(run_tasks), {
1723
+ promise: new Promise((n3) => {
1724
+ pe.tasks.add(t3 = {
1725
+ c: e3,
1726
+ f: n3
1727
+ });
1728
+ }),
1729
+ abort() {
1730
+ pe.tasks.delete(t3);
1731
+ }
1732
+ };
1733
+ }(() => {
1734
+ if ("running" !== v2.playState) return false;
1735
+ var e3 = get_t();
1736
+ return d2(e3, 1 - e3), true;
1737
+ });
1738
+ }
1739
+ (v2 = e2.animate(c3, {
1740
+ duration: l3,
1741
+ fill: "forwards"
1742
+ })).onfinish = () => {
1743
+ get_t = () => i2, d2 == null ? void 0 : d2(i2, 1 - i2), o2();
1744
+ };
1745
+ }, {
1746
+ abort: () => {
1747
+ v2 && (v2.cancel(), // This prevents memory leaks in Chromium
1748
+ v2.effect = null, // This prevents onfinish to be launched after cancel(),
1749
+ // which can happen in some rare cases
1750
+ // see https://github.com/sveltejs/svelte/issues/13681
1751
+ v2.onfinish = noop);
1752
+ },
1753
+ deactivate: () => {
1754
+ o2 = noop;
1755
+ },
1756
+ reset: () => {
1757
+ 0 === i2 && (d2 == null ? void 0 : d2(1, 0));
1758
+ },
1759
+ t: () => get_t()
1760
+ };
1761
+ }
1762
+ function is_numberlike_input(e2) {
1763
+ var t2 = e2.type;
1764
+ return "number" === t2 || "range" === t2;
1765
+ }
1766
+ function to_number(e2) {
1767
+ return "" === e2 ? null : +e2;
1768
+ }
1769
+ function is_bound_this(e2, t2) {
1770
+ return e2 === t2 || (e2 == null ? void 0 : e2[w]) === t2;
1771
+ }
1772
+ function bind_this(e2 = {}, t2, n2, i2) {
1773
+ return effect(() => {
1774
+ var i3, o2;
1775
+ return render_effect(() => {
1776
+ i3 = o2, // We only track changes to the parts, not the value itself to avoid unnecessary reruns.
1777
+ o2 = [], untrack(() => {
1778
+ e2 !== n2(...o2) && (t2(e2, ...o2), // If this is an effect rerun (cause: each block context changes), then nullfiy the binding at
1779
+ // the previous position if it isn't already taken over by a different effect.
1780
+ i3 && is_bound_this(n2(...i3), e2) && t2(null, ...i3));
1781
+ });
1782
+ }), () => {
1783
+ queue_micro_task(() => {
1784
+ o2 && is_bound_this(n2(...o2), e2) && t2(null, ...o2);
1785
+ });
1786
+ };
1787
+ }), e2;
1788
+ }
1789
+ function init(e2 = false) {
1790
+ const t2 = (
1791
+ /** @type {ComponentContextLegacy} */
1792
+ T
1793
+ ), n2 = t2.l.u;
1794
+ if (!n2) return;
1795
+ let props = () => deep_read_state(t2.s);
1796
+ if (e2) {
1797
+ let e3 = 0, n3 = (
1798
+ /** @type {Record<string, any>} */
1799
+ {}
1800
+ );
1801
+ const i2 = /* @__PURE__ */ derived(() => {
1802
+ let i3 = false;
1803
+ const o2 = t2.s;
1804
+ for (const e4 in o2) o2[e4] !== n3[e4] && (n3[e4] = o2[e4], i3 = true);
1805
+ return i3 && e3++, e3;
1806
+ });
1807
+ props = () => get$1(i2);
1808
+ }
1809
+ n2.b.length && function user_pre_effect(e3) {
1810
+ return validate_effect(), render_effect(e3);
1811
+ }(() => {
1812
+ observe_all(t2, props), run_all(n2.b);
1813
+ }), // onMount (must run before afterUpdate)
1814
+ user_effect(() => {
1815
+ const e3 = untrack(() => n2.m.map(run));
1816
+ return () => {
1817
+ for (const t3 of e3) "function" == typeof t3 && t3();
1818
+ };
1819
+ }), // afterUpdate
1820
+ n2.a.length && user_effect(() => {
1821
+ observe_all(t2, props), run_all(n2.a);
1822
+ });
1823
+ }
1824
+ function observe_all(e2, t2) {
1825
+ if (e2.l.s) for (const t3 of e2.l.s) get$1(t3);
1826
+ t2();
1827
+ }
1828
+ function subscribe_to_store(e2, t2, n2) {
1829
+ if (null == e2)
1830
+ return t2(void 0), noop;
1831
+ const i2 = untrack(() => e2.subscribe(
1832
+ t2,
1833
+ // @ts-expect-error
1834
+ n2
1835
+ ));
1836
+ return i2.unsubscribe ? () => i2.unsubscribe() : i2;
1837
+ }
1838
+ const _e = [];
1839
+ function writable(e2, t2 = noop) {
1840
+ let n2 = null;
1841
+ const i2 = /* @__PURE__ */ new Set();
1842
+ function set2(t3) {
1843
+ if (safe_not_equal(e2, t3) && (e2 = t3, n2)) {
1844
+ const t4 = !_e.length;
1845
+ for (const t5 of i2) t5[1](), _e.push(t5, e2);
1846
+ if (t4) {
1847
+ for (let e3 = 0; e3 < _e.length; e3 += 2) _e[e3][0](_e[e3 + 1]);
1848
+ _e.length = 0;
1849
+ }
1850
+ }
1851
+ }
1852
+ function update2(t3) {
1853
+ set2(t3(
1854
+ /** @type {T} */
1855
+ e2
1856
+ ));
1857
+ }
1858
+ return {
1859
+ set: set2,
1860
+ update: update2,
1861
+ subscribe: function subscribe(o2, s2 = noop) {
1862
+ const a2 = [o2, s2];
1863
+ return i2.add(a2), 1 === i2.size && (n2 = t2(set2, update2) || noop), o2(
1864
+ /** @type {T} */
1865
+ e2
1866
+ ), () => {
1867
+ i2.delete(a2), 0 === i2.size && n2 && (n2(), n2 = null);
1868
+ };
1869
+ }
1870
+ };
1871
+ }
1872
+ function get(e2) {
1873
+ let t2;
1874
+ return subscribe_to_store(e2, (e3) => t2 = e3)(), t2;
1875
+ }
1876
+ let ve = false, ge = Symbol();
1877
+ function store_get(e2, t2, n2) {
1878
+ const i2 = n2[t2] ?? (n2[t2] = {
1879
+ store: null,
1880
+ source: /* @__PURE__ */ mutable_source(void 0),
1881
+ unsubscribe: noop
1882
+ });
1883
+ if (i2.store !== e2 && !(ge in n2)) if (i2.unsubscribe(), i2.store = e2 ?? null, null == e2) i2.source.v = void 0, // see synchronous callback comment below
1884
+ i2.unsubscribe = noop;
1885
+ else {
1886
+ var o2 = true;
1887
+ i2.unsubscribe = subscribe_to_store(e2, (e3) => {
1888
+ o2 ? (
1889
+ // If the first updates to the store value (possibly multiple of them) are synchronously
1890
+ // inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value
1891
+ i2.source.v = e3
1892
+ ) : set(i2.source, e3);
1893
+ }), o2 = false;
1894
+ }
1895
+ return e2 && ge in n2 ? get(e2) : get$1(i2.source);
1896
+ }
1897
+ function store_set(e2, t2) {
1898
+ return e2.set(t2), t2;
1899
+ }
1900
+ function setup_stores() {
1901
+ const e2 = {};
1902
+ return [e2, function cleanup() {
1903
+ teardown(() => {
1904
+ for (var t2 in e2) {
1905
+ e2[t2].unsubscribe();
1906
+ }
1907
+ o(e2, ge, {
1908
+ enumerable: false,
1909
+ value: true
1910
+ });
1911
+ });
1912
+ }];
1913
+ }
1914
+ const he = {
1915
+ get(e2, t2) {
1916
+ if (!e2.exclude.includes(t2)) return get$1(e2.version), t2 in e2.special ? e2.special[t2]() : e2.props[t2];
1917
+ },
1918
+ set: (e2, t2, n2) => (t2 in e2.special || // Handle props that can temporarily get out of sync with the parent
1919
+ /** @type {Record<string, (v?: unknown) => unknown>} */
1920
+ (e2.special[t2] = prop(
1921
+ {
1922
+ get [t2]() {
1923
+ return e2.props[t2];
1924
+ }
1925
+ },
1926
+ /** @type {string} */
1927
+ t2,
1928
+ 4
1929
+ )), e2.special[t2](n2), update(e2.version), true),
1930
+ getOwnPropertyDescriptor(e2, t2) {
1931
+ if (!e2.exclude.includes(t2)) return t2 in e2.props ? {
1932
+ enumerable: true,
1933
+ configurable: true,
1934
+ value: e2.props[t2]
1935
+ } : void 0;
1936
+ },
1937
+ deleteProperty: (e2, t2) => (
1938
+ // Svelte 4 allowed for deletions on $$restProps
1939
+ (e2.exclude.includes(t2) || (e2.exclude.push(t2), update(e2.version)), true)
1940
+ ),
1941
+ has: (e2, t2) => !e2.exclude.includes(t2) && t2 in e2.props,
1942
+ ownKeys: (e2) => Reflect.ownKeys(e2.props).filter((t2) => !e2.exclude.includes(t2))
1943
+ };
1944
+ function legacy_rest_props(e2, t2) {
1945
+ return new Proxy({
1946
+ props: e2,
1947
+ exclude: t2,
1948
+ special: {},
1949
+ version: source(0)
1950
+ }, he);
1951
+ }
1952
+ const me = {
1953
+ get(e2, t2) {
1954
+ let n2 = e2.props.length;
1955
+ for (; n2--; ) {
1956
+ let i2 = e2.props[n2];
1957
+ if (is_function(i2) && (i2 = i2()), "object" == typeof i2 && null !== i2 && t2 in i2) return i2[t2];
1958
+ }
1959
+ },
1960
+ set(e2, t2, n2) {
1961
+ let i2 = e2.props.length;
1962
+ for (; i2--; ) {
1963
+ let o2 = e2.props[i2];
1964
+ is_function(o2) && (o2 = o2());
1965
+ const a2 = s(o2, t2);
1966
+ if (a2 && a2.set) return a2.set(n2), true;
1967
+ }
1968
+ return false;
1969
+ },
1970
+ getOwnPropertyDescriptor(e2, t2) {
1971
+ let n2 = e2.props.length;
1972
+ for (; n2--; ) {
1973
+ let i2 = e2.props[n2];
1974
+ if (is_function(i2) && (i2 = i2()), "object" == typeof i2 && null !== i2 && t2 in i2) {
1975
+ const e3 = s(i2, t2);
1976
+ return e3 && !e3.configurable && // Prevent a "Non-configurability Report Error": The target is an array, it does
1977
+ // not actually contain this property. If it is now described as non-configurable,
1978
+ // the proxy throws a validation error. Setting it to true avoids that.
1979
+ (e3.configurable = true), e3;
1980
+ }
1981
+ }
1982
+ },
1983
+ has(e2, t2) {
1984
+ if (t2 === w || t2 === x) return false;
1985
+ for (let n2 of e2.props) if (is_function(n2) && (n2 = n2()), null != n2 && t2 in n2) return true;
1986
+ return false;
1987
+ },
1988
+ ownKeys(e2) {
1989
+ const t2 = [];
1990
+ for (let n2 of e2.props) {
1991
+ is_function(n2) && (n2 = n2());
1992
+ for (const e3 in n2) t2.includes(e3) || t2.push(e3);
1993
+ }
1994
+ return t2;
1995
+ }
1996
+ };
1997
+ function spread_props(...e2) {
1998
+ return new Proxy({
1999
+ props: e2
2000
+ }, me);
2001
+ }
2002
+ function prop(e2, t2, n2, i2) {
2003
+ var _a;
2004
+ var o2, a2 = !!(1 & n2), l2 = !C || !!(2 & n2), c2 = !!(8 & n2), u2 = !!(16 & n2), d2 = false;
2005
+ c2 ? [o2, d2] = function capture_store_binding(e3) {
2006
+ var t3 = ve;
2007
+ try {
2008
+ return ve = false, [e3(), ve];
2009
+ } finally {
2010
+ ve = t3;
2011
+ }
2012
+ }(() => (
2013
+ /** @type {V} */
2014
+ e2[t2]
2015
+ )) : o2 = /** @type {V} */
2016
+ e2[t2];
2017
+ var f2, p2 = w in e2 || x in e2, _2 = c2 && (((_a = s(e2, t2)) == null ? void 0 : _a.set) ?? (p2 && t2 in e2 && ((n3) => e2[t2] = n3))) || void 0, v2 = (
2018
+ /** @type {V} */
2019
+ i2
2020
+ ), g2 = true, h2 = false, get_fallback = () => (h2 = true, g2 && (g2 = false, v2 = u2 ? untrack(
2021
+ /** @type {() => V} */
2022
+ i2
2023
+ ) : (
2024
+ /** @type {V} */
2025
+ i2
2026
+ )), v2);
2027
+ if (void 0 === o2 && void 0 !== i2 && (_2 && l2 && function props_invalid_value(e3) {
2028
+ throw new Error("https://svelte.dev/e/props_invalid_value");
2029
+ }(), o2 = get_fallback(), _2 && _2(o2)), l2) f2 = () => {
2030
+ var n3 = (
2031
+ /** @type {V} */
2032
+ e2[t2]
2033
+ );
2034
+ return void 0 === n3 ? get_fallback() : (g2 = true, h2 = false, n3);
2035
+ };
2036
+ else {
2037
+ var m2 = (a2 ? derived : derived_safe_equal)(() => (
2038
+ /** @type {V} */
2039
+ e2[t2]
2040
+ ));
2041
+ m2.f |= 131072, f2 = () => {
2042
+ var e3 = get$1(m2);
2043
+ return void 0 !== e3 && (v2 = /** @type {V} */
2044
+ void 0), void 0 === e3 ? v2 : e3;
2045
+ };
2046
+ }
2047
+ if (!(4 & n2)) return f2;
2048
+ if (_2) {
2049
+ var b2 = e2.$$legacy;
2050
+ return function(e3, t3) {
2051
+ return arguments.length > 0 ? (
2052
+ // We don't want to notify if the value was mutated and the parent is in runes mode.
2053
+ // In that case the state proxy (if it exists) should take care of the notification.
2054
+ // If the parent is not in runes mode, we need to notify on mutation, too, that the prop
2055
+ // has changed because the parent will not be able to detect the change otherwise.
2056
+ (l2 && t3 && !b2 && !d2 || /** @type {Function} */
2057
+ _2(t3 ? f2() : e3), e3)
2058
+ ) : f2();
2059
+ };
2060
+ }
2061
+ var y2 = false, $2 = /* @__PURE__ */ mutable_source(o2), k2 = /* @__PURE__ */ derived(() => {
2062
+ var e3 = f2(), t3 = get$1($2);
2063
+ return y2 ? (y2 = false, t3) : $2.v = e3;
2064
+ });
2065
+ return a2 || (k2.equals = safe_equals), function(e3, t3) {
2066
+ if (arguments.length > 0) {
2067
+ const n3 = t3 ? get$1(k2) : l2 && c2 ? proxy(e3) : e3;
2068
+ return k2.equals(n3) || (y2 = true, set($2, n3), // To ensure the fallback value is consistent when used with proxies, we
2069
+ // update the local fallback_value, but only if the fallback is actively used
2070
+ h2 && void 0 !== v2 && (v2 = n3), untrack(() => get$1(k2))), e3;
2071
+ }
2072
+ return get$1(k2);
2073
+ };
2074
+ }
2075
+ function onMount(e2) {
2076
+ null === T && lifecycle_outside_component(), C && null !== T.l ? (
2077
+ /**
2078
+ * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
2079
+ * @param {ComponentContext} context
2080
+ */
2081
+ function init_update_callbacks(e3) {
2082
+ var t2 = (
2083
+ /** @type {ComponentContextLegacy} */
2084
+ e3.l
2085
+ );
2086
+ return t2.u ?? (t2.u = {
2087
+ a: [],
2088
+ b: [],
2089
+ m: []
2090
+ });
2091
+ }(T).m.push(e2)
2092
+ ) : user_effect(() => {
2093
+ const t2 = untrack(e2);
2094
+ if ("function" == typeof t2) return t2;
2095
+ });
2096
+ }
2097
+ "undefined" != typeof window && // @ts-ignore
2098
+ (window.__svelte || (window.__svelte = {
2099
+ v: /* @__PURE__ */ new Set()
2100
+ })).v.add("5"), function enable_legacy_mode_flag() {
2101
+ C = true;
2102
+ }();
2103
+ /**
2104
+ * @license lucide-svelte v0.476.0 - ISC
2105
+ *
2106
+ * ISC License
2107
+ *
2108
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
2109
+ *
2110
+ * Permission to use, copy, modify, and/or distribute this software for any
2111
+ * purpose with or without fee is hereby granted, provided that the above
2112
+ * copyright notice and this permission notice appear in all copies.
2113
+ *
2114
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
2115
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
2116
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
2117
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2118
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
2119
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
2120
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2121
+ *
2122
+ */
2123
+ const be = {
2124
+ xmlns: "http://www.w3.org/2000/svg",
2125
+ width: 24,
2126
+ height: 24,
2127
+ viewBox: "0 0 24 24",
2128
+ fill: "none",
2129
+ stroke: "currentColor",
2130
+ "stroke-width": 2,
2131
+ "stroke-linecap": "round",
2132
+ "stroke-linejoin": "round"
2133
+ };
2134
+ var ye = /* @__PURE__ */ ns_template("<svg><!><!></svg>");
2135
+ function Icon$1(e2, t2) {
2136
+ const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]), i2 = legacy_rest_props(n2, ["name", "color", "size", "strokeWidth", "absoluteStrokeWidth", "iconNode"]);
2137
+ push(t2, false);
2138
+ let o2 = prop(t2, "name", 8, void 0), s2 = prop(t2, "color", 8, "currentColor"), a2 = prop(t2, "size", 8, 24), l2 = prop(t2, "strokeWidth", 8, 2), c2 = prop(t2, "absoluteStrokeWidth", 8, false), u2 = prop(t2, "iconNode", 24, () => []);
2139
+ init();
2140
+ var d2 = ye();
2141
+ let f2;
2142
+ var p2 = child(d2);
2143
+ each(p2, 1, u2, index, (e3, t3) => {
2144
+ var n3 = comment();
2145
+ !function element(e4, t4, n4, i3, o3, s3) {
2146
+ var a3, l3, c3, u3 = null, d3 = (
2147
+ /** @type {TemplateNode} */
2148
+ e4
2149
+ ), f3 = ce;
2150
+ block(() => {
2151
+ const e5 = t4() || null;
2152
+ var n5 = S;
2153
+ if (e5 !== a3) {
2154
+ var o4 = ce;
2155
+ set_current_each_item(f3), c3 && (null === e5 ? (
2156
+ // start outro
2157
+ pause_effect(c3, () => {
2158
+ c3 = null, l3 = null;
2159
+ })
2160
+ ) : e5 === l3 ? (
2161
+ // same tag as is currently rendered — abort outro
2162
+ resume_effect(c3)
2163
+ ) : (
2164
+ // tag is changing — destroy immediately, render contents without intro transitions
2165
+ (destroy_effect(c3), set_should_intro(false))
2166
+ )), e5 && e5 !== l3 && (c3 = branch(() => {
2167
+ if (assign_nodes(u3 = document.createElementNS(n5, e5), u3), i3) {
2168
+ var t5 = (
2169
+ /** @type {TemplateNode} */
2170
+ u3.appendChild(create_text())
2171
+ );
2172
+ i3(u3, t5);
2173
+ }
2174
+ H.nodes_end = u3, d3.before(u3);
2175
+ })), (a3 = e5) && (l3 = a3), set_should_intro(true), set_current_each_item(o4);
2176
+ }
2177
+ }, y);
2178
+ }(first_child(n3), () => get$1(t3)[0], 0, (e4, n4) => {
2179
+ let i3;
2180
+ template_effect(() => i3 = set_attributes(e4, i3, {
2181
+ ...get$1(t3)[1]
2182
+ }, void 0, e4.namespaceURI === S, e4.nodeName.includes("-")));
2183
+ }), append(e3, n3);
2184
+ }), slot(sibling(p2), t2, "default", {}, null), template_effect((e3, t3) => f2 = set_attributes(d2, f2, {
2185
+ ...be,
2186
+ ...i2,
2187
+ width: a2(),
2188
+ height: a2(),
2189
+ stroke: s2(),
2190
+ "stroke-width": e3,
2191
+ class: t3
2192
+ }, void 0, true), [() => c2() ? 24 * Number(l2()) / Number(a2()) : l2(), () => ((...e3) => e3.filter((e4, t3, n3) => Boolean(e4) && n3.indexOf(e4) === t3).join(" "))("lucide-icon", "lucide", o2() ? `lucide-${o2()}` : "", n2.class)], derived_safe_equal), append(e2, d2), pop();
2193
+ }
2194
+ function Loader_circle(e2, t2) {
2195
+ const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]);
2196
+ Icon$1(e2, spread_props({
2197
+ name: "loader-circle"
2198
+ }, () => n2, {
2199
+ iconNode: [["path", {
2200
+ d: "M21 12a9 9 0 1 1-6.219-8.56"
2201
+ }]],
2202
+ children: (e3, n3) => {
2203
+ var i2 = comment();
2204
+ slot(first_child(i2), t2, "default", {}, null), append(e3, i2);
2205
+ },
2206
+ $$slots: {
2207
+ default: true
2208
+ }
2209
+ }));
2210
+ }
2211
+ var on_click$2 = (e2, t2) => {
2212
+ var _a;
2213
+ (_a = t2.onClick) == null ? void 0 : _a.call(t2);
2214
+ }, $e = /* @__PURE__ */ template('<button id="floating playlight button" aria-label="Open Playlight Discovery"><p class="z-2 flex items-center overflow-hidden svelte-1j97rta"><!> <span class="mr-0.25 inline-block svelte-1j97rta">More Games</span></p> <div class="absolute bottom-0 left-0 h-full w-0 bg-black transition-all duration-300 group-hover:w-full svelte-1j97rta"></div></button>');
2215
+ function FloatingButton(e2, t2) {
2216
+ push(t2, true);
2217
+ let n2 = prop(t2, "position", 3, "bottom-right"), i2 = prop(t2, "visible", 3, true);
2218
+ var o2 = comment(), s2 = first_child(o2), consequent = (e3) => {
2219
+ var i3 = $e();
2220
+ i3.__click = [on_click$2, t2];
2221
+ var o3 = child(i3);
2222
+ !function Gamepad(e4, t3) {
2223
+ const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
2224
+ Icon$1(e4, spread_props({
2225
+ name: "gamepad"
2226
+ }, () => n3, {
2227
+ iconNode: [["line", {
2228
+ x1: "6",
2229
+ x2: "10",
2230
+ y1: "12",
2231
+ y2: "12"
2232
+ }], ["line", {
2233
+ x1: "8",
2234
+ x2: "8",
2235
+ y1: "10",
2236
+ y2: "14"
2237
+ }], ["line", {
2238
+ x1: "15",
2239
+ x2: "15.01",
2240
+ y1: "13",
2241
+ y2: "13"
2242
+ }], ["line", {
2243
+ x1: "18",
2244
+ x2: "18.01",
2245
+ y1: "11",
2246
+ y2: "11"
2247
+ }], ["rect", {
2248
+ width: "20",
2249
+ height: "12",
2250
+ x: "2",
2251
+ y: "6",
2252
+ rx: "2"
2253
+ }]],
2254
+ children: (e5, n4) => {
2255
+ var i4 = comment();
2256
+ slot(first_child(i4), t3, "default", {}, null), append(e5, i4);
2257
+ },
2258
+ $$slots: {
2259
+ default: true
2260
+ }
2261
+ }));
2262
+ }(child(o3), {
2263
+ size: 26,
2264
+ strokeWidth: 1.75,
2265
+ class: "z-2 mr-2 transform transition-all duration-300 group-hover:rotate-12"
2266
+ }), template_effect(() => set_class(i3, 1, `fixed ${("bottom-left" == n2() ? "bottom-4 left-4" : "bottom-right" == n2() ? "right-4 bottom-4" : "") ?? ""} group children-text-white z-99990 flex cursor-pointer gap-2 rounded-md bg-white p-3 font-bold text-black uppercase shadow-lg transition-all hover:scale-105`, "svelte-1j97rta")), append(e3, i3);
2267
+ };
2268
+ if_block(s2, (e3) => {
2269
+ i2() && e3(consequent);
2270
+ }), append(e2, o2), pop();
2271
+ }
2272
+ function cubic_out(e2) {
2273
+ const t2 = e2 - 1;
2274
+ return t2 * t2 * t2 + 1;
2275
+ }
2276
+ function cubic_in_out(e2) {
2277
+ return e2 < 0.5 ? 4 * e2 * e2 * e2 : 0.5 * Math.pow(2 * e2 - 2, 3) + 1;
2278
+ }
2279
+ function split_css_unit(e2) {
2280
+ const t2 = "string" == typeof e2 && e2.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
2281
+ return t2 ? [parseFloat(t2[1]), t2[2] || "px"] : [
2282
+ /** @type {number} */
2283
+ e2,
2284
+ "px"
2285
+ ];
2286
+ }
2287
+ function blur(e2, { delay: t2 = 0, duration: n2 = 400, easing: i2 = cubic_in_out, amount: o2 = 5, opacity: s2 = 0 } = {}) {
2288
+ const a2 = getComputedStyle(e2), l2 = +a2.opacity, c2 = "none" === a2.filter ? "" : a2.filter, u2 = l2 * (1 - s2), [d2, f2] = split_css_unit(o2);
2289
+ return {
2290
+ delay: t2,
2291
+ duration: n2,
2292
+ easing: i2,
2293
+ css: (e3, t3) => `opacity: ${l2 - u2 * t3}; filter: ${c2} blur(${t3 * d2}${f2});`
2294
+ };
2295
+ }
2296
+ function fly(e2, { delay: t2 = 0, duration: n2 = 400, easing: i2 = cubic_out, x: o2 = 0, y: s2 = 0, opacity: a2 = 0 } = {}) {
2297
+ const l2 = getComputedStyle(e2), c2 = +l2.opacity, u2 = "none" === l2.transform ? "" : l2.transform, d2 = c2 * (1 - a2), [f2, p2] = split_css_unit(o2), [_2, v2] = split_css_unit(s2);
2298
+ return {
2299
+ delay: t2,
2300
+ duration: n2,
2301
+ easing: i2,
2302
+ css: (e3, t3) => `
2303
+ transform: ${u2} translate(${(1 - e3) * f2}${p2}, ${(1 - e3) * _2}${v2});
2304
+ opacity: ${c2 - d2 * t3}`
2305
+ };
2306
+ }
2307
+ function slide(e2, { delay: t2 = 0, duration: n2 = 400, easing: i2 = cubic_out, axis: o2 = "y" } = {}) {
2308
+ const s2 = getComputedStyle(e2), a2 = +s2.opacity, l2 = "y" === o2 ? "height" : "width", c2 = parseFloat(s2[l2]), u2 = "y" === o2 ? ["top", "bottom"] : ["left", "right"], d2 = u2.map((e3) => (
2309
+ /** @type {'Left' | 'Right' | 'Top' | 'Bottom'} */
2310
+ `${e3[0].toUpperCase()}${e3.slice(1)}`
2311
+ )), f2 = parseFloat(s2[`padding${d2[0]}`]), p2 = parseFloat(s2[`padding${d2[1]}`]), _2 = parseFloat(s2[`margin${d2[0]}`]), v2 = parseFloat(s2[`margin${d2[1]}`]), g2 = parseFloat(s2[`border${d2[0]}Width`]), h2 = parseFloat(s2[`border${d2[1]}Width`]);
2312
+ return {
2313
+ delay: t2,
2314
+ duration: n2,
2315
+ easing: i2,
2316
+ css: (e3) => `overflow: hidden;opacity: ${Math.min(20 * e3, 1) * a2};${l2}: ${e3 * c2}px;padding-${u2[0]}: ${e3 * f2}px;padding-${u2[1]}: ${e3 * p2}px;margin-${u2[0]}: ${e3 * _2}px;margin-${u2[1]}: ${e3 * v2}px;border-${u2[0]}-width: ${e3 * g2}px;border-${u2[1]}-width: ${e3 * h2}px;min-${l2}: 0`
2317
+ };
2318
+ }
2319
+ function scale(e2, { delay: t2 = 0, duration: n2 = 400, easing: i2 = cubic_out, start: o2 = 0, opacity: s2 = 0 } = {}) {
2320
+ const a2 = getComputedStyle(e2), l2 = +a2.opacity, c2 = "none" === a2.transform ? "" : a2.transform, u2 = 1 - o2, d2 = l2 * (1 - s2);
2321
+ return {
2322
+ delay: t2,
2323
+ duration: n2,
2324
+ easing: i2,
2325
+ css: (e3, t3) => `
2326
+ transform: ${c2} scale(${1 - u2 * t3});
2327
+ opacity: ${l2 - d2 * t3}
2328
+ `
2329
+ };
2330
+ }
2331
+ delegate(["click"]);
2332
+ var we = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg>'), xe = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>'), ke = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg>'), Ce = /* @__PURE__ */ ns_template('<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg>');
2333
+ function Icon(e2, t2) {
2334
+ let n2 = prop(t2, "type", 8, "success");
2335
+ var i2 = comment(), o2 = first_child(i2), consequent = (e3) => {
2336
+ append(e3, we());
2337
+ }, alternate_3 = (e3) => {
2338
+ var t3 = comment(), i3 = first_child(t3), consequent_1 = (e4) => {
2339
+ append(e4, xe());
2340
+ }, alternate_2 = (e4) => {
2341
+ var t4 = comment(), i4 = first_child(t4), consequent_2 = (e5) => {
2342
+ append(e5, ke());
2343
+ }, alternate_1 = (e5) => {
2344
+ var t5 = comment(), i5 = first_child(t5), consequent_3 = (e6) => {
2345
+ append(e6, Ce());
2346
+ }, alternate = (e6) => {
2347
+ };
2348
+ if_block(i5, (e6) => {
2349
+ "warning" === n2() ? e6(consequent_3) : e6(alternate, false);
2350
+ }, true), append(e5, t5);
2351
+ };
2352
+ if_block(i4, (e5) => {
2353
+ "info" === n2() ? e5(consequent_2) : e5(alternate_1, false);
2354
+ }, true), append(e4, t4);
2355
+ };
2356
+ if_block(i3, (e4) => {
2357
+ "error" === n2() ? e4(consequent_1) : e4(alternate_2, false);
2358
+ }, true), append(e3, t3);
2359
+ };
2360
+ if_block(o2, (e3) => {
2361
+ "success" === n2() ? e3(consequent) : e3(alternate_3, false);
2362
+ }), append(e2, i2);
2363
+ }
2364
+ var Me = /* @__PURE__ */ template('<div class="sonner-loading-bar"></div>'), Se = /* @__PURE__ */ template('<div class="sonner-loading-wrapper"><div class="sonner-spinner"></div></div>');
2365
+ function Loader(e2, t2) {
2366
+ push(t2, false);
2367
+ let n2 = prop(t2, "visible", 8);
2368
+ const i2 = Array(12).fill(0);
2369
+ init();
2370
+ var o2 = Se();
2371
+ each(child(o2), 5, () => i2, index, (e3, t3) => {
2372
+ append(e3, Me());
2373
+ }), template_effect(() => set_attribute(o2, "data-visible", n2())), append(e2, o2), pop();
2374
+ }
2375
+ function cn(...e2) {
2376
+ return e2.filter(Boolean).join(" ");
2377
+ }
2378
+ const Te = "undefined" != typeof document;
2379
+ function clientWritable(e2) {
2380
+ const t2 = writable(e2);
2381
+ return {
2382
+ subscribe: t2.subscribe,
2383
+ set: function set2(e3) {
2384
+ Te && t2.set(e3);
2385
+ },
2386
+ update: function update2(e3) {
2387
+ Te && t2.update(e3);
2388
+ }
2389
+ };
2390
+ }
2391
+ let qe = 0;
2392
+ const Ie = function createToastState() {
2393
+ const e2 = clientWritable([]), t2 = clientWritable([]);
2394
+ function addToast(t3) {
2395
+ e2.update((e3) => [t3, ...e3]);
2396
+ }
2397
+ function create(t3) {
2398
+ var _a;
2399
+ const { message: n2, ...i2 } = t3, o2 = "number" == typeof (t3 == null ? void 0 : t3.id) || t3.id && ((_a = t3.id) == null ? void 0 : _a.length) > 0 ? t3.id : qe++, s2 = void 0 === t3.dismissable || t3.dismissable, a2 = void 0 === t3.type ? "default" : t3.type, l2 = get(e2).find((e3) => e3.id === o2);
2400
+ return l2 ? e2.update((e3) => e3.map((e4) => e4.id === o2 ? {
2401
+ ...e4,
2402
+ ...t3,
2403
+ id: o2,
2404
+ title: n2,
2405
+ dismissable: s2,
2406
+ type: a2,
2407
+ updated: true
2408
+ } : {
2409
+ ...e4,
2410
+ updated: false
2411
+ })) : addToast({
2412
+ ...i2,
2413
+ id: o2,
2414
+ title: n2,
2415
+ dismissable: s2,
2416
+ type: a2
2417
+ }), o2;
2418
+ }
2419
+ function dismiss(t3) {
2420
+ if (void 0 !== t3) return e2.update((e3) => e3.map((e4) => e4.id === t3 ? {
2421
+ ...e4,
2422
+ dismiss: true
2423
+ } : e4)), t3;
2424
+ e2.update((e3) => e3.map((e4) => ({
2425
+ ...e4,
2426
+ dismiss: true
2427
+ })));
2428
+ }
2429
+ return {
2430
+ // methods
2431
+ create,
2432
+ addToast,
2433
+ dismiss,
2434
+ remove: function remove(t3) {
2435
+ if (void 0 !== t3) return e2.update((e3) => e3.filter((e4) => e4.id !== t3)), t3;
2436
+ e2.set([]);
2437
+ },
2438
+ message: function message(e3, t3) {
2439
+ return create({
2440
+ ...t3,
2441
+ type: "default",
2442
+ message: e3
2443
+ });
2444
+ },
2445
+ error: function error(e3, t3) {
2446
+ return create({
2447
+ ...t3,
2448
+ type: "error",
2449
+ message: e3
2450
+ });
2451
+ },
2452
+ success: function success(e3, t3) {
2453
+ return create({
2454
+ ...t3,
2455
+ type: "success",
2456
+ message: e3
2457
+ });
2458
+ },
2459
+ info: function info(e3, t3) {
2460
+ return create({
2461
+ ...t3,
2462
+ type: "info",
2463
+ message: e3
2464
+ });
2465
+ },
2466
+ warning: function warning(e3, t3) {
2467
+ return create({
2468
+ ...t3,
2469
+ type: "warning",
2470
+ message: e3
2471
+ });
2472
+ },
2473
+ loading: function loading(e3, t3) {
2474
+ return create({
2475
+ ...t3,
2476
+ type: "loading",
2477
+ message: e3
2478
+ });
2479
+ },
2480
+ promise: function promise(e3, t3) {
2481
+ if (!t3)
2482
+ return;
2483
+ let n2;
2484
+ void 0 !== t3.loading && (n2 = create({
2485
+ ...t3,
2486
+ promise: e3,
2487
+ type: "loading",
2488
+ message: t3.loading
2489
+ }));
2490
+ const i2 = e3 instanceof Promise ? e3 : e3();
2491
+ let o2 = void 0 !== n2;
2492
+ return i2.then((e4) => {
2493
+ if (e4 && "boolean" == typeof e4.ok && !e4.ok) {
2494
+ o2 = false;
2495
+ const i3 = "function" == typeof t3.error ? (
2496
+ // @ts-expect-error: Incorrect response type
2497
+ t3.error(`HTTP error! status: ${e4.status}`)
2498
+ ) : t3.error;
2499
+ create({
2500
+ id: n2,
2501
+ type: "error",
2502
+ message: i3
2503
+ });
2504
+ } else if (void 0 !== t3.success) {
2505
+ o2 = false;
2506
+ const i3 = (
2507
+ // @ts-expect-error: TODO: Better function checking
2508
+ "function" == typeof t3.success ? t3.success(e4) : t3.success
2509
+ );
2510
+ create({
2511
+ id: n2,
2512
+ type: "success",
2513
+ message: i3
2514
+ });
2515
+ }
2516
+ }).catch((e4) => {
2517
+ if (void 0 !== t3.error) {
2518
+ o2 = false;
2519
+ const i3 = (
2520
+ // @ts-expect-error: TODO: Better function checking
2521
+ "function" == typeof t3.error ? t3.error(e4) : t3.error
2522
+ );
2523
+ create({
2524
+ id: n2,
2525
+ type: "error",
2526
+ message: i3
2527
+ });
2528
+ }
2529
+ }).finally(() => {
2530
+ var _a;
2531
+ o2 && // Toast is still in load state (and will be indefinitely — dismiss it)
2532
+ (dismiss(n2), n2 = void 0), (_a = t3.finally) == null ? void 0 : _a.call(t3);
2533
+ }), n2;
2534
+ },
2535
+ custom: function custom(e3, t3) {
2536
+ const n2 = (t3 == null ? void 0 : t3.id) || qe++;
2537
+ return create({
2538
+ component: e3,
2539
+ id: n2,
2540
+ ...t3
2541
+ }), n2;
2542
+ },
2543
+ removeHeight: function removeHeight(e3) {
2544
+ t2.update((t3) => t3.filter((t4) => t4.toastId !== e3));
2545
+ },
2546
+ setHeight: function setHeight(e3) {
2547
+ void 0 !== get(t2).find((t3) => t3.toastId === e3.toastId) ? t2.update((t3) => t3.map((t4) => t4.toastId === e3.toastId ? e3 : t4)) : t2.update((t3) => [e3, ...t3]);
2548
+ },
2549
+ reset: function reset() {
2550
+ e2.set([]), t2.set([]);
2551
+ },
2552
+ // stores
2553
+ toasts: e2,
2554
+ heights: t2
2555
+ };
2556
+ }();
2557
+ const Pe = function toastFunction(e2, t2) {
2558
+ return Ie.create({
2559
+ message: e2,
2560
+ ...t2
2561
+ });
2562
+ }, Oe = Object.assign(Pe, {
2563
+ success: Ie.success,
2564
+ info: Ie.info,
2565
+ warning: Ie.warning,
2566
+ error: Ie.error,
2567
+ custom: Ie.custom,
2568
+ message: Ie.message,
2569
+ promise: Ie.promise,
2570
+ dismiss: Ie.dismiss,
2571
+ loading: Ie.loading
2572
+ });
2573
+ var Ee = /* @__PURE__ */ template('<button aria-label="Close toast" data-close-button=""><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>'), je = /* @__PURE__ */ template('<div data-icon=""><!> <!></div>'), Ne = /* @__PURE__ */ template('<div data-title=""><!></div>'), Be = /* @__PURE__ */ template('<div data-description=""><!></div>'), ze = /* @__PURE__ */ template('<button data-button="" data-cancel=""> </button>'), De = /* @__PURE__ */ template('<button data-button=""> </button>'), Ae = /* @__PURE__ */ template('<!> <div data-content=""><!> <!></div> <!> <!>', 1), Le = /* @__PURE__ */ template('<li aria-atomic="true" role="status" data-sonner-toast=""><!> <!></li>');
2574
+ function Toast(e2, t2) {
2575
+ const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]);
2576
+ push(t2, false);
2577
+ const [i2, o2] = setup_stores(), $heights = () => store_get(y2, "$heights", i2), $effect = () => store_get(get$1(Q2), "$effect", i2), s2 = mutable_state(void 0, true), a2 = mutable_state(void 0, true), l2 = mutable_state(void 0, true), c2 = mutable_state(void 0, true), u2 = mutable_state(void 0, true), d2 = mutable_state(void 0, true), f2 = mutable_state(void 0, true), p2 = mutable_state(void 0, true), _2 = mutable_state(void 0, true), v2 = mutable_state(void 0, true), g2 = mutable_state(void 0, true), h2 = mutable_state(void 0, true), m2 = {
2578
+ toast: "",
2579
+ title: "",
2580
+ description: "",
2581
+ loader: "",
2582
+ closeButton: "",
2583
+ cancelButton: "",
2584
+ actionButton: "",
2585
+ action: "",
2586
+ warning: "",
2587
+ error: "",
2588
+ success: "",
2589
+ default: "",
2590
+ info: "",
2591
+ loading: ""
2592
+ }, { toasts: b2, heights: y2, removeHeight: $2, setHeight: w2, remove: x2 } = Ie;
2593
+ let k2 = prop(t2, "toast", 9), C2 = prop(t2, "index", 9), M2 = prop(t2, "expanded", 9), S2 = prop(t2, "invert", 13), T2 = prop(t2, "position", 9), q2 = prop(t2, "visibleToasts", 9), I2 = prop(t2, "expandByDefault", 9), P2 = prop(t2, "closeButton", 9), O2 = prop(t2, "interacting", 9), E2 = prop(t2, "cancelButtonStyle", 9, ""), j2 = prop(t2, "actionButtonStyle", 9, ""), N2 = prop(t2, "duration", 9, 4e3), B2 = prop(t2, "descriptionClass", 9, ""), z2 = prop(t2, "classes", 29, () => ({})), D2 = prop(t2, "unstyled", 9, false), A2 = mutable_state(false, true), L2 = mutable_state(false, true), W2 = mutable_state(false, true), F2 = mutable_state(false, true), G2 = mutable_state(0, true), H2 = mutable_state(0, true), R2 = mutable_state(void 0, true), V2 = mutable_state(0, true), K2 = 0, U2 = 0, Z2 = null;
2594
+ function deleteToast() {
2595
+ set(L2, true), // Save the offset for the exit swipe animation
2596
+ set(G2, get$1(V2)), $2(k2().id), setTimeout(() => {
2597
+ x2(k2().id);
2598
+ }, 200);
2599
+ }
2600
+ let Y2 = mutable_state(void 0, true), J2 = mutable_state(k2().duration || N2() || 4e3, true);
2601
+ function startTimer() {
2602
+ K2 = (/* @__PURE__ */ new Date()).getTime(), // Let the toast know it has started
2603
+ set(Y2, setTimeout(() => {
2604
+ var _a, _b;
2605
+ (_b = (_a = k2()).onAutoClose) == null ? void 0 : _b.call(_a, k2()), deleteToast();
2606
+ }, get$1(J2)));
2607
+ }
2608
+ let Q2 = mutable_state(void 0, true);
2609
+ onMount(() => {
2610
+ set(A2, true);
2611
+ const e3 = get$1(R2).getBoundingClientRect().height;
2612
+ return set(H2, e3), w2({
2613
+ toastId: k2().id,
2614
+ height: e3
2615
+ }), () => $2(k2().id);
2616
+ }), legacy_pre_effect(() => deep_read_state(z2()), () => {
2617
+ z2({
2618
+ ...m2,
2619
+ ...z2()
2620
+ });
2621
+ }), legacy_pre_effect(() => deep_read_state(C2()), () => {
2622
+ set(s2, 0 === C2());
2623
+ }), legacy_pre_effect(() => (deep_read_state(C2()), deep_read_state(q2())), () => {
2624
+ set(a2, C2() + 1 <= q2());
2625
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2626
+ set(l2, k2().title);
2627
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2628
+ set(c2, k2().description);
2629
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2630
+ set(u2, k2().type);
2631
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2632
+ set(d2, k2().class || "");
2633
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2634
+ set(f2, k2().descriptionClass || "");
2635
+ }), legacy_pre_effect(() => ($heights(), deep_read_state(k2())), () => {
2636
+ set(p2, $heights().findIndex((e3) => e3.toastId === k2().id) || 0);
2637
+ }), legacy_pre_effect(() => deep_read_state(T2()), () => {
2638
+ set(_2, T2().split("-"));
2639
+ }), legacy_pre_effect(() => ($heights(), get$1(p2)), () => {
2640
+ set(v2, $heights().reduce((e3, t3, n3) => (
2641
+ // Calculate offset up untill current toast
2642
+ n3 >= get$1(p2) ? e3 : e3 + t3.height
2643
+ ), 0));
2644
+ }), legacy_pre_effect(() => (deep_read_state(S2()), deep_read_state(k2())), () => {
2645
+ S2(k2().invert || S2());
2646
+ }), legacy_pre_effect(() => get$1(u2), () => {
2647
+ set(g2, "loading" === get$1(u2));
2648
+ }), legacy_pre_effect(() => (get$1(p2), get$1(v2)), () => {
2649
+ set(V2, Math.round(14 * get$1(p2) + get$1(v2)));
2650
+ }), legacy_pre_effect(() => (get$1(l2), get$1(c2)), () => {
2651
+ get$1(l2), get$1(c2), // Listen to height changes
2652
+ async function updateHeights() {
2653
+ if (!get$1(A2)) return;
2654
+ let e3;
2655
+ await tick(), e3 = M2() || I2() ? 1 : 1 - 0.05 * C2(), get$1(R2).style.setProperty("height", "auto");
2656
+ const t3 = get$1(R2).offsetHeight, n3 = get$1(R2).getBoundingClientRect().height, i3 = Math.round(100 * (n3 / e3 + Number.EPSILON)) / 100;
2657
+ let o3;
2658
+ get$1(R2).style.removeProperty("height"), // Use scaledRectHeight as it's more precise
2659
+ o3 = Math.abs(i3 - t3) < 1 ? i3 : t3, set(H2, o3), w2({
2660
+ toastId: k2().id,
2661
+ height: o3
2662
+ });
2663
+ }();
2664
+ }), legacy_pre_effect(() => (deep_read_state(k2()), get$1(Y2), deep_read_state(N2())), () => {
2665
+ k2().updated && // if the toast has been updated after the initial render,
2666
+ // we want to reset the timer and set the remaining time to the
2667
+ // new duration
2668
+ (clearTimeout(get$1(Y2)), set(J2, k2().duration || N2() || 4e3), startTimer());
2669
+ }), legacy_pre_effect(() => (deep_read_state(k2()), get$1(u2)), () => {
2670
+ set(h2, k2().promise && "loading" === get$1(u2) || k2().duration === Number.POSITIVE_INFINITY);
2671
+ }), legacy_pre_effect(() => (get$1(h2), deep_read_state(M2()), deep_read_state(O2()), get$1(Y2)), () => {
2672
+ var e3;
2673
+ !function store_unsub(e4, t3, n3) {
2674
+ let i3 = n3[t3];
2675
+ return i3 && i3.store !== e4 && // Don't reset store yet, so that store_get above can resubscribe to new store if necessary
2676
+ (i3.unsubscribe(), i3.unsubscribe = noop), e4;
2677
+ }(set(Q2, (e3 = () => (get$1(h2) || (M2() || O2() ? (
2678
+ // If toast's duration changes, it will be out of sync with the
2679
+ // remainingAtTimeout, so we know we need to restart the timer
2680
+ // with the new duration
2681
+ // Pause the tmer on each hover
2682
+ function pauseTimer() {
2683
+ if (U2 < K2) {
2684
+ const e4 = (/* @__PURE__ */ new Date()).getTime() - K2;
2685
+ set(J2, get$1(J2) - e4);
2686
+ }
2687
+ U2 = (/* @__PURE__ */ new Date()).getTime();
2688
+ }()
2689
+ ) : startTimer()), () => clearTimeout(get$1(Y2))), {
2690
+ subscribe: e3
2691
+ })), "$effect", i2);
2692
+ }), legacy_pre_effect(() => $effect(), () => {
2693
+ $effect();
2694
+ }), legacy_pre_effect(() => deep_read_state(k2()), () => {
2695
+ k2().delete && deleteToast();
2696
+ }), legacy_pre_effect_reset(), init(true);
2697
+ var ee2 = Le();
2698
+ set_attribute(ee2, "tabindex", 0);
2699
+ var te2 = child(ee2), consequent = (e3) => {
2700
+ var t3 = Ee();
2701
+ template_effect((e4) => {
2702
+ set_attribute(t3, "data-disabled", get$1(g2)), set_class(t3, 1, clsx(e4));
2703
+ }, [() => {
2704
+ var _a, _b, _c;
2705
+ return cn((_a = z2()) == null ? void 0 : _a.closeButton, (_c = (_b = k2()) == null ? void 0 : _b.classes) == null ? void 0 : _c.closeButton);
2706
+ }], derived_safe_equal), event("click", t3, function(...e4) {
2707
+ var _a;
2708
+ (_a = get$1(g2) ? void 0 : () => {
2709
+ var _a2, _b;
2710
+ deleteToast(), (_b = (_a2 = k2()).onDismiss) == null ? void 0 : _b.call(_a2, k2());
2711
+ }) == null ? void 0 : _a.apply(this, e4);
2712
+ }), append(e3, t3);
2713
+ };
2714
+ if_block(te2, (e3) => {
2715
+ P2() && !k2().component && e3(consequent);
2716
+ });
2717
+ var ne2 = sibling(te2, 2), consequent_1 = (e3) => {
2718
+ var t3 = comment();
2719
+ component(first_child(t3), () => k2().component, (e4, t4) => {
2720
+ t4(e4, spread_props(() => k2().componentProps, {
2721
+ $$events: {
2722
+ closeToast: deleteToast
2723
+ }
2724
+ }));
2725
+ }), append(e3, t3);
2726
+ }, alternate_6 = (e3) => {
2727
+ var n3 = Ae(), i3 = first_child(n3), consequent_8 = (e4) => {
2728
+ var n4 = je(), i4 = child(n4), consequent_2 = (e5) => {
2729
+ var n5 = comment();
2730
+ slot(first_child(n5), t2, "loading-icon", {}, null), append(e5, n5);
2731
+ };
2732
+ if_block(i4, (e5) => {
2733
+ !k2().promise && "loading" !== get$1(u2) || k2().icon || e5(consequent_2);
2734
+ });
2735
+ var o4 = sibling(i4, 2), consequent_3 = (e5) => {
2736
+ var t3 = comment();
2737
+ component(first_child(t3), () => k2().icon, (e6, t4) => {
2738
+ t4(e6, {});
2739
+ }), append(e5, t3);
2740
+ }, alternate_3 = (e5) => {
2741
+ var n5 = comment(), i5 = first_child(n5), consequent_4 = (e6) => {
2742
+ var n6 = comment();
2743
+ slot(first_child(n6), t2, "success-icon", {}, null), append(e6, n6);
2744
+ }, alternate_2 = (e6) => {
2745
+ var n6 = comment(), i6 = first_child(n6), consequent_5 = (e7) => {
2746
+ var n7 = comment();
2747
+ slot(first_child(n7), t2, "error-icon", {}, null), append(e7, n7);
2748
+ }, alternate_1 = (e7) => {
2749
+ var n7 = comment(), i7 = first_child(n7), consequent_6 = (e8) => {
2750
+ var n8 = comment();
2751
+ slot(first_child(n8), t2, "warning-icon", {}, null), append(e8, n8);
2752
+ }, alternate = (e8) => {
2753
+ var n8 = comment(), i8 = first_child(n8), consequent_7 = (e9) => {
2754
+ var n9 = comment();
2755
+ slot(first_child(n9), t2, "info-icon", {}, null), append(e9, n9);
2756
+ };
2757
+ if_block(i8, (e9) => {
2758
+ "info" === get$1(u2) && e9(consequent_7);
2759
+ }, true), append(e8, n8);
2760
+ };
2761
+ if_block(i7, (e8) => {
2762
+ "warning" === get$1(u2) ? e8(consequent_6) : e8(alternate, false);
2763
+ }, true), append(e7, n7);
2764
+ };
2765
+ if_block(i6, (e7) => {
2766
+ "error" === get$1(u2) ? e7(consequent_5) : e7(alternate_1, false);
2767
+ }, true), append(e6, n6);
2768
+ };
2769
+ if_block(i5, (e6) => {
2770
+ "success" === get$1(u2) ? e6(consequent_4) : e6(alternate_2, false);
2771
+ }, true), append(e5, n5);
2772
+ };
2773
+ if_block(o4, (e5) => {
2774
+ k2().icon ? e5(consequent_3) : e5(alternate_3, false);
2775
+ }), append(e4, n4);
2776
+ };
2777
+ if_block(i3, (e4) => {
2778
+ ("default" !== get$1(u2) || k2().icon || k2().promise) && e4(consequent_8);
2779
+ });
2780
+ var o3 = sibling(i3, 2), s3 = child(o3), consequent_10 = (e4) => {
2781
+ var t3 = Ne(), n4 = child(t3), consequent_9 = (e5) => {
2782
+ var t4 = comment();
2783
+ component(first_child(t4), () => k2().title, (e6, t5) => {
2784
+ t5(e6, spread_props(() => k2().componentProps));
2785
+ }), append(e5, t4);
2786
+ }, alternate_4 = (e5) => {
2787
+ var t4 = text();
2788
+ template_effect(() => set_text(t4, k2().title)), append(e5, t4);
2789
+ };
2790
+ if_block(n4, (e5) => {
2791
+ "string" != typeof k2().title ? e5(consequent_9) : e5(alternate_4, false);
2792
+ }), template_effect((e5) => set_class(t3, 1, clsx(e5)), [() => {
2793
+ var _a, _b, _c;
2794
+ return cn((_a = z2()) == null ? void 0 : _a.title, (_c = (_b = k2()) == null ? void 0 : _b.classes) == null ? void 0 : _c.title);
2795
+ }], derived_safe_equal), append(e4, t3);
2796
+ };
2797
+ if_block(s3, (e4) => {
2798
+ k2().title && e4(consequent_10);
2799
+ });
2800
+ var a3 = sibling(s3, 2), consequent_12 = (e4) => {
2801
+ var t3 = Be(), n4 = child(t3), consequent_11 = (e5) => {
2802
+ var t4 = comment();
2803
+ component(first_child(t4), () => k2().description, (e6, t5) => {
2804
+ t5(e6, spread_props(() => k2().componentProps));
2805
+ }), append(e5, t4);
2806
+ }, alternate_5 = (e5) => {
2807
+ var t4 = text();
2808
+ template_effect(() => set_text(t4, k2().description)), append(e5, t4);
2809
+ };
2810
+ if_block(n4, (e5) => {
2811
+ "string" != typeof k2().description ? e5(consequent_11) : e5(alternate_5, false);
2812
+ }), template_effect((e5) => set_class(t3, 1, clsx(e5)), [() => {
2813
+ var _a, _b;
2814
+ return cn(B2(), get$1(f2), (_a = z2()) == null ? void 0 : _a.description, (_b = k2().classes) == null ? void 0 : _b.description);
2815
+ }], derived_safe_equal), append(e4, t3);
2816
+ };
2817
+ if_block(a3, (e4) => {
2818
+ k2().description && e4(consequent_12);
2819
+ });
2820
+ var l3 = sibling(o3, 2), consequent_13 = (e4) => {
2821
+ var t3 = ze(), n4 = child(t3);
2822
+ template_effect((e5) => {
2823
+ set_attribute(t3, "style", E2()), set_class(t3, 1, clsx(e5)), set_text(n4, k2().cancel.label);
2824
+ }, [() => {
2825
+ var _a, _b, _c;
2826
+ return cn((_a = z2()) == null ? void 0 : _a.cancelButton, (_c = (_b = k2()) == null ? void 0 : _b.classes) == null ? void 0 : _c.cancelButton);
2827
+ }], derived_safe_equal), event("click", t3, () => {
2828
+ var _a;
2829
+ deleteToast(), ((_a = k2().cancel) == null ? void 0 : _a.onClick) && k2().cancel.onClick();
2830
+ }), append(e4, t3);
2831
+ };
2832
+ if_block(l3, (e4) => {
2833
+ k2().cancel && e4(consequent_13);
2834
+ });
2835
+ var c3 = sibling(l3, 2), consequent_14 = (e4) => {
2836
+ var t3 = De(), n4 = child(t3);
2837
+ template_effect((e5) => {
2838
+ set_attribute(t3, "style", j2()), set_class(t3, 1, clsx(e5)), set_text(n4, k2().action.label);
2839
+ }, [() => {
2840
+ var _a, _b, _c;
2841
+ return cn((_a = z2()) == null ? void 0 : _a.actionButton, (_c = (_b = k2()) == null ? void 0 : _b.classes) == null ? void 0 : _c.actionButton);
2842
+ }], derived_safe_equal), event("click", t3, (e5) => {
2843
+ var _a;
2844
+ (_a = k2().action) == null ? void 0 : _a.onClick(e5), e5.defaultPrevented || deleteToast();
2845
+ }), append(e4, t3);
2846
+ };
2847
+ if_block(c3, (e4) => {
2848
+ k2().action && e4(consequent_14);
2849
+ }), append(e3, n3);
2850
+ };
2851
+ if_block(ne2, (e3) => {
2852
+ k2().component ? e3(consequent_1) : e3(alternate_6, false);
2853
+ }), bind_this(ee2, (e3) => set(R2, e3), () => get$1(R2)), template_effect((e3, t3, o3) => {
2854
+ var _a;
2855
+ set_attribute(ee2, "aria-live", k2().important ? "assertive" : "polite"), set_class(ee2, 1, clsx(e3)), set_attribute(ee2, "data-styled", !(k2().component || ((_a = k2()) == null ? void 0 : _a.unstyled) || D2())), set_attribute(ee2, "data-mounted", get$1(A2)), set_attribute(ee2, "data-promise", t3), set_attribute(ee2, "data-removed", get$1(L2)), set_attribute(ee2, "data-visible", get$1(a2)), set_attribute(ee2, "data-y-position", get$1(_2)[0]), set_attribute(ee2, "data-x-position", get$1(_2)[1]), set_attribute(ee2, "data-index", C2()), set_attribute(ee2, "data-front", get$1(s2)), set_attribute(ee2, "data-swiping", get$1(W2)), set_attribute(ee2, "data-type", get$1(u2)), set_attribute(ee2, "data-invert", S2()), set_attribute(ee2, "data-swipe-out", get$1(F2)), set_attribute(ee2, "data-expanded", o3), set_attribute(ee2, "style", `${n2.style} ${k2().style}`), set_style(ee2, "--index", C2()), set_style(ee2, "--toasts-before", C2()), set_style(ee2, "--z-index", store_get(b2, "$toasts", i2).length - C2()), set_style(ee2, "--offset", `${get$1(L2) ? get$1(G2) : get$1(V2)}px`), set_style(ee2, "--initial-height", `${get$1(H2)}px`);
2856
+ }, [() => {
2857
+ var _a, _b, _c, _d, _e2, _f;
2858
+ return cn(n2.class, get$1(d2), (_a = z2()) == null ? void 0 : _a.toast, (_c = (_b = k2()) == null ? void 0 : _b.classes) == null ? void 0 : _c.toast, (_d = z2()) == null ? void 0 : _d[get$1(u2)], (_f = (_e2 = k2()) == null ? void 0 : _e2.classes) == null ? void 0 : _f[get$1(u2)]);
2859
+ }, () => Boolean(k2().promise), () => Boolean(M2() || I2() && get$1(A2))], derived_safe_equal), event("pointerdown", ee2, function onPointerDown(e3) {
2860
+ if (get$1(g2)) return;
2861
+ set(G2, get$1(V2));
2862
+ const t3 = e3.target;
2863
+ t3.setPointerCapture(e3.pointerId), "BUTTON" !== t3.tagName && (set(W2, true), Z2 = {
2864
+ x: e3.clientX,
2865
+ y: e3.clientY
2866
+ });
2867
+ }), event("pointerup", ee2, function onPointerUp() {
2868
+ var _a, _b, _c;
2869
+ if (get$1(F2)) return;
2870
+ Z2 = null;
2871
+ const e3 = Number(((_a = get$1(R2)) == null ? void 0 : _a.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0);
2872
+ if (Math.abs(e3) >= 20) return set(G2, get$1(V2)), (_c = (_b = k2()).onDismiss) == null ? void 0 : _c.call(_b, k2()), deleteToast(), void set(F2, true);
2873
+ get$1(R2).style.setProperty("--swipe-amount", "0px"), set(W2, false);
2874
+ }), event("pointermove", ee2, function onPointerMove(e3) {
2875
+ if (!Z2) return;
2876
+ const t3 = e3.clientY - Z2.y, n3 = e3.clientX - Z2.x, i3 = ("top" === get$1(_2)[0] ? Math.min : Math.max)(0, t3), o3 = "touch" === e3.pointerType ? 10 : 2;
2877
+ Math.abs(i3) > o3 ? get$1(R2).style.setProperty("--swipe-amount", `${t3}px`) : Math.abs(n3) > o3 && // User is swiping in wrong direction so we disable swipe gesture
2878
+ // for the current pointer down interaction
2879
+ (Z2 = null);
2880
+ }), append(e2, ee2), pop(), o2();
2881
+ }
2882
+ var We = /* @__PURE__ */ template("<ol></ol>"), Fe = /* @__PURE__ */ template('<section class="svelte-1fo5d1m"></section>');
2883
+ function Toaster(e2, t2) {
2884
+ const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]), i2 = legacy_rest_props(n2, ["invert", "theme", "position", "hotkey", "containerAriaLabel", "richColors", "expand", "duration", "visibleToasts", "closeButton", "toastOptions", "offset", "dir"]);
2885
+ push(t2, false);
2886
+ const [o2, s2] = setup_stores(), $toasts = () => store_get(k2, "$toasts", o2), a2 = mutable_state(), l2 = mutable_state(), c2 = "dark", u2 = "light";
2887
+ function getDocumentDirection() {
2888
+ if ("undefined" == typeof window) return "ltr";
2889
+ if ("undefined" == typeof document) return "ltr";
2890
+ const e3 = document.documentElement.getAttribute("dir");
2891
+ return "auto" !== e3 && e3 ? e3 : window.getComputedStyle(document.documentElement).direction;
2892
+ }
2893
+ let d2 = prop(t2, "invert", 8, false), f2 = prop(t2, "theme", 8, "light"), p2 = prop(t2, "position", 8, "bottom-right"), _2 = prop(t2, "hotkey", 24, () => ["altKey", "KeyT"]), v2 = prop(t2, "containerAriaLabel", 8, "Notifications"), g2 = prop(t2, "richColors", 8, false), h2 = prop(t2, "expand", 8, false), m2 = prop(t2, "duration", 8, 4e3), b2 = prop(t2, "visibleToasts", 8, 3), y2 = prop(t2, "closeButton", 8, false), $2 = prop(t2, "toastOptions", 24, () => ({})), w2 = prop(t2, "offset", 8, null), x2 = prop(t2, "dir", 24, getDocumentDirection);
2894
+ const { toasts: k2, heights: C2, reset: M2 } = Ie;
2895
+ let S2 = mutable_state(false), q2 = mutable_state(false), I2 = mutable_state(function getInitialTheme(e3) {
2896
+ return "system" !== e3 ? e3 : "undefined" != typeof window && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? c2 : u2;
2897
+ }(f2())), P2 = mutable_state(), O2 = null, E2 = false;
2898
+ function handleBlur(e3) {
2899
+ E2 && !e3.currentTarget.contains(e3.relatedTarget) && (E2 = false, O2 && (O2.focus({
2900
+ preventScroll: true
2901
+ }), O2 = null));
2902
+ }
2903
+ function handleFocus(e3) {
2904
+ E2 || (E2 = true, O2 = e3.relatedTarget);
2905
+ }
2906
+ !function onDestroy(e3) {
2907
+ null === T && lifecycle_outside_component(), onMount(() => () => untrack(e3));
2908
+ }(() => {
2909
+ get$1(P2) && O2 && (O2.focus({
2910
+ preventScroll: true
2911
+ }), O2 = null, E2 = false);
2912
+ }), onMount(() => {
2913
+ M2();
2914
+ const handleKeydown = (e3) => {
2915
+ var _a, _b;
2916
+ _2().every((t3) => (
2917
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2918
+ e3[t3] || e3.code === t3
2919
+ )) && (set(S2, true), (_a = get$1(P2)) == null ? void 0 : _a.focus()), "Escape" !== e3.code || document.activeElement !== get$1(P2) && !((_b = get$1(P2)) == null ? void 0 : _b.contains(document.activeElement)) || set(S2, false);
2920
+ };
2921
+ return document.addEventListener("keydown", handleKeydown), () => {
2922
+ document.removeEventListener("keydown", handleKeydown);
2923
+ };
2924
+ }), legacy_pre_effect(() => (deep_read_state(p2()), $toasts()), () => {
2925
+ set(a2, Array.from(new Set([p2(), ...$toasts().filter((e3) => e3.position).map((e3) => e3.position)].filter(Boolean))));
2926
+ }), legacy_pre_effect(() => deep_read_state(_2()), () => {
2927
+ set(l2, _2().join("+").replace(/Key/g, "").replace(/Digit/g, ""));
2928
+ }), legacy_pre_effect(() => $toasts(), () => {
2929
+ $toasts().length <= 1 && set(S2, false);
2930
+ }), legacy_pre_effect(() => $toasts(), () => {
2931
+ const e3 = $toasts().filter((e4) => e4.dismiss && !e4.delete);
2932
+ if (e3.length > 0) {
2933
+ const t3 = $toasts().map((t4) => e3.find((e4) => e4.id === t4.id) ? {
2934
+ ...t4,
2935
+ delete: true
2936
+ } : t4);
2937
+ k2.set(t3);
2938
+ }
2939
+ }), legacy_pre_effect(() => deep_read_state(f2()), () => {
2940
+ if ("system" !== f2() && set(I2, f2()), "undefined" != typeof window) {
2941
+ "system" === f2() && // check if current preference is dark
2942
+ (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? (
2943
+ // it's currently dark
2944
+ set(I2, c2)
2945
+ ) : (
2946
+ // it's not dark
2947
+ set(I2, u2)
2948
+ ));
2949
+ const e3 = window.matchMedia("(prefers-color-scheme: dark)"), changeHandler = ({ matches: e4 }) => {
2950
+ set(I2, e4 ? c2 : u2);
2951
+ };
2952
+ "addEventListener" in e3 ? e3.addEventListener("change", changeHandler) : (
2953
+ // @ts-expect-error deprecated API
2954
+ e3.addListener(changeHandler)
2955
+ );
2956
+ }
2957
+ }), legacy_pre_effect_reset(), init();
2958
+ var j2 = comment(), N2 = first_child(j2), consequent = (e3) => {
2959
+ var s3 = Fe();
2960
+ set_attribute(s3, "tabindex", -1), each(s3, 5, () => get$1(a2), index, (e4, s4, a3, l3) => {
2961
+ var c3 = We();
2962
+ let u3;
2963
+ each(c3, 7, () => $toasts().filter((e5) => !e5.position && 0 === a3 || e5.position === get$1(s4)), (e5) => e5.id, (e5, n3, i3, o3) => {
2964
+ const a4 = /* @__PURE__ */ derived_safe_equal(() => {
2965
+ var _a;
2966
+ return ((_a = $2()) == null ? void 0 : _a.actionButtonStyle) || "";
2967
+ }), l4 = /* @__PURE__ */ derived_safe_equal(() => {
2968
+ var _a;
2969
+ return ((_a = $2()) == null ? void 0 : _a.cancelButtonStyle) || "";
2970
+ }), c4 = /* @__PURE__ */ derived_safe_equal(() => {
2971
+ var _a;
2972
+ return ((_a = $2()) == null ? void 0 : _a.class) || "";
2973
+ }), u4 = /* @__PURE__ */ derived_safe_equal(() => {
2974
+ var _a;
2975
+ return ((_a = $2()) == null ? void 0 : _a.descriptionClass) || "";
2976
+ }), f3 = /* @__PURE__ */ derived_safe_equal(() => $2().classes || {}), p3 = /* @__PURE__ */ derived_safe_equal(() => {
2977
+ var _a;
2978
+ return ((_a = $2()) == null ? void 0 : _a.duration) ?? m2();
2979
+ }), _3 = /* @__PURE__ */ derived_safe_equal(() => $2().unstyled || false);
2980
+ Toast(e5, {
2981
+ get index() {
2982
+ return get$1(i3);
2983
+ },
2984
+ get toast() {
2985
+ return get$1(n3);
2986
+ },
2987
+ get invert() {
2988
+ return d2();
2989
+ },
2990
+ get visibleToasts() {
2991
+ return b2();
2992
+ },
2993
+ get closeButton() {
2994
+ return y2();
2995
+ },
2996
+ get interacting() {
2997
+ return get$1(q2);
2998
+ },
2999
+ get position() {
3000
+ return get$1(s4);
3001
+ },
3002
+ get expandByDefault() {
3003
+ return h2();
3004
+ },
3005
+ get expanded() {
3006
+ return get$1(S2);
3007
+ },
3008
+ get actionButtonStyle() {
3009
+ return get$1(a4);
3010
+ },
3011
+ get cancelButtonStyle() {
3012
+ return get$1(l4);
3013
+ },
3014
+ get class() {
3015
+ return get$1(c4);
3016
+ },
3017
+ get descriptionClass() {
3018
+ return get$1(u4);
3019
+ },
3020
+ get classes() {
3021
+ return get$1(f3);
3022
+ },
3023
+ get duration() {
3024
+ return get$1(p3);
3025
+ },
3026
+ get unstyled() {
3027
+ return get$1(_3);
3028
+ },
3029
+ $$slots: {
3030
+ "loading-icon": (e6, i4) => {
3031
+ var o4 = comment();
3032
+ slot(first_child(o4), t2, "loading-icon", {}, (e7) => {
3033
+ const t3 = /* @__PURE__ */ derived_safe_equal(() => "loading" === get$1(n3).type);
3034
+ Loader(e7, {
3035
+ get visible() {
3036
+ return get$1(t3);
3037
+ }
3038
+ });
3039
+ }), append(e6, o4);
3040
+ },
3041
+ "success-icon": (e6, n4) => {
3042
+ var i4 = comment();
3043
+ slot(first_child(i4), t2, "success-icon", {}, (e7) => {
3044
+ Icon(e7, {
3045
+ type: "success"
3046
+ });
3047
+ }), append(e6, i4);
3048
+ },
3049
+ "error-icon": (e6, n4) => {
3050
+ var i4 = comment();
3051
+ slot(first_child(i4), t2, "error-icon", {}, (e7) => {
3052
+ Icon(e7, {
3053
+ type: "error"
3054
+ });
3055
+ }), append(e6, i4);
3056
+ },
3057
+ "warning-icon": (e6, n4) => {
3058
+ var i4 = comment();
3059
+ slot(first_child(i4), t2, "warning-icon", {}, (e7) => {
3060
+ Icon(e7, {
3061
+ type: "warning"
3062
+ });
3063
+ }), append(e6, i4);
3064
+ },
3065
+ "info-icon": (e6, n4) => {
3066
+ var i4 = comment();
3067
+ slot(first_child(i4), t2, "info-icon", {}, (e7) => {
3068
+ Icon(e7, {
3069
+ type: "info"
3070
+ });
3071
+ }), append(e6, i4);
3072
+ }
3073
+ }
3074
+ });
3075
+ }), bind_this(c3, (e5) => set(P2, e5), () => get$1(P2)), template_effect((e5, t3, s5) => {
3076
+ var _a;
3077
+ u3 = set_attributes(c3, u3, {
3078
+ tabIndex: -1,
3079
+ class: n2.class,
3080
+ "data-sonner-toaster": true,
3081
+ "data-theme": get$1(I2),
3082
+ "data-rich-colors": g2(),
3083
+ dir: e5,
3084
+ "data-y-position": t3,
3085
+ "data-x-position": s5,
3086
+ style: n2.style,
3087
+ ...i2
3088
+ }, "svelte-1fo5d1m"), set_style(c3, "--front-toast-height", `${(_a = store_get(C2, "$heights", o2)[0]) == null ? void 0 : _a.height}px`), set_style(c3, "--offset", "number" == typeof w2() ? `${w2()}px` : w2() || "32px"), set_style(c3, "--width", "356px"), set_style(c3, "--gap", "14px"), c3.dir = c3.dir;
3089
+ }, [() => "auto" === x2() ? getDocumentDirection() : x2(), () => get$1(s4).split("-")[0], () => get$1(s4).split("-")[1]], derived_safe_equal), event("blur", c3, handleBlur), event("focus", c3, handleFocus), event("mouseenter", c3, () => set(S2, true)), event("mousemove", c3, () => set(S2, true)), event("mouseleave", c3, () => {
3090
+ get$1(q2) || set(S2, false);
3091
+ }), event("pointerdown", c3, () => set(q2, true)), event("pointerup", c3, () => set(q2, false)), append(e4, c3);
3092
+ }), template_effect(() => set_attribute(s3, "aria-label", `${v2()} ${get$1(l2)}`)), append(e3, s3);
3093
+ };
3094
+ if_block(N2, (e3) => {
3095
+ $toasts().length > 0 && e3(consequent);
3096
+ }), append(e2, j2), pop(), s2();
3097
+ }
3098
+ const Ge = writable(false), He = writable("https://sdk.playlight.dev");
3099
+ function handleClick(e2, t2) {
3100
+ var _a;
3101
+ (_a = t2.onClick) == null ? void 0 : _a.call(t2, t2.game.id), window.open("https://" + t2.game.domain, "_blank", "noopener");
3102
+ }
3103
+ var Re = /* @__PURE__ */ template('<div><p class="uppercase">New</p></div>'), Ve = /* @__PURE__ */ template('<video playsinline="" loop preload="auto"></video>', 2), Ke = /* @__PURE__ */ template('<div id="overlay" class="bg-background/75 text-foreground absolute right-0 bottom-0 left-0 z-11 flex max-h-1/3 flex-col overflow-hidden backdrop-blur-xl"><div class="hide-scrollbar h-full w-full overflow-y-auto p-3 svelte-styo3v"><h3 class="mb-2 truncate text-center text-lg font-bold"> </h3> <p class="text-muted-foreground mb-4 text-center text-sm text-balance"> </p></div> <div class="fade-mask bg-background/75 pointer-events-none absolute right-0 bottom-0 left-0 h-8 svelte-styo3v"></div></div>'), Ue = /* @__PURE__ */ template('<div role="button" tabindex="0"><!> <!> <img alt="cover" loading="eager"> <!> <img alt="game logo" loading="eager"></div>');
3104
+ function GameCard(e2, t2) {
3105
+ push(t2, true);
3106
+ const [n2, i2] = setup_stores();
3107
+ let o2 = state(false), s2 = state(void 0), a2 = state(false), l2 = state(false), c2 = state(false), u2 = state(false);
3108
+ function handleMouseEnter() {
3109
+ get$1(o2) || function playSound(e3, t3 = 1) {
3110
+ try {
3111
+ const n3 = new Audio(e3);
3112
+ n3.volume = t3, n3.play();
3113
+ } catch (e4) {
3114
+ console.error("Error playing sound:", e4);
3115
+ }
3116
+ }(store_get(He, "$projectUrl", n2) + "/static/sounds/hover-selection.ogg", 0.25), // Original hover logic
3117
+ set(o2, true), get$1(s2) && t2.game.cover_video_url && (set(u2, true), // Flag that we're attempting to load the video
3118
+ get$1(s2).play().catch((e3) => console.error("Video play error:", e3)));
3119
+ }
3120
+ function handleMouseLeave() {
3121
+ set(o2, false), // Only pause if it's already loaded and playing
3122
+ get$1(s2) && get$1(a2) && get$1(s2).pause();
3123
+ }
3124
+ var d2 = Ue();
3125
+ d2.__touchstart = handleMouseEnter, d2.__touchend = handleMouseLeave, d2.__click = [handleClick, t2];
3126
+ var f2 = child(d2), consequent = (e3) => {
3127
+ var t3 = Re();
3128
+ let n3;
3129
+ template_effect(() => n3 = set_class(t3, 1, "bg-foreground text-background absolute top-4 right-4 z-13 px-2 py-0.5 font-bold transition-opacity", null, n3, {
3130
+ "opacity-0": get$1(o2)
3131
+ })), append(e3, t3);
3132
+ };
3133
+ if_block(f2, (e3) => {
3134
+ var _a;
3135
+ (function isNewGame(e4) {
3136
+ const t3 = /* @__PURE__ */ new Date();
3137
+ return t3.setDate(t3.getDate() - 7), new Date(e4) > t3;
3138
+ })((_a = t2.game) == null ? void 0 : _a.created_at) && e3(consequent);
3139
+ });
3140
+ var p2 = sibling(f2, 2), consequent_1 = (e3) => {
3141
+ var n3 = Ve();
3142
+ let i3;
3143
+ n3.muted = true, bind_this(n3, (e4) => set(s2, e4), () => get$1(s2)), template_effect(() => {
3144
+ set_attribute(n3, "src", t2.game.cover_video_url), i3 = set_class(n3, 1, "absolute top-0 left-0 z-5 h-full w-full object-cover opacity-0", null, i3, {
3145
+ "opacity-100": get$1(o2) && get$1(a2) && t2.game.cover_video_url
3146
+ });
3147
+ }), event("loadeddata", n3, () => {
3148
+ set(a2, true), set(u2, false);
3149
+ }), append(e3, n3);
3150
+ };
3151
+ if_block(p2, (e3) => {
3152
+ t2.game.cover_video_url && e3(consequent_1);
3153
+ });
3154
+ var _2 = sibling(p2, 2);
3155
+ let v2;
3156
+ var g2 = sibling(_2, 2), consequent_2 = (e3) => {
3157
+ var n3 = Ke(), i3 = child(n3), o3 = child(i3), s3 = child(o3), a3 = child(sibling(o3, 2));
3158
+ template_effect(() => {
3159
+ set_text(s3, t2.game.name), set_text(a3, t2.game.description || "No description.");
3160
+ }), transition(3, n3, () => slide), append(e3, n3);
3161
+ };
3162
+ if_block(g2, (e3) => {
3163
+ get$1(o2) && e3(consequent_2);
3164
+ });
3165
+ var h2 = sibling(g2, 2);
3166
+ let m2;
3167
+ template_effect(() => {
3168
+ set_class(d2, 1, `bg-background highlight-border group relative mt-5 mb-[calc(3dvh+1.5vw)] flex aspect-[2/3] h-1/2 max-h-[75vh] min-h-92 cursor-pointer flex-col shadow-xl transition hover:outline-2 hover:brightness-105 lg:h-3/7 ${(get$1(l2) ? "" : "animate-pulse") ?? ""}`, "svelte-styo3v"), set_attribute(_2, "src", t2.game.cover_image_url), v2 = set_class(_2, 1, "absolute top-0 left-0 z-10 h-full w-full object-cover opacity-0 transition svelte-styo3v", null, v2, {
3169
+ "opacity-100": get$1(l2) && (!get$1(o2) || !get$1(a2) || !t2.game.cover_video_url)
3170
+ }), set_attribute(h2, "src", t2.game.logo_url), m2 = set_class(h2, 1, "absolute right-0 -bottom-[18%] left-0 z-12 mx-auto aspect-square w-1/5 rounded-full object-center opacity-0 transition group-hover:outline-2 svelte-styo3v", null, m2, {
3171
+ "opacity-100": get$1(c2)
3172
+ });
3173
+ }), event("mouseenter", d2, handleMouseEnter), event("focus", d2, handleMouseEnter), event("mouseleave", d2, handleMouseLeave), event("blur", d2, handleMouseLeave), event("touchcancel", d2, handleMouseLeave), event("load", _2, () => {
3174
+ set(l2, true);
3175
+ }), event("load", h2, () => {
3176
+ set(c2, true);
3177
+ }), append(e2, d2), pop(), i2();
3178
+ }
3179
+ delegate(["touchstart", "touchend", "click"]);
3180
+ const Ze = new class PlayLightAPI {
3181
+ constructor() {
3182
+ this.baseUrl = "https://api.playlight.dev/platform", this.cachedCategories = null, this.currentGame = null;
3183
+ }
3184
+ async request(e2, t2 = {}) {
3185
+ try {
3186
+ const n2 = `${this.baseUrl}${e2}`, i2 = await fetch(n2, {
3187
+ ...t2,
3188
+ headers: {
3189
+ "Content-Type": "application/json",
3190
+ ...t2.headers
3191
+ }
3192
+ });
3193
+ if (!i2.ok) {
3194
+ let e3;
3195
+ try {
3196
+ e3 = await i2.json();
3197
+ } catch {
3198
+ } finally {
3199
+ if (429 !== i2.status && 404 !== i2.status) throw new Error(`API request failed: ${(e3 == null ? void 0 : e3.error) || (e3 == null ? void 0 : e3.message) || i2.status}`);
3200
+ return 429 === i2.status ? console.warn("Playlight request didn't go through due to rate limiting.") : console.warn("Playlight game not found. This is normal in a test / local environment, but should not appear in production.");
3201
+ }
3202
+ }
3203
+ return await i2.json();
3204
+ } catch (e3) {
3205
+ Oe.error("Error: " + e3), console.error("Playlight API error:", e3);
3206
+ }
3207
+ }
3208
+ // Get all categories
3209
+ async getCategories() {
3210
+ if (this.cachedCategories) return this.cachedCategories;
3211
+ const e2 = await this.request("/categories");
3212
+ return this.cachedCategories = e2, e2;
3213
+ }
3214
+ // Get game suggestions, optionally filtered by category
3215
+ async getSuggestions(e2 = null, t2 = 1, n2) {
3216
+ let i2 = "/suggestions";
3217
+ return e2 && (i2 += "/" + e2), t2 && (i2 += "?page=" + t2), n2 && (i2 += "&without=" + n2), await this.request(i2);
3218
+ }
3219
+ // Get game suggestions, optionally filtered by category
3220
+ async getCurrentGameInfo() {
3221
+ if (this.currentGame) return this.currentGame;
3222
+ let e2 = "/game-by-domain/" + window.location.hostname;
3223
+ return this.currentGame = await this.request(e2), {
3224
+ ...this.currentGame
3225
+ };
3226
+ }
3227
+ // Track discovery overlay open
3228
+ async trackOpen() {
3229
+ const e2 = window.location.hostname;
3230
+ await this.request("/event/open", {
3231
+ method: "POST",
3232
+ body: JSON.stringify({
3233
+ domain: e2
3234
+ })
3235
+ });
3236
+ }
3237
+ // Track game click (pass id of the game that was clicked on)
3238
+ async trackClick(e2) {
3239
+ const t2 = window.location.hostname;
3240
+ await this.request("/event/click", {
3241
+ method: "POST",
3242
+ body: JSON.stringify({
3243
+ sourceDomain: t2,
3244
+ gameId: e2
3245
+ })
3246
+ });
3247
+ }
3248
+ }();
3249
+ function cubicOut(e2) {
3250
+ const t2 = e2 - 1;
3251
+ return t2 * t2 * t2 + 1;
3252
+ }
3253
+ function elasticOut(e2) {
3254
+ return Math.sin(-13 * (e2 + 1) * Math.PI / 2) * Math.pow(2, -10 * e2) + 1;
3255
+ }
3256
+ function flip(e2, { from: t2, to: n2 }, i2 = {}) {
3257
+ var { delay: o2 = 0, duration: s2 = (e3) => 120 * Math.sqrt(e3), easing: a2 = cubicOut } = i2, l2 = getComputedStyle(e2), c2 = "none" === l2.transform ? "" : l2.transform, [u2, d2] = l2.transformOrigin.split(" ").map(parseFloat);
3258
+ u2 /= e2.clientWidth, d2 /= e2.clientHeight;
3259
+ var f2 = (
3260
+ /**
3261
+ * @param {Element} element
3262
+ */
3263
+ function get_zoom(e3) {
3264
+ if ("currentCSSZoom" in e3)
3265
+ return e3.currentCSSZoom;
3266
+ var t3 = e3, n3 = 1;
3267
+ for (; null !== t3; ) n3 *= +getComputedStyle(t3).zoom, t3 = /** @type {Element | null} */
3268
+ t3.parentElement;
3269
+ return n3;
3270
+ }(e2)
3271
+ ), p2 = e2.clientWidth / n2.width / f2, _2 = e2.clientHeight / n2.height / f2, v2 = t2.left + t2.width * u2, g2 = t2.top + t2.height * d2, h2 = n2.left + n2.width * u2, m2 = n2.top + n2.height * d2, b2 = (v2 - h2) * p2, y2 = (g2 - m2) * _2, $2 = t2.width / n2.width, w2 = t2.height / n2.height;
3272
+ return {
3273
+ delay: o2,
3274
+ duration: "function" == typeof s2 ? s2(Math.sqrt(b2 * b2 + y2 * y2)) : s2,
3275
+ easing: a2,
3276
+ css: (e3, t3) => `transform: ${c2} translate(${t3 * b2}px, ${t3 * y2}px) scale(${e3 + t3 * $2}, ${e3 + t3 * w2});`
3277
+ };
3278
+ }
3279
+ var on_click$1 = (e2, t2, n2) => {
3280
+ set(t2, ""), set(n2, !get$1(n2));
3281
+ }, Ye = /* @__PURE__ */ template('<div class="text-muted-foreground animate-pulse p-4 text-center">Loading...</div>'), Je = /* @__PURE__ */ template('<div class="text-muted-foreground p-4 text-center">No categories found.</div>'), on_click_1$1 = (e2, t2, n2, i2) => {
3282
+ t2(n2), set(i2, false);
3283
+ }, Xe = /* @__PURE__ */ template("<button> </button>"), Qe = /* @__PURE__ */ template('<div class="space-y-1 p-1"></div>'), et = /* @__PURE__ */ template('<div class="bg-background/85 fixed left-1/2 z-50 mt-24 w-30 w-full max-w-xs -translate-x-1/2 transform border shadow-lg backdrop-blur"><div class="border-b p-3"><div class="relative"><div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-1"><!></div> <input type="text" placeholder="Search categories..." class="w-full border-0 p-1 pl-10 text-white focus:ring-0 focus:outline-none"></div></div> <div class="max-h-60 overflow-y-auto"><!></div></div>'), tt = /* @__PURE__ */ template('<div class="flex w-full flex-col py-2"><h1 class="mb-0! py-2 text-center text-2xl font-bold text-white drop-shadow-xl lg:text-4xl"><span> </span> <button class="group mx-1 inline-flex cursor-pointer items-center bg-white px-3 py-1 text-black transition hover:rotate-5"><span class="max-w-[40vw] truncate"> </span> <!></button> <span>games?</span></h1> <!></div>');
3284
+ function Navigation(e2, t2) {
3285
+ push(t2, true);
3286
+ let n2, i2 = prop(t2, "categories", 19, () => []), o2 = prop(t2, "selectedCategory", 15), s2 = state(false), a2 = /* @__PURE__ */ derived(() => o2() || (i2().length > 0 ? i2()[0] : "...")), l2 = state(""), c2 = state(void 0), u2 = /* @__PURE__ */ derived(() => get$1(l2) ? i2().filter((e3) => e3.toLowerCase().includes(get$1(l2).toLowerCase())) : i2());
3287
+ const d2 = ["Looking for", "Interested in", "Searching for", "Fancy some", "What about these"];
3288
+ let f2, p2 = state(proxy(d2[0]));
3289
+ onMount(function updateRandomPhrase() {
3290
+ let e3;
3291
+ for (e3 = Math.floor(Math.random() * (d2 == null ? void 0 : d2.length)); e3 == f2; ) e3 = Math.floor(Math.random() * (d2 == null ? void 0 : d2.length));
3292
+ set(p2, proxy(d2[e3])), f2 = e3;
3293
+ });
3294
+ var _2 = tt();
3295
+ event("click", I, function handleClickOutside(e3) {
3296
+ get$1(c2) && !get$1(c2).contains(e3.target) && n2 && !n2.contains(e3.target) && set(s2, false);
3297
+ });
3298
+ var v2 = child(_2), g2 = child(v2), h2 = child(g2), m2 = sibling(g2, 2);
3299
+ m2.__click = [on_click$1, l2, s2];
3300
+ var b2 = child(m2), y2 = child(b2), $2 = sibling(b2, 2);
3301
+ const w2 = /* @__PURE__ */ derived(() => get$1(s2) ? "rotate-180 transform" : "");
3302
+ !function Chevron_down(e3, t3) {
3303
+ const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
3304
+ Icon$1(e3, spread_props({
3305
+ name: "chevron-down"
3306
+ }, () => n3, {
3307
+ iconNode: [["path", {
3308
+ d: "m6 9 6 6 6-6"
3309
+ }]],
3310
+ children: (e4, n4) => {
3311
+ var i3 = comment();
3312
+ slot(first_child(i3), t3, "default", {}, null), append(e4, i3);
3313
+ },
3314
+ $$slots: {
3315
+ default: true
3316
+ }
3317
+ }));
3318
+ }($2, {
3319
+ size: 25,
3320
+ strokeWidth: 3,
3321
+ get class() {
3322
+ return `mt-1 ml-1 text-black ${get$1(w2) ?? ""} transition-transform duration-200`;
3323
+ }
3324
+ }), bind_this(m2, (e3) => n2 = e3, () => n2);
3325
+ var x2 = sibling(v2, 2), consequent_2 = (e3) => {
3326
+ var t3 = et(), n3 = child(t3), a3 = child(n3), d3 = child(a3);
3327
+ !function Search(e4, t4) {
3328
+ const n4 = legacy_rest_props(t4, ["children", "$$slots", "$$events", "$$legacy"]);
3329
+ Icon$1(e4, spread_props({
3330
+ name: "search"
3331
+ }, () => n4, {
3332
+ iconNode: [["circle", {
3333
+ cx: "11",
3334
+ cy: "11",
3335
+ r: "8"
3336
+ }], ["path", {
3337
+ d: "m21 21-4.3-4.3"
3338
+ }]],
3339
+ children: (e5, n5) => {
3340
+ var i3 = comment();
3341
+ slot(first_child(i3), t4, "default", {}, null), append(e5, i3);
3342
+ },
3343
+ $$slots: {
3344
+ default: true
3345
+ }
3346
+ }));
3347
+ }(child(d3), {
3348
+ size: 18,
3349
+ class: "text-muted-foreground"
3350
+ });
3351
+ var f3 = sibling(d3, 2), p3 = child(sibling(n3, 2)), consequent = (e4) => {
3352
+ append(e4, Ye());
3353
+ }, alternate_1 = (e4) => {
3354
+ var t4 = comment(), n4 = first_child(t4), consequent_1 = (e5) => {
3355
+ append(e5, Je());
3356
+ }, alternate = (e5) => {
3357
+ var t5 = Qe();
3358
+ each(t5, 28, () => get$1(u2), (e6) => e6, (e6, t6) => {
3359
+ var n5 = Xe();
3360
+ n5.__click = [on_click_1$1, o2, t6, s2];
3361
+ var i3 = child(n5);
3362
+ template_effect(() => {
3363
+ set_class(n5, 1, `w-full cursor-pointer px-4 py-2 text-left transition-colors ${(o2() != t6 ? "hover:bg-muted-foreground/20" : "") ?? ""} ${(o2() == t6 ? "bg-white text-black" : "text-white") ?? ""}`), set_text(i3, t6);
3364
+ }), function animation(e7, t7, n6) {
3365
+ var i4, o3, s3, a4 = (
3366
+ /** @type {EachItem} */
3367
+ ce
3368
+ ), l3 = null;
3369
+ a4.a ?? (a4.a = {
3370
+ element: e7,
3371
+ measure() {
3372
+ i4 = this.element.getBoundingClientRect();
3373
+ },
3374
+ apply() {
3375
+ if (s3 == null ? void 0 : s3.abort(), o3 = this.element.getBoundingClientRect(), i4.left !== o3.left || i4.right !== o3.right || i4.top !== o3.top || i4.bottom !== o3.bottom) {
3376
+ const e8 = t7()(this.element, {
3377
+ from: i4,
3378
+ to: o3
3379
+ }, n6 == null ? void 0 : n6());
3380
+ s3 = animate(this.element, e8, void 0, 1, () => {
3381
+ s3 == null ? void 0 : s3.abort(), s3 = void 0;
3382
+ });
3383
+ }
3384
+ },
3385
+ fix() {
3386
+ if (!e7.getAnimations().length) {
3387
+ var { position: t8, width: n7, height: o4 } = getComputedStyle(e7);
3388
+ if ("absolute" !== t8 && "fixed" !== t8) {
3389
+ var s4 = (
3390
+ /** @type {HTMLElement | SVGElement} */
3391
+ e7.style
3392
+ );
3393
+ l3 = {
3394
+ position: s4.position,
3395
+ width: s4.width,
3396
+ height: s4.height,
3397
+ transform: s4.transform
3398
+ }, s4.position = "absolute", s4.width = n7, s4.height = o4;
3399
+ var a5 = e7.getBoundingClientRect();
3400
+ if (i4.left !== a5.left || i4.top !== a5.top) {
3401
+ var c3 = `translate(${i4.left - a5.left}px, ${i4.top - a5.top}px)`;
3402
+ s4.transform = s4.transform ? `${s4.transform} ${c3}` : c3;
3403
+ }
3404
+ }
3405
+ }
3406
+ },
3407
+ unfix() {
3408
+ if (l3) {
3409
+ var t8 = (
3410
+ /** @type {HTMLElement | SVGElement} */
3411
+ e7.style
3412
+ );
3413
+ t8.position = l3.position, t8.width = l3.width, t8.height = l3.height, t8.transform = l3.transform;
3414
+ }
3415
+ }
3416
+ }), // in the case of a `<svelte:element>`, it's possible for `$.animation(...)` to be called
3417
+ // when an animation manager already exists, if the tag changes. in that case, we need to
3418
+ // swap out the element rather than creating a new manager, in case it happened at the same
3419
+ // moment as a reconciliation
3420
+ a4.a.element = e7;
3421
+ }(n5, () => flip, () => ({
3422
+ duration: 150
3423
+ })), append(e6, n5);
3424
+ }), append(e5, t5);
3425
+ };
3426
+ if_block(n4, (e5) => {
3427
+ 0 === get$1(u2).length ? e5(consequent_1) : e5(alternate, false);
3428
+ }, true), append(e4, t4);
3429
+ };
3430
+ if_block(p3, (e4) => {
3431
+ 0 === i2().length ? e4(consequent) : e4(alternate_1, false);
3432
+ }), bind_this(t3, (e4) => set(c2, e4), () => get$1(c2)), function bind_value(e4, t4, n4 = t4) {
3433
+ var i3 = is_runes();
3434
+ listen_to_event_and_reset_event(e4, "input", (o3) => {
3435
+ var s3 = o3 ? e4.defaultValue : e4.value;
3436
+ if (s3 = is_numberlike_input(e4) ? to_number(s3) : s3, n4(s3), i3 && s3 !== (s3 = t4())) {
3437
+ var a4 = e4.selectionStart, l3 = e4.selectionEnd;
3438
+ e4.value = s3 ?? "", // Restore selection
3439
+ null !== l3 && (e4.selectionStart = a4, e4.selectionEnd = Math.min(l3, e4.value.length));
3440
+ }
3441
+ }), // If we are hydrating and the value has since changed,
3442
+ // then use the updated value from the input instead.
3443
+ // If defaultValue is set, then value == defaultValue
3444
+ // TODO Svelte 6: remove input.value check and set to empty string?
3445
+ null == untrack(t4) && e4.value && n4(is_numberlike_input(e4) ? to_number(e4.value) : e4.value), render_effect(() => {
3446
+ var n5 = t4();
3447
+ is_numberlike_input(e4) && n5 === to_number(e4.value) || ("date" !== e4.type || n5 || e4.value) && n5 !== e4.value && // @ts-expect-error the value is coerced on assignment
3448
+ (e4.value = n5 ?? "");
3449
+ });
3450
+ }(f3, () => get$1(l2), (e4) => set(l2, e4)), transition(3, t3, () => fly, () => ({
3451
+ y: -5,
3452
+ duration: 250
3453
+ })), append(e3, t3);
3454
+ };
3455
+ if_block(x2, (e3) => {
3456
+ get$1(s2) && e3(consequent_2);
3457
+ }), template_effect(() => {
3458
+ set_text(h2, get$1(p2)), set_text(y2, get$1(a2));
3459
+ }), transition(3, _2, () => scale, () => ({
3460
+ duration: 600,
3461
+ delay: 50,
3462
+ easing: elasticOut,
3463
+ start: 0.95
3464
+ })), append(e2, _2), pop();
3465
+ }
3466
+ delegate(["click"]);
3467
+ var on_click = (e2, t2) => {
3468
+ localStorage.getItem("playlight_exit_intent_disabled_by_user") ? localStorage.removeItem("playlight_exit_intent_disabled_by_user") : localStorage.setItem("playlight_exit_intent_disabled_by_user", true), set(t2, !get$1(t2));
3469
+ }, on_click_1 = (e2, t2) => store_set(Ge, false), nt = /* @__PURE__ */ template('<div class="flex h-4/5 items-center justify-center gap-4"><!></div>'), rt = /* @__PURE__ */ template('<div class="text-muted-foreground flex h-4/5 items-center justify-center gap-4"><p>No games found that match the filter.</p></div>'), it = /* @__PURE__ */ template('<div class="mx-auto flex h-full flex-wrap content-start justify-center gap-10 lg:max-w-4/5"><!> <div class="flex h-10 w-full justify-center"><!></div></div>'), ot = /* @__PURE__ */ template('<div class="bg-background/75 fixed inset-0 top-0 right-0 bottom-0 left-0 z-99999 flex flex-col justify-center text-white backdrop-blur-md"><div class="ml-2 flex items-center justify-between p-4"><a href="https://playlight.dev" target="_blank"><img alt="logo" class="w-50"></a> <div class="mt-4 mr-2 flex items-center justify-evenly gap-8 overflow-hidden md:mr-4"><button class="cursor-pointer truncate text-sm text-nowrap text-white opacity-50 transition hover:opacity-25 max-md:hidden"><p class="bg-background/50 p-1 px-2"> </p></button> <button class="cursor-pointer text-white transition hover:opacity-50" aria-label="Close"><!></button></div></div> <div class="mx-auto p-2 px-5"><!></div> <div class="mask-fade no-scrollbar relative h-full w-full overflow-y-auto p-4 svelte-12skmk8"><!></div> <div class="fixed right-0 bottom-0 flex items-center justify-between p-4"><a href="https://playlight.dev" target="_blank" class="text-muted-foreground flex items-center gap-1 text-sm transition hover:text-white">Game Developer? Join Playlight <!></a></div></div>');
3470
+ function DiscoveryOverlay(e2, t2) {
3471
+ push(t2, true);
3472
+ const [n2, i2] = setup_stores();
3473
+ let o2, s2 = state(void 0), a2 = state(true), l2 = state(false), c2 = state(void 0), u2 = state(proxy([])), d2 = state(proxy([])), f2 = state(true), p2 = state(1), _2 = state(true), v2 = state(void 0), g2 = state(false);
3474
+ async function fetchGames() {
3475
+ if (!(get$1(a2) && get$1(p2) > 1 || get$1(l2))) try {
3476
+ 1 === get$1(p2) ? set(a2, true) : set(l2, true);
3477
+ const e3 = get$1(g2) ? null : get$1(s2), t3 = await Ze.getSuggestions(e3, get$1(p2), window.location.hostname), n3 = (t3 == null ? void 0 : t3.games) || [], i3 = n3.filter((e4) => !get$1(u2).some((t4) => t4.id === e4.id));
3478
+ set(u2, proxy([...get$1(u2), ...i3])), n3.length < 10 ? !get$1(g2) && get$1(s2) ? (
3479
+ // Try with all games
3480
+ (set(g2, true), set(p2, 1), setTimeout(() => fetchGames(), 100))
3481
+ ) : set(_2, false) : set(p2, get$1(p2) + 1);
3482
+ } catch (e3) {
3483
+ console.error(e3), Oe.error("Failed to load games: " + e3);
3484
+ } finally {
3485
+ set(a2, false), set(l2, false), // For Chrome: manually check if element is still in view and should trigger another load
3486
+ get$1(_2) && get$1(v2) && setTimeout(() => {
3487
+ const e3 = get$1(v2).getBoundingClientRect();
3488
+ !(e3.top >= -200 && // Include rootMargin
3489
+ e3.left >= 0 && e3.bottom <= window.innerHeight + 200 && // Include rootMargin
3490
+ e3.right <= window.innerWidth) || get$1(a2) || get$1(l2) || fetchGames();
3491
+ }, 150);
3492
+ }
3493
+ }
3494
+ onMount(() => (set(f2, !Boolean(localStorage.getItem("playlight_exit_intent_disabled_by_user"))), // Setup scroll observer
3495
+ o2 = new IntersectionObserver((e3) => {
3496
+ e3[0].isIntersecting && get$1(_2) && !get$1(a2) && !get$1(l2) && fetchGames();
3497
+ }, {
3498
+ rootMargin: "200px"
3499
+ }), () => o2 == null ? void 0 : o2.disconnect())), onMount(async () => {
3500
+ const e3 = await Ze.getCurrentGameInfo();
3501
+ set(c2, proxy(e3 == null ? void 0 : e3.category)), await async function fetchCategories() {
3502
+ var _a, _b, _c, _d;
3503
+ set(d2, proxy(await Ze.getCategories())), !get$1(s2) && ((_a = get$1(d2)) == null ? void 0 : _a.length) > 0 && set(s2, proxy(get$1(c2) && ((_b = get$1(d2)) == null ? void 0 : _b.includes(get$1(c2))) ? get$1(c2) : (_d = get$1(d2)) == null ? void 0 : _d[((_c = get$1(d2)) == null ? void 0 : _c.length) - 1]));
3504
+ }();
3505
+ }), user_effect(() => {
3506
+ get$1(s2) && (set(u2, proxy([])), set(p2, 1), set(_2, true), set(g2, false), set(a2, true), // Delay fetch to prevent rapid requests
3507
+ setTimeout(async () => {
3508
+ await fetchGames(), get$1(u2).length < 10 && await fetchGames();
3509
+ }, 100));
3510
+ }), user_effect(() => {
3511
+ get$1(v2) && o2 && o2.observe(get$1(v2));
3512
+ });
3513
+ var h2 = ot();
3514
+ event("keydown", I, (e3) => {
3515
+ "Escape" == e3.key && store_set(Ge, false);
3516
+ });
3517
+ var m2 = child(h2), b2 = child(m2), y2 = child(b2), $2 = child(sibling(b2, 2));
3518
+ $2.__click = [on_click, f2];
3519
+ var w2 = child($2), x2 = child(w2), k2 = sibling($2, 2);
3520
+ k2.__click = [on_click_1, () => store_get(Ge, "$discoveryOpen", n2)], function X(e3, t3) {
3521
+ const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
3522
+ Icon$1(e3, spread_props({
3523
+ name: "x"
3524
+ }, () => n3, {
3525
+ iconNode: [["path", {
3526
+ d: "M18 6 6 18"
3527
+ }], ["path", {
3528
+ d: "m6 6 12 12"
3529
+ }]],
3530
+ children: (e4, n4) => {
3531
+ var i3 = comment();
3532
+ slot(first_child(i3), t3, "default", {}, null), append(e4, i3);
3533
+ },
3534
+ $$slots: {
3535
+ default: true
3536
+ }
3537
+ }));
3538
+ }(child(k2), {
3539
+ size: 24
3540
+ });
3541
+ var C2 = sibling(m2, 2);
3542
+ Navigation(child(C2), {
3543
+ get categories() {
3544
+ return get$1(d2);
3545
+ },
3546
+ get selectedCategory() {
3547
+ return get$1(s2);
3548
+ },
3549
+ set selectedCategory(e3) {
3550
+ set(s2, proxy(e3));
3551
+ }
3552
+ });
3553
+ var M2 = sibling(C2, 2), S2 = child(M2), consequent = (e3) => {
3554
+ var t3 = nt();
3555
+ Loader_circle(child(t3), {
3556
+ class: "animate-spin opacity-75",
3557
+ size: 50,
3558
+ strokeWidth: 2.5
3559
+ }), append(e3, t3);
3560
+ }, alternate_1 = (e3) => {
3561
+ var t3 = comment(), n3 = first_child(t3), consequent_1 = (e4) => {
3562
+ append(e4, rt());
3563
+ }, alternate = (e4) => {
3564
+ var t4 = it(), n4 = child(t4);
3565
+ each(n4, 17, () => get$1(u2), index, (e5, t5) => {
3566
+ GameCard(e5, {
3567
+ get game() {
3568
+ return get$1(t5);
3569
+ },
3570
+ onClick: () => Ze.trackClick(get$1(t5).id)
3571
+ });
3572
+ });
3573
+ var i3 = sibling(n4, 2), o3 = child(i3), consequent_2 = (e5) => {
3574
+ Loader_circle(e5, {
3575
+ class: "animate-spin opacity-75",
3576
+ size: 30,
3577
+ strokeWidth: 2.5
3578
+ });
3579
+ };
3580
+ if_block(o3, (e5) => {
3581
+ get$1(l2) && e5(consequent_2);
3582
+ }), bind_this(i3, (e5) => set(v2, e5), () => get$1(v2)), append(e4, t4);
3583
+ };
3584
+ if_block(n3, (e4) => {
3585
+ 0 !== get$1(u2).length || get$1(a2) ? e4(alternate, false) : e4(consequent_1);
3586
+ }, true), append(e3, t3);
3587
+ };
3588
+ if_block(S2, (e3) => {
3589
+ get$1(a2) && 0 === get$1(u2).length ? e3(consequent) : e3(alternate_1, false);
3590
+ });
3591
+ var T2 = child(sibling(M2, 2));
3592
+ !function External_link(e3, t3) {
3593
+ const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
3594
+ Icon$1(e3, spread_props({
3595
+ name: "external-link"
3596
+ }, () => n3, {
3597
+ iconNode: [["path", {
3598
+ d: "M15 3h6v6"
3599
+ }], ["path", {
3600
+ d: "M10 14 21 3"
3601
+ }], ["path", {
3602
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
3603
+ }]],
3604
+ children: (e4, n4) => {
3605
+ var i3 = comment();
3606
+ slot(first_child(i3), t3, "default", {}, null), append(e4, i3);
3607
+ },
3608
+ $$slots: {
3609
+ default: true
3610
+ }
3611
+ }));
3612
+ }(sibling(child(T2)), {
3613
+ size: 14,
3614
+ style: "margin-top: 1px;"
3615
+ }), template_effect(() => {
3616
+ set_attribute(y2, "src", store_get(He, "$projectUrl", n2) + "/static/images/logo-white-small.png"), set_text(x2, get$1(f2) ? "Ignore exit intent" : "Trigger on exit intent");
3617
+ }), transition(3, h2, () => blur, () => ({
3618
+ duration: 250
3619
+ })), append(e2, h2), pop(), i2();
3620
+ }
3621
+ delegate(["click"]);
3622
+ var st = /* @__PURE__ */ template('<div class="fixed top-0 left-0 right-0 h-2 z-99990"></div>');
3623
+ delegate(["mouseover"]);
3624
+ var at = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
3625
+ function App(e2, t2) {
3626
+ var _a, _b, _c, _d;
3627
+ push(t2, true);
3628
+ const [n2, i2] = setup_stores(), $discoveryOpen = () => store_get(Ge, "$discoveryOpen", n2);
3629
+ let o2 = proxy((_b = (_a = t2.config) == null ? void 0 : _a.button) == null ? void 0 : _b.position), s2 = proxy((_d = (_c = t2.config) == null ? void 0 : _c.button) == null ? void 0 : _d.visible);
3630
+ function openDiscovery() {
3631
+ store_set(Ge, true), Ze.trackOpen();
3632
+ }
3633
+ var a2 = at(), l2 = first_child(a2);
3634
+ FloatingButton(l2, {
3635
+ get position() {
3636
+ return o2;
3637
+ },
3638
+ get visible() {
3639
+ return s2;
3640
+ },
3641
+ onClick: openDiscovery
3642
+ });
3643
+ var c2 = sibling(l2, 2), consequent = (e3) => {
3644
+ DiscoveryOverlay(e3, {});
3645
+ };
3646
+ if_block(c2, (e3) => {
3647
+ $discoveryOpen() && e3(consequent);
3648
+ });
3649
+ var u2 = sibling(c2, 2);
3650
+ const d2 = /* @__PURE__ */ derived(() => {
3651
+ var _a2, _b2;
3652
+ return (_b2 = (_a2 = t2.config) == null ? void 0 : _a2.exitIntent) == null ? void 0 : _b2.enabled;
3653
+ });
3654
+ !function ExitIntentDetector(e3, t3) {
3655
+ push(t3, true);
3656
+ let n3, i3 = prop(t3, "enabled", 3, true), o3 = false;
3657
+ onMount(() => {
3658
+ "undefined" != typeof window && (n3 = window.innerHeight);
3659
+ });
3660
+ var s3 = st();
3661
+ event("mouseleave", I, () => {
3662
+ o3 = false;
3663
+ }), event("mousemove", I, (e4) => {
3664
+ const t4 = e4.clientY;
3665
+ if (!o3) return o3 = true, void (n3 = t4);
3666
+ n3 = t4;
3667
+ }), s3.__mouseover = (e4) => {
3668
+ var _a2;
3669
+ const s4 = e4.clientY;
3670
+ s4 < n3 && o3 && i3() && !localStorage.getItem("playlight_exit_intent_disabled_by_user") && ((_a2 = t3.onIntent) == null ? void 0 : _a2.call(t3)), // Update lastMouseY after checking
3671
+ n3 = s4;
3672
+ }, append(e3, s3), pop();
3673
+ }(u2, {
3674
+ get enabled() {
3675
+ return get$1(d2);
3676
+ },
3677
+ onIntent: () => {
3678
+ $discoveryOpen() || openDiscovery();
3679
+ }
3680
+ }), Toaster(sibling(u2, 2), {}), append(e2, a2), pop(), i2();
3681
+ }
3682
+ const lt = {
3683
+ button: {
3684
+ position: "bottom-right",
3685
+ visible: true
3686
+ },
3687
+ exitIntent: {
3688
+ enabled: true
3689
+ }
3690
+ };
3691
+ let ct = {
3692
+ ...lt
3693
+ };
3694
+ function initializeConfig(e2 = {}) {
3695
+ return ct = deepMerge(lt, e2), ct;
3696
+ }
3697
+ function deepMerge(e2, t2) {
3698
+ const n2 = {
3699
+ ...e2
3700
+ };
3701
+ return isObject(e2) && isObject(t2) && Object.keys(t2).forEach((i2) => {
3702
+ isObject(t2[i2]) ? i2 in e2 ? n2[i2] = deepMerge(e2[i2], t2[i2]) : Object.assign(n2, {
3703
+ [i2]: t2[i2]
3704
+ }) : Object.assign(n2, {
3705
+ [i2]: t2[i2]
3706
+ });
3707
+ }), n2;
3708
+ }
3709
+ function isObject(e2) {
3710
+ return e2 && "object" == typeof e2 && !Array.isArray(e2);
3711
+ }
3712
+ const ut = new class PlaylightSDK {
3713
+ constructor() {
3714
+ this.container = null, this.app = null, this.isInitialized = false, this.config = null, this.api = Ze;
3715
+ }
3716
+ async init(e2 = {}) {
3717
+ if (!this.isInitialized)
3718
+ return this.config = initializeConfig(e2), // Create container for Svelte app
3719
+ this.container = document.createElement("div"), this.container.id = "playlight-sdk-container", document.body.appendChild(this.container), // Use mount function (client-side equivalent of render)
3720
+ this.app = mount(App, {
3721
+ target: this.container,
3722
+ props: {
3723
+ config: this.config
3724
+ }
3725
+ }), // Fetch current game info to cache it
3726
+ await this.api.getCurrentGameInfo(), this.isInitialized = true, this;
3727
+ }
3728
+ // Public methods
3729
+ setDiscovery(e2) {
3730
+ this.isInitialized && (Ge.set(e2), get(Ge) && Ze.trackOpen());
3731
+ }
3732
+ }();
3733
+ "undefined" != typeof window && (window.playlightSDK = ut);
3734
+ export {
3735
+ ut as default
3736
+ };
3737
+ //# sourceMappingURL=playlight-sdk.es.js.map