wherever-dev 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/index.js +217 -17
  2. package/dist/index.js.map +1 -1
  3. package/dist/protocol.d.ts +21 -1
  4. package/dist/protocol.d.ts.map +1 -1
  5. package/dist/protocol.js +5 -1
  6. package/dist/protocol.js.map +1 -1
  7. package/dist/session-pool.d.ts +92 -2
  8. package/dist/session-pool.d.ts.map +1 -1
  9. package/dist/session-pool.js +466 -14
  10. package/dist/session-pool.js.map +1 -1
  11. package/dist/session-types.d.ts +17 -0
  12. package/dist/session-types.d.ts.map +1 -1
  13. package/package.json +1 -1
  14. package/public/_app/immutable/assets/0.CgLKPJWX.css +1 -0
  15. package/public/_app/immutable/chunks/CEg8tgYI.js +2 -0
  16. package/public/_app/immutable/chunks/CEg8tgYI.js.map +1 -0
  17. package/public/_app/immutable/chunks/CTVuBuYH.js +2 -0
  18. package/public/_app/immutable/chunks/{B5WJGjcR.js.map → CTVuBuYH.js.map} +1 -1
  19. package/public/_app/immutable/chunks/DBDAFnY6.js +2 -0
  20. package/public/_app/immutable/chunks/{BqMutrfe.js.map → DBDAFnY6.js.map} +1 -1
  21. package/public/_app/immutable/chunks/MtE7VtNZ.js +2 -0
  22. package/public/_app/immutable/chunks/{DiYtJzYU.js.map → MtE7VtNZ.js.map} +1 -1
  23. package/public/_app/immutable/chunks/S778j9fy.js +2 -0
  24. package/public/_app/immutable/chunks/{_lppinj8.js.map → S778j9fy.js.map} +1 -1
  25. package/public/_app/immutable/chunks/vMsF8lo6.js +3 -0
  26. package/public/_app/immutable/chunks/{DFxBx2vA.js.map → vMsF8lo6.js.map} +1 -1
  27. package/public/_app/immutable/chunks/ylfInSZr.js +2 -0
  28. package/public/_app/immutable/chunks/{BEWoN05F.js.map → ylfInSZr.js.map} +1 -1
  29. package/public/_app/immutable/entry/app.CklFlIiC.js +3 -0
  30. package/public/_app/immutable/entry/app.CklFlIiC.js.map +1 -0
  31. package/public/_app/immutable/entry/start.sF1k4jCY.js +2 -0
  32. package/public/_app/immutable/entry/start.sF1k4jCY.js.map +1 -0
  33. package/public/_app/immutable/nodes/0.BEHRw2jv.js +4 -0
  34. package/public/_app/immutable/nodes/{0.BzvDOlXz.js.map → 0.BEHRw2jv.js.map} +1 -1
  35. package/public/_app/immutable/nodes/1.2gk2c-6t.js +2 -0
  36. package/public/_app/immutable/nodes/{1.DMtW3tA5.js.map → 1.2gk2c-6t.js.map} +1 -1
  37. package/public/_app/immutable/nodes/2.Dto-NrSs.js +82 -0
  38. package/public/_app/immutable/nodes/2.Dto-NrSs.js.map +1 -0
  39. package/public/_app/version.json +1 -1
  40. package/public/index.html +16 -16
  41. package/public/pwa/apple-touch-icon.png +0 -0
  42. package/public/pwa/favicon-192.png +0 -0
  43. package/public/pwa/favicon-512.png +0 -0
  44. package/public/pwa/favicon.ico +0 -0
  45. package/public/pwa/favicon.svg +1 -0
  46. package/public/pwa/manifest.webmanifest +31 -7
  47. package/public/pwa/maskable-192.png +0 -0
  48. package/public/pwa/maskable-512.png +0 -0
  49. package/public/pwa/screenshot-desktop.png +0 -0
  50. package/public/pwa/screenshot-mobile.png +0 -0
  51. package/public/robots.txt +5 -0
  52. package/public/service-worker.js +1 -305
  53. package/public/_app/immutable/assets/0.DvZxoQjW.css +0 -2754
  54. package/public/_app/immutable/chunks/B5WJGjcR.js +0 -23
  55. package/public/_app/immutable/chunks/BEWoN05F.js +0 -110
  56. package/public/_app/immutable/chunks/BqMutrfe.js +0 -2129
  57. package/public/_app/immutable/chunks/DFxBx2vA.js +0 -897
  58. package/public/_app/immutable/chunks/DiYtJzYU.js +0 -396
  59. package/public/_app/immutable/chunks/_lppinj8.js +0 -879
  60. package/public/_app/immutable/chunks/rMw82gDs.js +0 -3048
  61. package/public/_app/immutable/chunks/rMw82gDs.js.map +0 -1
  62. package/public/_app/immutable/entry/app.BFki2czn.js +0 -309
  63. package/public/_app/immutable/entry/app.BFki2czn.js.map +0 -1
  64. package/public/_app/immutable/entry/start.BceUuq27.js +0 -6
  65. package/public/_app/immutable/entry/start.BceUuq27.js.map +0 -1
  66. package/public/_app/immutable/nodes/0.BzvDOlXz.js +0 -546
  67. package/public/_app/immutable/nodes/1.DMtW3tA5.js +0 -24
  68. package/public/_app/immutable/nodes/2.CnZp8abw.js +0 -5152
  69. package/public/_app/immutable/nodes/2.CnZp8abw.js.map +0 -1
  70. package/public/icon.png +0 -0
@@ -1,897 +0,0 @@
1
- import { ab as effect_tracking, ag as get, aR as render_effect, b5 as source, bd as untrack, as as increment, aO as queue_micro_task, ao as hydrate_node, ap as hydrating, J as active_effect, a as BOUNDARY_EFFECT, Q as block, an as hydrate_next, p as HYDRATION_START_ELSE, q as HYDRATION_START_FAILED, U as branch, _ as create_text, aJ as pause_effect, a0 as current_batch, aE as move_effect, a2 as defer_effect, aY as set_active_effect, aZ as set_active_reaction, a_ as set_component_context, c as Batch, am as handle_error, K as active_reaction, X as component_context, au as internal_set, a8 as destroy_effect, a$ as set_hydrate_node, aG as next, b4 as skip_nodes, av as invoke_error_boundary, l as EFFECT_TRANSPARENT, k as EFFECT_PRESERVED, b9 as svelte_boundary_reset_onerror, b8 as svelte_boundary_reset_noop, a4 as define_property, ba as teardown, bh as without_reactive_context, Z as create_element, aj as get_first_child, az as is_firefox, T as TEMPLATE_FRAGMENT, x as TEMPLATE_USE_IMPORT_NODE, R as REACTION_RAN, z as TEXT_NODE, aD as merge_text_nodes, at as init_operations, d as COMMENT_NODE, o as HYDRATION_START, ak as get_next_sibling, n as HYDRATION_ERROR, b0 as set_hydrating, aq as hydration_failed, W as clear_text_content, Y as component_root, O as array_from, aN as push, m as HYDRATION_END, ar as hydration_mismatch, aK as pop, y as TEXT_CACHE } from "./rMw82gDs.js";
2
- function createSubscriber(start) {
3
- let subscribers = 0;
4
- let version = source(0);
5
- let stop;
6
- return () => {
7
- if (effect_tracking()) {
8
- get(version);
9
- render_effect(() => {
10
- if (subscribers === 0) {
11
- stop = untrack(() => start(() => increment(version)));
12
- }
13
- subscribers += 1;
14
- return () => {
15
- queue_micro_task(() => {
16
- subscribers -= 1;
17
- if (subscribers === 0) {
18
- stop?.();
19
- stop = void 0;
20
- increment(version);
21
- }
22
- });
23
- };
24
- });
25
- }
26
- };
27
- }
28
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
29
- function boundary(node, props, children, transform_error) {
30
- new Boundary(node, props, children, transform_error);
31
- }
32
- class Boundary {
33
- /** @type {Boundary | null} */
34
- parent;
35
- is_pending = false;
36
- /**
37
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
38
- * Inherited from parent boundary, or defaults to identity.
39
- * @type {(error: unknown) => unknown}
40
- */
41
- transform_error;
42
- /** @type {TemplateNode} */
43
- #anchor;
44
- /** @type {TemplateNode | null} */
45
- #hydrate_open = hydrating ? hydrate_node : null;
46
- /** @type {BoundaryProps} */
47
- #props;
48
- /** @type {((anchor: Node) => void)} */
49
- #children;
50
- /** @type {Effect} */
51
- #effect;
52
- /** @type {Effect | null} */
53
- #main_effect = null;
54
- /** @type {Effect | null} */
55
- #pending_effect = null;
56
- /** @type {Effect | null} */
57
- #failed_effect = null;
58
- /** @type {DocumentFragment | null} */
59
- #offscreen_fragment = null;
60
- #local_pending_count = 0;
61
- #pending_count = 0;
62
- #pending_count_update_queued = false;
63
- /** @type {Set<Effect>} */
64
- #dirty_effects = /* @__PURE__ */ new Set();
65
- /** @type {Set<Effect>} */
66
- #maybe_dirty_effects = /* @__PURE__ */ new Set();
67
- /**
68
- * A source containing the number of pending async deriveds/expressions.
69
- * Only created if `$effect.pending()` is used inside the boundary,
70
- * otherwise updating the source results in needless `Batch.ensure()`
71
- * calls followed by no-op flushes
72
- * @type {Source<number> | null}
73
- */
74
- #effect_pending = null;
75
- #effect_pending_subscriber = createSubscriber(() => {
76
- this.#effect_pending = source(this.#local_pending_count);
77
- return () => {
78
- this.#effect_pending = null;
79
- };
80
- });
81
- /**
82
- * @param {TemplateNode} node
83
- * @param {BoundaryProps} props
84
- * @param {((anchor: Node) => void)} children
85
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
86
- */
87
- constructor(node, props, children, transform_error) {
88
- this.#anchor = node;
89
- this.#props = props;
90
- this.#children = (anchor) => {
91
- var effect = (
92
- /** @type {Effect} */
93
- active_effect
94
- );
95
- effect.b = this;
96
- effect.f |= BOUNDARY_EFFECT;
97
- children(anchor);
98
- };
99
- this.parent = /** @type {Effect} */
100
- active_effect.b;
101
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
102
- this.#effect = block(() => {
103
- if (hydrating) {
104
- const comment2 = (
105
- /** @type {Comment} */
106
- this.#hydrate_open
107
- );
108
- hydrate_next();
109
- const server_rendered_pending = comment2.data === HYDRATION_START_ELSE;
110
- const server_rendered_failed = comment2.data.startsWith(HYDRATION_START_FAILED);
111
- if (server_rendered_failed) {
112
- const serialized_error = JSON.parse(comment2.data.slice(HYDRATION_START_FAILED.length));
113
- this.#hydrate_failed_content(serialized_error);
114
- } else if (server_rendered_pending) {
115
- this.#hydrate_pending_content();
116
- } else {
117
- this.#hydrate_resolved_content();
118
- }
119
- } else {
120
- this.#render();
121
- }
122
- }, flags);
123
- if (hydrating) {
124
- this.#anchor = hydrate_node;
125
- }
126
- }
127
- #hydrate_resolved_content() {
128
- try {
129
- this.#main_effect = branch(() => this.#children(this.#anchor));
130
- } catch (error) {
131
- this.error(error);
132
- }
133
- }
134
- /**
135
- * @param {unknown} error The deserialized error from the server's hydration comment
136
- */
137
- #hydrate_failed_content(error) {
138
- const failed = this.#props.failed;
139
- if (!failed) return;
140
- this.#failed_effect = branch(() => {
141
- failed(
142
- this.#anchor,
143
- () => error,
144
- () => () => {
145
- }
146
- );
147
- });
148
- }
149
- #hydrate_pending_content() {
150
- const pending = this.#props.pending;
151
- if (!pending) return;
152
- this.is_pending = true;
153
- this.#pending_effect = branch(() => pending(this.#anchor));
154
- queue_micro_task(() => {
155
- var fragment = this.#offscreen_fragment = document.createDocumentFragment();
156
- var anchor = create_text();
157
- fragment.append(anchor);
158
- this.#main_effect = this.#run(() => {
159
- return branch(() => this.#children(anchor));
160
- });
161
- if (this.#pending_count === 0) {
162
- this.#anchor.before(fragment);
163
- this.#offscreen_fragment = null;
164
- pause_effect(
165
- /** @type {Effect} */
166
- this.#pending_effect,
167
- () => {
168
- this.#pending_effect = null;
169
- }
170
- );
171
- this.#resolve(
172
- /** @type {Batch} */
173
- current_batch
174
- );
175
- }
176
- });
177
- }
178
- #render() {
179
- try {
180
- this.is_pending = this.has_pending_snippet();
181
- this.#pending_count = 0;
182
- this.#local_pending_count = 0;
183
- this.#main_effect = branch(() => {
184
- this.#children(this.#anchor);
185
- });
186
- if (this.#pending_count > 0) {
187
- var fragment = this.#offscreen_fragment = document.createDocumentFragment();
188
- move_effect(this.#main_effect, fragment);
189
- const pending = (
190
- /** @type {(anchor: Node) => void} */
191
- this.#props.pending
192
- );
193
- this.#pending_effect = branch(() => pending(this.#anchor));
194
- } else {
195
- this.#resolve(
196
- /** @type {Batch} */
197
- current_batch
198
- );
199
- }
200
- } catch (error) {
201
- this.error(error);
202
- }
203
- }
204
- /**
205
- * @param {Batch} batch
206
- */
207
- #resolve(batch) {
208
- this.is_pending = false;
209
- batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
210
- }
211
- /**
212
- * Defer an effect inside a pending boundary until the boundary resolves
213
- * @param {Effect} effect
214
- */
215
- defer_effect(effect) {
216
- defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
217
- }
218
- /**
219
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
220
- * @returns {boolean}
221
- */
222
- is_rendered() {
223
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
224
- }
225
- has_pending_snippet() {
226
- return !!this.#props.pending;
227
- }
228
- /**
229
- * @template T
230
- * @param {() => T} fn
231
- */
232
- #run(fn) {
233
- var previous_effect = active_effect;
234
- var previous_reaction = active_reaction;
235
- var previous_ctx = component_context;
236
- set_active_effect(this.#effect);
237
- set_active_reaction(this.#effect);
238
- set_component_context(this.#effect.ctx);
239
- try {
240
- Batch.ensure();
241
- return fn();
242
- } catch (e) {
243
- handle_error(e);
244
- return null;
245
- } finally {
246
- set_active_effect(previous_effect);
247
- set_active_reaction(previous_reaction);
248
- set_component_context(previous_ctx);
249
- }
250
- }
251
- /**
252
- * Updates the pending count associated with the currently visible pending snippet,
253
- * if any, such that we can replace the snippet with content once work is done
254
- * @param {1 | -1} d
255
- * @param {Batch} batch
256
- */
257
- #update_pending_count(d, batch) {
258
- if (!this.has_pending_snippet()) {
259
- if (this.parent) {
260
- this.parent.#update_pending_count(d, batch);
261
- }
262
- return;
263
- }
264
- this.#pending_count += d;
265
- if (this.#pending_count === 0) {
266
- this.#resolve(batch);
267
- if (this.#pending_effect) {
268
- pause_effect(this.#pending_effect, () => {
269
- this.#pending_effect = null;
270
- });
271
- }
272
- if (this.#offscreen_fragment) {
273
- this.#anchor.before(this.#offscreen_fragment);
274
- this.#offscreen_fragment = null;
275
- }
276
- }
277
- }
278
- /**
279
- * Update the source that powers `$effect.pending()` inside this boundary,
280
- * and controls when the current `pending` snippet (if any) is removed.
281
- * Do not call from inside the class
282
- * @param {1 | -1} d
283
- * @param {Batch} batch
284
- */
285
- update_pending_count(d, batch) {
286
- this.#update_pending_count(d, batch);
287
- this.#local_pending_count += d;
288
- if (!this.#effect_pending || this.#pending_count_update_queued) return;
289
- this.#pending_count_update_queued = true;
290
- queue_micro_task(() => {
291
- this.#pending_count_update_queued = false;
292
- if (this.#effect_pending) {
293
- internal_set(this.#effect_pending, this.#local_pending_count);
294
- }
295
- });
296
- }
297
- get_effect_pending() {
298
- this.#effect_pending_subscriber();
299
- return get(
300
- /** @type {Source<number>} */
301
- this.#effect_pending
302
- );
303
- }
304
- /** @param {unknown} error */
305
- error(error) {
306
- if (!this.#props.onerror && !this.#props.failed) {
307
- throw error;
308
- }
309
- if (current_batch?.is_fork) {
310
- if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
311
- if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
312
- if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
313
- current_batch.on_fork_commit(() => {
314
- this.#handle_error(error);
315
- });
316
- } else {
317
- this.#handle_error(error);
318
- }
319
- }
320
- /**
321
- * @param {unknown} error
322
- */
323
- #handle_error(error) {
324
- if (this.#main_effect) {
325
- destroy_effect(this.#main_effect);
326
- this.#main_effect = null;
327
- }
328
- if (this.#pending_effect) {
329
- destroy_effect(this.#pending_effect);
330
- this.#pending_effect = null;
331
- }
332
- if (this.#failed_effect) {
333
- destroy_effect(this.#failed_effect);
334
- this.#failed_effect = null;
335
- }
336
- if (hydrating) {
337
- set_hydrate_node(
338
- /** @type {TemplateNode} */
339
- this.#hydrate_open
340
- );
341
- next();
342
- set_hydrate_node(skip_nodes());
343
- }
344
- var onerror = this.#props.onerror;
345
- let failed = this.#props.failed;
346
- var did_reset = false;
347
- var calling_on_error = false;
348
- const reset = () => {
349
- if (did_reset) {
350
- svelte_boundary_reset_noop();
351
- return;
352
- }
353
- did_reset = true;
354
- if (calling_on_error) {
355
- svelte_boundary_reset_onerror();
356
- }
357
- if (this.#failed_effect !== null) {
358
- pause_effect(this.#failed_effect, () => {
359
- this.#failed_effect = null;
360
- });
361
- }
362
- this.#run(() => {
363
- this.#render();
364
- });
365
- };
366
- const handle_error_result = (transformed_error) => {
367
- try {
368
- calling_on_error = true;
369
- onerror?.(transformed_error, reset);
370
- calling_on_error = false;
371
- } catch (error2) {
372
- invoke_error_boundary(error2, this.#effect && this.#effect.parent);
373
- }
374
- if (failed) {
375
- this.#failed_effect = this.#run(() => {
376
- try {
377
- return branch(() => {
378
- var effect = (
379
- /** @type {Effect} */
380
- active_effect
381
- );
382
- effect.b = this;
383
- effect.f |= BOUNDARY_EFFECT;
384
- failed(
385
- this.#anchor,
386
- () => transformed_error,
387
- () => reset
388
- );
389
- });
390
- } catch (error2) {
391
- invoke_error_boundary(
392
- error2,
393
- /** @type {Effect} */
394
- this.#effect.parent
395
- );
396
- return null;
397
- }
398
- });
399
- }
400
- };
401
- queue_micro_task(() => {
402
- var result;
403
- try {
404
- result = this.transform_error(error);
405
- } catch (e) {
406
- invoke_error_boundary(e, this.#effect && this.#effect.parent);
407
- return;
408
- }
409
- if (result !== null && typeof result === "object" && typeof /** @type {any} */
410
- result.then === "function") {
411
- result.then(
412
- handle_error_result,
413
- /** @param {unknown} e */
414
- (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
415
- );
416
- } else {
417
- handle_error_result(result);
418
- }
419
- });
420
- }
421
- }
422
- const PASSIVE_EVENTS = ["touchstart", "touchmove"];
423
- function is_passive_event(name) {
424
- return PASSIVE_EVENTS.includes(name);
425
- }
426
- const event_symbol = /* @__PURE__ */ Symbol("events");
427
- const all_registered_events = /* @__PURE__ */ new Set();
428
- const root_event_handles = /* @__PURE__ */ new Set();
429
- function create_event(event_name, dom, handler, options = {}) {
430
- function target_handler(event2) {
431
- if (!options.capture) {
432
- handle_event_propagation.call(dom, event2);
433
- }
434
- if (!event2.cancelBubble) {
435
- return without_reactive_context(() => {
436
- return handler?.call(this, event2);
437
- });
438
- }
439
- }
440
- if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") {
441
- queue_micro_task(() => {
442
- dom.addEventListener(event_name, target_handler, options);
443
- });
444
- } else {
445
- dom.addEventListener(event_name, target_handler, options);
446
- }
447
- return target_handler;
448
- }
449
- function event(event_name, dom, handler, capture, passive) {
450
- var options = { capture, passive };
451
- var target_handler = create_event(event_name, dom, handler, options);
452
- if (dom === document.body || // @ts-ignore
453
- dom === window || // @ts-ignore
454
- dom === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
455
- dom instanceof HTMLMediaElement) {
456
- teardown(() => {
457
- dom.removeEventListener(event_name, target_handler, options);
458
- });
459
- }
460
- }
461
- function delegated(event_name, element, handler) {
462
- (element[event_symbol] ??= {})[event_name] = handler;
463
- }
464
- function delegate(events) {
465
- for (var i = 0; i < events.length; i++) {
466
- all_registered_events.add(events[i]);
467
- }
468
- for (var fn of root_event_handles) {
469
- fn(events);
470
- }
471
- }
472
- let last_propagated_event = null;
473
- function handle_event_propagation(event2) {
474
- var handler_element = this;
475
- var owner_document = (
476
- /** @type {Node} */
477
- handler_element.ownerDocument
478
- );
479
- var event_name = event2.type;
480
- var path = event2.composedPath?.() || [];
481
- var current_target = (
482
- /** @type {null | Element} */
483
- path[0] || event2.target
484
- );
485
- last_propagated_event = event2;
486
- var path_idx = 0;
487
- var handled_at = last_propagated_event === event2 && event2[event_symbol];
488
- if (handled_at) {
489
- var at_idx = path.indexOf(handled_at);
490
- if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
491
- window)) {
492
- event2[event_symbol] = handler_element;
493
- return;
494
- }
495
- var handler_idx = path.indexOf(handler_element);
496
- if (handler_idx === -1) {
497
- return;
498
- }
499
- if (at_idx <= handler_idx) {
500
- path_idx = at_idx;
501
- }
502
- }
503
- current_target = /** @type {Element} */
504
- path[path_idx] || event2.target;
505
- if (current_target === handler_element) return;
506
- define_property(event2, "currentTarget", {
507
- configurable: true,
508
- get() {
509
- return current_target || owner_document;
510
- }
511
- });
512
- var previous_reaction = active_reaction;
513
- var previous_effect = active_effect;
514
- set_active_reaction(null);
515
- set_active_effect(null);
516
- try {
517
- var throw_error;
518
- var other_errors = [];
519
- while (current_target !== null) {
520
- var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
521
- current_target.host || null;
522
- try {
523
- var delegated2 = current_target[event_symbol]?.[event_name];
524
- if (delegated2 != null && (!/** @type {any} */
525
- current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
526
- // -> the target could not have been disabled because it emits the event in the first place
527
- event2.target === current_target)) {
528
- delegated2.call(current_target, event2);
529
- }
530
- } catch (error) {
531
- if (throw_error) {
532
- other_errors.push(error);
533
- } else {
534
- throw_error = error;
535
- }
536
- }
537
- if (event2.cancelBubble || parent_element === handler_element || parent_element === null) {
538
- break;
539
- }
540
- current_target = parent_element;
541
- }
542
- if (throw_error) {
543
- for (let error of other_errors) {
544
- queueMicrotask(() => {
545
- throw error;
546
- });
547
- }
548
- throw throw_error;
549
- }
550
- } finally {
551
- event2[event_symbol] = handler_element;
552
- delete event2.currentTarget;
553
- set_active_reaction(previous_reaction);
554
- set_active_effect(previous_effect);
555
- }
556
- }
557
- const policy = (
558
- // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
559
- globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
560
- /** @param {string} html */
561
- createHTML: (html) => {
562
- return html;
563
- }
564
- })
565
- );
566
- function create_trusted_html(html) {
567
- return (
568
- /** @type {string} */
569
- policy?.createHTML(html) ?? html
570
- );
571
- }
572
- function create_fragment_from_html(html) {
573
- var elem = create_element("template");
574
- elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
575
- return elem.content;
576
- }
577
- function assign_nodes(start, end) {
578
- var effect = (
579
- /** @type {Effect} */
580
- active_effect
581
- );
582
- if (effect.nodes === null) {
583
- effect.nodes = { start, end, a: null, t: null };
584
- }
585
- }
586
- // @__NO_SIDE_EFFECTS__
587
- function from_html(content, flags2) {
588
- var is_fragment = (flags2 & TEMPLATE_FRAGMENT) !== 0;
589
- var use_import_node = (flags2 & TEMPLATE_USE_IMPORT_NODE) !== 0;
590
- var node;
591
- var has_start = !content.startsWith("<!>");
592
- return () => {
593
- if (hydrating) {
594
- assign_nodes(hydrate_node, null);
595
- return hydrate_node;
596
- }
597
- if (node === void 0) {
598
- node = create_fragment_from_html(has_start ? content : "<!>" + content);
599
- if (!is_fragment) node = /** @type {TemplateNode} */
600
- get_first_child(node);
601
- }
602
- var clone = (
603
- /** @type {TemplateNode} */
604
- use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)
605
- );
606
- if (is_fragment) {
607
- var start = (
608
- /** @type {TemplateNode} */
609
- get_first_child(clone)
610
- );
611
- var end = (
612
- /** @type {TemplateNode} */
613
- clone.lastChild
614
- );
615
- assign_nodes(start, end);
616
- } else {
617
- assign_nodes(clone, clone);
618
- }
619
- return clone;
620
- };
621
- }
622
- // @__NO_SIDE_EFFECTS__
623
- function from_namespace(content, flags2, ns = "svg") {
624
- var has_start = !content.startsWith("<!>");
625
- var wrapped = `<${ns}>${has_start ? content : "<!>" + content}</${ns}>`;
626
- var node;
627
- return () => {
628
- if (hydrating) {
629
- assign_nodes(hydrate_node, null);
630
- return hydrate_node;
631
- }
632
- if (!node) {
633
- var fragment = (
634
- /** @type {DocumentFragment} */
635
- create_fragment_from_html(wrapped)
636
- );
637
- var root = (
638
- /** @type {Element} */
639
- get_first_child(fragment)
640
- );
641
- {
642
- node = /** @type {Element} */
643
- get_first_child(root);
644
- }
645
- }
646
- var clone = (
647
- /** @type {TemplateNode} */
648
- node.cloneNode(true)
649
- );
650
- {
651
- assign_nodes(clone, clone);
652
- }
653
- return clone;
654
- };
655
- }
656
- // @__NO_SIDE_EFFECTS__
657
- function from_svg(content, flags2) {
658
- return /* @__PURE__ */ from_namespace(content, flags2, "svg");
659
- }
660
- function text(value = "") {
661
- if (!hydrating) {
662
- var t = create_text(value + "");
663
- assign_nodes(t, t);
664
- return t;
665
- }
666
- var node = hydrate_node;
667
- if (node.nodeType !== TEXT_NODE) {
668
- node.before(node = create_text());
669
- set_hydrate_node(node);
670
- } else {
671
- merge_text_nodes(
672
- /** @type {Text} */
673
- node
674
- );
675
- }
676
- assign_nodes(node, node);
677
- return node;
678
- }
679
- function comment() {
680
- if (hydrating) {
681
- assign_nodes(hydrate_node, null);
682
- return hydrate_node;
683
- }
684
- var frag = document.createDocumentFragment();
685
- var start = document.createComment("");
686
- var anchor = create_text();
687
- frag.append(start, anchor);
688
- assign_nodes(start, anchor);
689
- return frag;
690
- }
691
- function append(anchor, dom) {
692
- if (hydrating) {
693
- var effect = (
694
- /** @type {Effect & { nodes: EffectNodes }} */
695
- active_effect
696
- );
697
- if ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {
698
- effect.nodes.end = hydrate_node;
699
- }
700
- hydrate_next();
701
- return;
702
- }
703
- if (anchor === null) {
704
- return;
705
- }
706
- anchor.before(
707
- /** @type {Node} */
708
- dom
709
- );
710
- }
711
- let should_intro = true;
712
- function set_text(text2, value) {
713
- var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
714
- if (str !== /** @type {any} */
715
- (text2[TEXT_CACHE] ??= text2.nodeValue)) {
716
- text2[TEXT_CACHE] = str;
717
- text2.nodeValue = `${str}`;
718
- }
719
- }
720
- function mount(component, options) {
721
- return _mount(component, options);
722
- }
723
- function hydrate(component, options) {
724
- init_operations();
725
- options.intro = options.intro ?? false;
726
- const target = options.target;
727
- const was_hydrating = hydrating;
728
- const previous_hydrate_node = hydrate_node;
729
- try {
730
- var anchor = get_first_child(target);
731
- while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
732
- anchor.data !== HYDRATION_START)) {
733
- anchor = get_next_sibling(anchor);
734
- }
735
- if (!anchor) {
736
- throw HYDRATION_ERROR;
737
- }
738
- set_hydrating(true);
739
- set_hydrate_node(
740
- /** @type {Comment} */
741
- anchor
742
- );
743
- const instance = _mount(component, { ...options, anchor });
744
- set_hydrating(false);
745
- return (
746
- /** @type {Exports} */
747
- instance
748
- );
749
- } catch (error) {
750
- if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
751
- throw error;
752
- }
753
- if (error !== HYDRATION_ERROR) {
754
- console.warn("Failed to hydrate: ", error);
755
- }
756
- if (options.recover === false) {
757
- hydration_failed();
758
- }
759
- init_operations();
760
- clear_text_content(target);
761
- set_hydrating(false);
762
- return mount(component, options);
763
- } finally {
764
- set_hydrating(was_hydrating);
765
- set_hydrate_node(previous_hydrate_node);
766
- }
767
- }
768
- const listeners = /* @__PURE__ */ new Map();
769
- function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
770
- init_operations();
771
- var component = void 0;
772
- var unmount2 = component_root(() => {
773
- var anchor_node = anchor ?? target.appendChild(create_text());
774
- boundary(
775
- /** @type {TemplateNode} */
776
- anchor_node,
777
- {
778
- pending: () => {
779
- }
780
- },
781
- (anchor_node2) => {
782
- push({});
783
- var ctx = (
784
- /** @type {ComponentContext} */
785
- component_context
786
- );
787
- if (context) ctx.c = context;
788
- if (events) {
789
- props.$$events = events;
790
- }
791
- if (hydrating) {
792
- assign_nodes(
793
- /** @type {TemplateNode} */
794
- anchor_node2,
795
- null
796
- );
797
- }
798
- should_intro = intro;
799
- component = Component(anchor_node2, props) || {};
800
- should_intro = true;
801
- if (hydrating) {
802
- active_effect.nodes.end = hydrate_node;
803
- if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
804
- hydrate_node.data !== HYDRATION_END) {
805
- hydration_mismatch();
806
- throw HYDRATION_ERROR;
807
- }
808
- }
809
- pop();
810
- },
811
- transformError
812
- );
813
- var registered_events = /* @__PURE__ */ new Set();
814
- var event_handle = (events2) => {
815
- for (var i = 0; i < events2.length; i++) {
816
- var event_name = events2[i];
817
- if (registered_events.has(event_name)) continue;
818
- registered_events.add(event_name);
819
- var passive = is_passive_event(event_name);
820
- for (const node of [target, document]) {
821
- var counts = listeners.get(node);
822
- if (counts === void 0) {
823
- counts = /* @__PURE__ */ new Map();
824
- listeners.set(node, counts);
825
- }
826
- var count = counts.get(event_name);
827
- if (count === void 0) {
828
- node.addEventListener(event_name, handle_event_propagation, { passive });
829
- counts.set(event_name, 1);
830
- } else {
831
- counts.set(event_name, count + 1);
832
- }
833
- }
834
- }
835
- };
836
- event_handle(array_from(all_registered_events));
837
- root_event_handles.add(event_handle);
838
- return () => {
839
- for (var event_name of registered_events) {
840
- for (const node of [target, document]) {
841
- var counts = (
842
- /** @type {Map<string, number>} */
843
- listeners.get(node)
844
- );
845
- var count = (
846
- /** @type {number} */
847
- counts.get(event_name)
848
- );
849
- if (--count == 0) {
850
- node.removeEventListener(event_name, handle_event_propagation);
851
- counts.delete(event_name);
852
- if (counts.size === 0) {
853
- listeners.delete(node);
854
- }
855
- } else {
856
- counts.set(event_name, count);
857
- }
858
- }
859
- }
860
- root_event_handles.delete(event_handle);
861
- if (anchor_node !== anchor) {
862
- anchor_node.parentNode?.removeChild(anchor_node);
863
- }
864
- };
865
- });
866
- mounted_components.set(component, unmount2);
867
- return component;
868
- }
869
- let mounted_components = /* @__PURE__ */ new WeakMap();
870
- function unmount(component, options) {
871
- const fn = mounted_components.get(component);
872
- if (fn) {
873
- mounted_components.delete(component);
874
- return fn(options);
875
- }
876
- return Promise.resolve();
877
- }
878
- const PUBLIC_VERSION = "5";
879
- if (typeof window !== "undefined") {
880
- ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(PUBLIC_VERSION);
881
- }
882
- export {
883
- append as a,
884
- delegated as b,
885
- comment as c,
886
- delegate as d,
887
- event as e,
888
- from_html as f,
889
- from_svg as g,
890
- hydrate as h,
891
- should_intro as i,
892
- mount as m,
893
- set_text as s,
894
- text as t,
895
- unmount as u
896
- };
897
- //# sourceMappingURL=DFxBx2vA.js.map