svelte 3.59.0 → 3.59.2

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.
@@ -1,2178 +0,0 @@
1
- function noop() {}
2
-
3
- const identity = x => x;
4
-
5
- function assign(tar, src) {
6
- // @ts-ignore
7
- for (const k in src) tar[k] = src[k];
8
- return tar ;
9
- }
10
-
11
- // Adapted from https://github.com/then/is-promise/blob/master/index.js
12
- // Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE
13
- function is_promise(value) {
14
- return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';
15
- }
16
-
17
- function add_location(element, file, line, column, char) {
18
- element.__svelte_meta = {
19
- loc: { file, line, column, char }
20
- };
21
- }
22
-
23
- function run(fn) {
24
- return fn();
25
- }
26
-
27
- function blank_object() {
28
- return Object.create(null);
29
- }
30
-
31
- function run_all(fns) {
32
- fns.forEach(run);
33
- }
34
-
35
- function is_function(thing) {
36
- return typeof thing === 'function';
37
- }
38
-
39
- function safe_not_equal(a, b) {
40
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
41
- }
42
-
43
- let src_url_equal_anchor;
44
-
45
- function src_url_equal(element_src, url) {
46
- if (!src_url_equal_anchor) {
47
- src_url_equal_anchor = document.createElement('a');
48
- }
49
- src_url_equal_anchor.href = url;
50
- return element_src === src_url_equal_anchor.href;
51
- }
52
-
53
- function not_equal(a, b) {
54
- return a != a ? b == b : a !== b;
55
- }
56
-
57
- function is_empty(obj) {
58
- return Object.keys(obj).length === 0;
59
- }
60
-
61
- function validate_store(store, name) {
62
- if (store != null && typeof store.subscribe !== 'function') {
63
- throw new Error(`'${name}' is not a store with a 'subscribe' method`);
64
- }
65
- }
66
-
67
- function subscribe(store, ...callbacks) {
68
- if (store == null) {
69
- return noop;
70
- }
71
- const unsub = store.subscribe(...callbacks);
72
- return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
73
- }
74
-
75
- function get_store_value(store) {
76
- let value;
77
- subscribe(store, _ => value = _)();
78
- return value;
79
- }
80
-
81
- function component_subscribe(component, store, callback) {
82
- component.$$.on_destroy.push(subscribe(store, callback));
83
- }
84
-
85
- function create_slot(definition, ctx, $$scope, fn) {
86
- if (definition) {
87
- const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
88
- return definition[0](slot_ctx);
89
- }
90
- }
91
-
92
- function get_slot_context(definition, ctx, $$scope, fn) {
93
- return definition[1] && fn
94
- ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
95
- : $$scope.ctx;
96
- }
97
-
98
- function get_slot_changes(definition, $$scope, dirty, fn) {
99
- if (definition[2] && fn) {
100
- const lets = definition[2](fn(dirty));
101
-
102
- if ($$scope.dirty === undefined) {
103
- return lets;
104
- }
105
-
106
- if (typeof lets === 'object') {
107
- const merged = [];
108
- const len = Math.max($$scope.dirty.length, lets.length);
109
- for (let i = 0; i < len; i += 1) {
110
- merged[i] = $$scope.dirty[i] | lets[i];
111
- }
112
-
113
- return merged;
114
- }
115
-
116
- return $$scope.dirty | lets;
117
- }
118
-
119
- return $$scope.dirty;
120
- }
121
-
122
- function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
123
- if (slot_changes) {
124
- const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
125
- slot.p(slot_context, slot_changes);
126
- }
127
- }
128
-
129
- function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {
130
- const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);
131
- update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);
132
- }
133
-
134
- function get_all_dirty_from_scope($$scope) {
135
- if ($$scope.ctx.length > 32) {
136
- const dirty = [];
137
- const length = $$scope.ctx.length / 32;
138
- for (let i = 0; i < length; i++) {
139
- dirty[i] = -1;
140
- }
141
- return dirty;
142
- }
143
- return -1;
144
- }
145
-
146
- function exclude_internal_props(props) {
147
- const result = {};
148
- for (const k in props) if (k[0] !== '$') result[k] = props[k];
149
- return result;
150
- }
151
-
152
- function compute_rest_props(props, keys) {
153
- const rest = {};
154
- keys = new Set(keys);
155
- for (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k];
156
- return rest;
157
- }
158
-
159
- function compute_slots(slots) {
160
- const result = {};
161
- for (const key in slots) {
162
- result[key] = true;
163
- }
164
- return result;
165
- }
166
-
167
- function once(fn) {
168
- let ran = false;
169
- return function( ...args) {
170
- if (ran) return;
171
- ran = true;
172
- fn.call(this, ...args);
173
- };
174
- }
175
-
176
- function null_to_empty(value) {
177
- return value == null ? '' : value;
178
- }
179
-
180
- function set_store_value(store, ret, value) {
181
- store.set(value);
182
- return ret;
183
- }
184
-
185
- const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
186
-
187
- function action_destroyer(action_result) {
188
- return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
189
- }
190
-
191
- function split_css_unit(value) {
192
- const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
193
- return split ? [parseFloat(split[1]), split[2] || 'px'] : [value , 'px'];
194
- }
195
-
196
- const contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];
197
-
198
- const is_client = typeof window !== 'undefined';
199
-
200
- let now = is_client
201
- ? () => window.performance.now()
202
- : () => Date.now();
203
-
204
- let raf = is_client ? cb => requestAnimationFrame(cb) : noop;
205
-
206
- // used internally for testing
207
- function set_now(fn) {
208
- now = fn;
209
- }
210
-
211
- function set_raf(fn) {
212
- raf = fn;
213
- }
214
-
215
- const tasks = new Set();
216
-
217
- function run_tasks(now) {
218
- tasks.forEach(task => {
219
- if (!task.c(now)) {
220
- tasks.delete(task);
221
- task.f();
222
- }
223
- });
224
-
225
- if (tasks.size !== 0) raf(run_tasks);
226
- }
227
-
228
- /**
229
- * For testing purposes only!
230
- */
231
- function clear_loops() {
232
- tasks.clear();
233
- }
234
-
235
- /**
236
- * Creates a new task that runs on each raf frame
237
- * until it returns a falsy value or is aborted
238
- */
239
- function loop(callback) {
240
- let task;
241
-
242
- if (tasks.size === 0) raf(run_tasks);
243
-
244
- return {
245
- promise: new Promise(fulfill => {
246
- tasks.add(task = { c: callback, f: fulfill });
247
- }),
248
- abort() {
249
- tasks.delete(task);
250
- }
251
- };
252
- }
253
-
254
- const globals = (typeof window !== 'undefined'
255
- ? window
256
- : typeof globalThis !== 'undefined'
257
- ? globalThis
258
- : global) ;
259
-
260
- function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
261
- /**
262
- * Resize observer singleton.
263
- * One listener per element only!
264
- * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ
265
- */
266
- class ResizeObserverSingleton {
267
- constructor( options) {this.options = options;ResizeObserverSingleton.prototype.__init.call(this);}
268
-
269
- observe(element, listener) {
270
- this._listeners.set(element, listener);
271
- this._getObserver().observe(element, this.options);
272
- return () => {
273
- this._listeners.delete(element);
274
- this._observer.unobserve(element); // this line can probably be removed
275
- };
276
- }
277
-
278
- __init() {this._listeners = 'WeakMap' in globals ? new WeakMap() : undefined;}
279
-
280
- _getObserver() {
281
- return _nullishCoalesce(this._observer, () => ( (this._observer = new ResizeObserver((entries) => {
282
- for (const entry of entries) {
283
- (ResizeObserverSingleton ).entries.set(entry.target, entry);
284
- _optionalChain([this, 'access', _ => _._listeners, 'access', _2 => _2.get, 'call', _3 => _3(entry.target), 'optionalCall', _4 => _4(entry)]);
285
- }
286
- }))));
287
- }
288
- }
289
- // Needs to be written like this to pass the tree-shake-test
290
- (ResizeObserverSingleton ).entries = 'WeakMap' in globals ? new WeakMap() : undefined;
291
-
292
- // Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM
293
- // at the end of hydration without touching the remaining nodes.
294
- let is_hydrating = false;
295
-
296
- function start_hydrating() {
297
- is_hydrating = true;
298
- }
299
- function end_hydrating() {
300
- is_hydrating = false;
301
- }
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
- function upper_bound(low, high, key, value) {
311
- // Return first index of value larger than input value in the range [low, high)
312
- while (low < high) {
313
- const mid = low + ((high - low) >> 1);
314
- if (key(mid) <= value) {
315
- low = mid + 1;
316
- } else {
317
- high = mid;
318
- }
319
- }
320
- return low;
321
- }
322
-
323
- function init_hydrate(target) {
324
- if (target.hydrate_init) return;
325
- target.hydrate_init = true;
326
-
327
-
328
-
329
- // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>
330
- let children = target.childNodes ;
331
-
332
- // If target is <head>, there may be children without claim_order
333
- if (target.nodeName === 'HEAD') {
334
- const myChildren = [];
335
- for (let i = 0; i < children.length; i++) {
336
- const node = children[i];
337
- if (node.claim_order !== undefined) {
338
- myChildren.push(node);
339
- }
340
- }
341
- children = myChildren;
342
- }
343
-
344
- /*
345
- * Reorder claimed children optimally.
346
- * We can reorder claimed children optimally by finding the longest subsequence of
347
- * nodes that are already claimed in order and only moving the rest. The longest
348
- * subsequence of nodes that are claimed in order can be found by
349
- * computing the longest increasing subsequence of .claim_order values.
350
- *
351
- * This algorithm is optimal in generating the least amount of reorder operations
352
- * possible.
353
- *
354
- * Proof:
355
- * We know that, given a set of reordering operations, the nodes that do not move
356
- * always form an increasing subsequence, since they do not move among each other
357
- * meaning that they must be already ordered among each other. Thus, the maximal
358
- * set of nodes that do not move form a longest increasing subsequence.
359
- */
360
-
361
- // Compute longest increasing subsequence
362
- // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j
363
- const m = new Int32Array(children.length + 1);
364
- // Predecessor indices + 1
365
- const p = new Int32Array(children.length);
366
-
367
- m[0] = -1;
368
- let longest = 0;
369
- for (let i = 0; i < children.length; i++) {
370
- const current = children[i].claim_order;
371
- // Find the largest subsequence length such that it ends in a value less than our current value
372
-
373
- // upper_bound returns first greater value, so we subtract one
374
- // with fast path for when we are on the current longest subsequence
375
- const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;
376
-
377
- p[i] = m[seqLen] + 1;
378
-
379
- const newLen = seqLen + 1;
380
-
381
- // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.
382
- m[newLen] = i;
383
-
384
- longest = Math.max(newLen, longest);
385
- }
386
-
387
- // The longest increasing subsequence of nodes (initially reversed)
388
- const lis = [];
389
- // The rest of the nodes, nodes that will be moved
390
- const toMove = [];
391
- let last = children.length - 1;
392
- for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {
393
- lis.push(children[cur - 1]);
394
- for (; last >= cur; last--) {
395
- toMove.push(children[last]);
396
- }
397
- last--;
398
- }
399
- for (; last >= 0; last--) {
400
- toMove.push(children[last]);
401
- }
402
- lis.reverse();
403
-
404
- // We sort the nodes being moved to guarantee that their insertion order matches the claim order
405
- toMove.sort((a, b) => a.claim_order - b.claim_order);
406
-
407
- // Finally, we move the nodes
408
- for (let i = 0, j = 0; i < toMove.length; i++) {
409
- while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {
410
- j++;
411
- }
412
- const anchor = j < lis.length ? lis[j] : null;
413
- target.insertBefore(toMove[i], anchor);
414
- }
415
- }
416
-
417
- function append(target, node) {
418
- target.appendChild(node);
419
- }
420
-
421
- function append_styles(
422
- target,
423
- style_sheet_id,
424
- styles
425
- ) {
426
- const append_styles_to = get_root_for_style(target);
427
-
428
- if (!append_styles_to.getElementById(style_sheet_id)) {
429
- const style = element('style');
430
- style.id = style_sheet_id;
431
- style.textContent = styles;
432
- append_stylesheet(append_styles_to, style);
433
- }
434
- }
435
-
436
- function get_root_for_style(node) {
437
- if (!node) return document;
438
-
439
- const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
440
- if (root && (root ).host) {
441
- return root ;
442
- }
443
- return node.ownerDocument;
444
- }
445
-
446
- function append_empty_stylesheet(node) {
447
- const style_element = element('style') ;
448
- append_stylesheet(get_root_for_style(node), style_element);
449
- return style_element.sheet ;
450
- }
451
-
452
- function append_stylesheet(node, style) {
453
- append((node ).head || node, style);
454
- return style.sheet ;
455
- }
456
-
457
- function append_hydration(target, node) {
458
- if (is_hydrating) {
459
- init_hydrate(target);
460
-
461
- if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {
462
- target.actual_end_child = target.firstChild;
463
- }
464
-
465
- // Skip nodes of undefined ordering
466
- while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {
467
- target.actual_end_child = target.actual_end_child.nextSibling;
468
- }
469
-
470
- if (node !== target.actual_end_child) {
471
- // We only insert if the ordering of this node should be modified or the parent node is not target
472
- if (node.claim_order !== undefined || node.parentNode !== target) {
473
- target.insertBefore(node, target.actual_end_child);
474
- }
475
- } else {
476
- target.actual_end_child = node.nextSibling;
477
- }
478
- } else if (node.parentNode !== target || node.nextSibling !== null) {
479
- target.appendChild(node);
480
- }
481
- }
482
-
483
- function insert(target, node, anchor) {
484
- target.insertBefore(node, anchor || null);
485
- }
486
-
487
- function insert_hydration(target, node, anchor) {
488
- if (is_hydrating && !anchor) {
489
- append_hydration(target, node);
490
- } else if (node.parentNode !== target || node.nextSibling != anchor) {
491
- target.insertBefore(node, anchor || null);
492
- }
493
- }
494
-
495
- function detach(node) {
496
- if (node.parentNode) {
497
- node.parentNode.removeChild(node);
498
- }
499
- }
500
-
501
- function destroy_each(iterations, detaching) {
502
- for (let i = 0; i < iterations.length; i += 1) {
503
- if (iterations[i]) iterations[i].d(detaching);
504
- }
505
- }
506
-
507
- function element(name) {
508
- return document.createElement(name);
509
- }
510
-
511
- function element_is(name, is) {
512
- return document.createElement(name, { is });
513
- }
514
-
515
- function object_without_properties(obj, exclude) {
516
- const target = {} ;
517
- for (const k in obj) {
518
- if (
519
- has_prop(obj, k)
520
- // @ts-ignore
521
- && exclude.indexOf(k) === -1
522
- ) {
523
- // @ts-ignore
524
- target[k] = obj[k];
525
- }
526
- }
527
- return target;
528
- }
529
-
530
- function svg_element(name) {
531
- return document.createElementNS('http://www.w3.org/2000/svg', name);
532
- }
533
-
534
- function text(data) {
535
- return document.createTextNode(data);
536
- }
537
-
538
- function space() {
539
- return text(' ');
540
- }
541
-
542
- function empty() {
543
- return text('');
544
- }
545
-
546
- function comment(content) {
547
- return document.createComment(content);
548
- }
549
-
550
- function listen(node, event, handler, options) {
551
- node.addEventListener(event, handler, options);
552
- return () => node.removeEventListener(event, handler, options);
553
- }
554
-
555
- function prevent_default(fn) {
556
- return function (event) {
557
- event.preventDefault();
558
- // @ts-ignore
559
- return fn.call(this, event);
560
- };
561
- }
562
-
563
- function stop_propagation(fn) {
564
- return function (event) {
565
- event.stopPropagation();
566
- // @ts-ignore
567
- return fn.call(this, event);
568
- };
569
- }
570
-
571
- function stop_immediate_propagation(fn) {
572
- return function (event) {
573
- event.stopImmediatePropagation();
574
- // @ts-ignore
575
- return fn.call(this, event);
576
- };
577
- }
578
-
579
- function self(fn) {
580
- return function (event) {
581
- // @ts-ignore
582
- if (event.target === this) fn.call(this, event);
583
- };
584
- }
585
-
586
- function trusted(fn) {
587
- return function (event) {
588
- // @ts-ignore
589
- if (event.isTrusted) fn.call(this, event);
590
- };
591
- }
592
-
593
- function attr(node, attribute, value) {
594
- if (value == null) node.removeAttribute(attribute);
595
- else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
596
- }
597
-
598
- /**
599
- * List of attributes that should always be set through the attr method,
600
- * because updating them through the property setter doesn't work reliably.
601
- * In the example of `width`/`height`, the problem is that the setter only
602
- * accepts numeric values, but the attribute can also be set to a string like `50%`.
603
- * If this list becomes too big, rethink this approach.
604
- */
605
- const always_set_through_set_attribute = ['width', 'height'];
606
-
607
- function set_attributes(node, attributes) {
608
- // @ts-ignore
609
- const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
610
- for (const key in attributes) {
611
- if (attributes[key] == null) {
612
- node.removeAttribute(key);
613
- } else if (key === 'style') {
614
- node.style.cssText = attributes[key];
615
- } else if (key === '__value') {
616
- (node ).value = node[key] = attributes[key];
617
- } else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
618
- node[key] = attributes[key];
619
- } else {
620
- attr(node, key, attributes[key]);
621
- }
622
- }
623
- }
624
-
625
- function set_svg_attributes(node, attributes) {
626
- for (const key in attributes) {
627
- attr(node, key, attributes[key]);
628
- }
629
- }
630
-
631
- function set_custom_element_data_map(node, data_map) {
632
- Object.keys(data_map).forEach((key) => {
633
- set_custom_element_data(node, key, data_map[key]);
634
- });
635
- }
636
-
637
- function set_custom_element_data(node, prop, value) {
638
- if (prop in node) {
639
- node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;
640
- } else {
641
- attr(node, prop, value);
642
- }
643
- }
644
-
645
- function set_dynamic_element_data(tag) {
646
- return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;
647
- }
648
-
649
- function xlink_attr(node, attribute, value) {
650
- node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);
651
- }
652
-
653
- function get_svelte_dataset(node) {
654
- return node.dataset.svelteH;
655
- }
656
-
657
- function get_binding_group_value(group, __value, checked) {
658
- const value = new Set();
659
- for (let i = 0; i < group.length; i += 1) {
660
- if (group[i].checked) value.add(group[i].__value);
661
- }
662
- if (!checked) {
663
- value.delete(__value);
664
- }
665
- return Array.from(value);
666
- }
667
-
668
- function init_binding_group(group) {
669
- let _inputs;
670
- return {
671
- /* push */ p(...inputs) {
672
- _inputs = inputs;
673
- _inputs.forEach(input => group.push(input));
674
- },
675
-
676
- /* remove */ r() {
677
- _inputs.forEach(input => group.splice(group.indexOf(input), 1));
678
- }
679
- };
680
- }
681
-
682
- function init_binding_group_dynamic(group, indexes) {
683
- let _group = get_binding_group(group);
684
- let _inputs;
685
- function get_binding_group(group) {
686
- for (let i = 0; i < indexes.length; i++) {
687
- group = group[indexes[i]] = group[indexes[i]] || [];
688
- }
689
- return group;
690
- }
691
- function push() {
692
- _inputs.forEach(input => _group.push(input));
693
- }
694
- function remove() {
695
- _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));
696
- }
697
- return {
698
- /* update */ u(new_indexes) {
699
- indexes = new_indexes;
700
- const new_group = get_binding_group(group);
701
- if (new_group !== _group) {
702
- remove();
703
- _group = new_group;
704
- push();
705
- }
706
- },
707
- /* push */ p(...inputs) {
708
- _inputs = inputs;
709
- push();
710
- },
711
- /* remove */ r: remove
712
- };
713
- }
714
-
715
- function to_number(value) {
716
- return value === '' ? null : +value;
717
- }
718
-
719
- function time_ranges_to_array(ranges) {
720
- const array = [];
721
- for (let i = 0; i < ranges.length; i += 1) {
722
- array.push({ start: ranges.start(i), end: ranges.end(i) });
723
- }
724
- return array;
725
- }
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
-
734
-
735
-
736
-
737
-
738
-
739
-
740
-
741
-
742
- function children(element) {
743
- return Array.from(element.childNodes);
744
- }
745
-
746
- function init_claim_info(nodes) {
747
- if (nodes.claim_info === undefined) {
748
- nodes.claim_info = { last_index: 0, total_claimed: 0 };
749
- }
750
- }
751
-
752
- function claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {
753
- // Try to find nodes in an order such that we lengthen the longest increasing subsequence
754
- init_claim_info(nodes);
755
-
756
- const resultNode = (() => {
757
- // We first try to find an element after the previous one
758
- for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
759
- const node = nodes[i];
760
-
761
- if (predicate(node)) {
762
- const replacement = processNode(node);
763
-
764
- if (replacement === undefined) {
765
- nodes.splice(i, 1);
766
- } else {
767
- nodes[i] = replacement;
768
- }
769
- if (!dontUpdateLastIndex) {
770
- nodes.claim_info.last_index = i;
771
- }
772
- return node;
773
- }
774
- }
775
-
776
-
777
- // Otherwise, we try to find one before
778
- // We iterate in reverse so that we don't go too far back
779
- for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
780
- const node = nodes[i];
781
-
782
- if (predicate(node)) {
783
- const replacement = processNode(node);
784
-
785
- if (replacement === undefined) {
786
- nodes.splice(i, 1);
787
- } else {
788
- nodes[i] = replacement;
789
- }
790
- if (!dontUpdateLastIndex) {
791
- nodes.claim_info.last_index = i;
792
- } else if (replacement === undefined) {
793
- // Since we spliced before the last_index, we decrease it
794
- nodes.claim_info.last_index--;
795
- }
796
- return node;
797
- }
798
- }
799
-
800
- // If we can't find any matching node, we create a new one
801
- return createNode();
802
- })();
803
-
804
- resultNode.claim_order = nodes.claim_info.total_claimed;
805
- nodes.claim_info.total_claimed += 1;
806
- return resultNode;
807
- }
808
-
809
- function claim_element_base(nodes, name, attributes, create_element) {
810
- return claim_node(
811
- nodes,
812
- (node) => node.nodeName === name,
813
- (node) => {
814
- const remove = [];
815
- for (let j = 0; j < node.attributes.length; j++) {
816
- const attribute = node.attributes[j];
817
- if (!attributes[attribute.name]) {
818
- remove.push(attribute.name);
819
- }
820
- }
821
- remove.forEach(v => node.removeAttribute(v));
822
- return undefined;
823
- },
824
- () => create_element(name)
825
- );
826
- }
827
-
828
- function claim_element(nodes, name, attributes) {
829
- return claim_element_base(nodes, name, attributes, element);
830
- }
831
-
832
- function claim_svg_element(nodes, name, attributes) {
833
- return claim_element_base(nodes, name, attributes, svg_element);
834
- }
835
-
836
- function claim_text(nodes, data) {
837
- return claim_node(
838
- nodes,
839
- (node) => node.nodeType === 3,
840
- (node) => {
841
- const dataStr = '' + data;
842
- if (node.data.startsWith(dataStr)) {
843
- if (node.data.length !== dataStr.length) {
844
- return node.splitText(dataStr.length);
845
- }
846
- } else {
847
- node.data = dataStr;
848
- }
849
- },
850
- () => text(data),
851
- true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements
852
- );
853
- }
854
-
855
- function claim_space(nodes) {
856
- return claim_text(nodes, ' ');
857
- }
858
-
859
- function claim_comment(nodes, data) {
860
- return claim_node(
861
- nodes,
862
- (node) => node.nodeType === 8,
863
- (node) => {
864
- node.data = '' + data;
865
- return undefined;
866
- },
867
- () => comment(data),
868
- true
869
- );
870
- }
871
-
872
- function find_comment(nodes, text, start) {
873
- for (let i = start; i < nodes.length; i += 1) {
874
- const node = nodes[i];
875
- if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {
876
- return i;
877
- }
878
- }
879
- return nodes.length;
880
- }
881
-
882
-
883
- function claim_html_tag(nodes, is_svg) {
884
- // find html opening tag
885
- const start_index = find_comment(nodes, 'HTML_TAG_START', 0);
886
- const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);
887
- if (start_index === end_index) {
888
- return new HtmlTagHydration(undefined, is_svg);
889
- }
890
-
891
- init_claim_info(nodes);
892
- const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);
893
- detach(html_tag_nodes[0]);
894
- detach(html_tag_nodes[html_tag_nodes.length - 1]);
895
- const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);
896
- for (const n of claimed_nodes) {
897
- n.claim_order = nodes.claim_info.total_claimed;
898
- nodes.claim_info.total_claimed += 1;
899
- }
900
- return new HtmlTagHydration(claimed_nodes, is_svg);
901
- }
902
-
903
- function set_data(text, data) {
904
- data = '' + data;
905
- if (text.data === data) return;
906
- text.data = (data );
907
- }
908
-
909
- function set_data_contenteditable(text, data) {
910
- data = '' + data;
911
- if (text.wholeText === data) return;
912
- text.data = (data );
913
- }
914
-
915
- function set_data_maybe_contenteditable(text, data, attr_value) {
916
- if (~contenteditable_truthy_values.indexOf(attr_value)) {
917
- set_data_contenteditable(text, data);
918
- } else {
919
- set_data(text, data);
920
- }
921
- }
922
-
923
- function set_input_value(input, value) {
924
- input.value = value == null ? '' : value;
925
- }
926
-
927
- function set_input_type(input, type) {
928
- try {
929
- input.type = type;
930
- } catch (e) {
931
- // do nothing
932
- }
933
- }
934
-
935
- function set_style(node, key, value, important) {
936
- if (value === null) {
937
- node.style.removeProperty(key);
938
- } else {
939
- node.style.setProperty(key, value, important ? 'important' : '');
940
- }
941
- }
942
-
943
- function select_option(select, value, mounting) {
944
- for (let i = 0; i < select.options.length; i += 1) {
945
- const option = select.options[i];
946
-
947
- if (option.__value === value) {
948
- option.selected = true;
949
- return;
950
- }
951
- }
952
-
953
- if (!mounting || value !== undefined) {
954
- select.selectedIndex = -1; // no option should be selected
955
- }
956
- }
957
-
958
- function select_options(select, value) {
959
- for (let i = 0; i < select.options.length; i += 1) {
960
- const option = select.options[i];
961
- option.selected = ~value.indexOf(option.__value);
962
- }
963
- }
964
-
965
- function select_value(select) {
966
- const selected_option = select.querySelector(':checked');
967
- return selected_option && selected_option.__value;
968
- }
969
-
970
- function select_multiple_value(select) {
971
- return [].map.call(select.querySelectorAll(':checked'), option => option.__value);
972
- }
973
-
974
- // unfortunately this can't be a constant as that wouldn't be tree-shakeable
975
- // so we cache the result instead
976
- let crossorigin;
977
-
978
- function is_crossorigin() {
979
- if (crossorigin === undefined) {
980
- crossorigin = false;
981
-
982
- try {
983
- if (typeof window !== 'undefined' && window.parent) {
984
- void window.parent.document;
985
- }
986
- } catch (error) {
987
- crossorigin = true;
988
- }
989
- }
990
-
991
- return crossorigin;
992
- }
993
-
994
- function add_iframe_resize_listener(node, fn) {
995
- const computed_style = getComputedStyle(node);
996
-
997
- if (computed_style.position === 'static') {
998
- node.style.position = 'relative';
999
- }
1000
-
1001
- const iframe = element('iframe');
1002
- iframe.setAttribute('style',
1003
- 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
1004
- 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'
1005
- );
1006
- iframe.setAttribute('aria-hidden', 'true');
1007
- iframe.tabIndex = -1;
1008
-
1009
- const crossorigin = is_crossorigin();
1010
-
1011
- let unsubscribe;
1012
-
1013
- if (crossorigin) {
1014
- iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>";
1015
- unsubscribe = listen(window, 'message', (event) => {
1016
- if (event.source === iframe.contentWindow) fn();
1017
- });
1018
- } else {
1019
- iframe.src = 'about:blank';
1020
- iframe.onload = () => {
1021
- unsubscribe = listen(iframe.contentWindow, 'resize', fn);
1022
-
1023
- // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)
1024
- // see https://github.com/sveltejs/svelte/issues/4233
1025
- fn();
1026
- };
1027
- }
1028
-
1029
- append(node, iframe);
1030
-
1031
- return () => {
1032
- if (crossorigin) {
1033
- unsubscribe();
1034
- } else if (unsubscribe && iframe.contentWindow) {
1035
- unsubscribe();
1036
- }
1037
-
1038
- detach(iframe);
1039
- };
1040
- }
1041
-
1042
- const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'content-box' });
1043
- const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'border-box' });
1044
- const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: 'device-pixel-content-box' });
1045
-
1046
- function toggle_class(element, name, toggle) {
1047
- element.classList[toggle ? 'add' : 'remove'](name);
1048
- }
1049
-
1050
- function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
1051
- const e = document.createEvent('CustomEvent');
1052
- e.initCustomEvent(type, bubbles, cancelable, detail);
1053
- return e;
1054
- }
1055
-
1056
- function query_selector_all(selector, parent = document.body) {
1057
- return Array.from(parent.querySelectorAll(selector)) ;
1058
- }
1059
-
1060
- function head_selector(nodeId, head) {
1061
- const result = [];
1062
- let started = 0;
1063
-
1064
- for (const node of head.childNodes) {
1065
- if (node.nodeType === 8 /* comment node */) {
1066
- const comment = node.textContent.trim();
1067
- if (comment === `HEAD_${nodeId}_END`) {
1068
- started -= 1;
1069
- result.push(node);
1070
- } else if (comment === `HEAD_${nodeId}_START`) {
1071
- started += 1;
1072
- result.push(node);
1073
- }
1074
- } else if (started > 0) {
1075
- result.push(node);
1076
- }
1077
- }
1078
- return result;
1079
- }
1080
-
1081
- class HtmlTag {
1082
- __init() {this.is_svg = false;}
1083
- // parent for creating node
1084
-
1085
- // html tag nodes
1086
-
1087
- // target
1088
-
1089
- // anchor
1090
-
1091
-
1092
- constructor(is_svg = false) {HtmlTag.prototype.__init.call(this);
1093
- this.is_svg = is_svg;
1094
- this.e = this.n = null;
1095
- }
1096
-
1097
- c(html) {
1098
- this.h(html);
1099
- }
1100
-
1101
- m(
1102
- html,
1103
- target,
1104
- anchor = null
1105
- ) {
1106
- if (!this.e) {
1107
- if (this.is_svg) this.e = svg_element(target.nodeName );
1108
- /** #7364 target for <template> may be provided as #document-fragment(11) */
1109
- else this.e = element((target.nodeType === 11 ? 'TEMPLATE' : target.nodeName) );
1110
- this.t = target.tagName !== 'TEMPLATE' ? target : (target ).content;
1111
- this.c(html);
1112
- }
1113
-
1114
- this.i(anchor);
1115
- }
1116
-
1117
- h(html) {
1118
- this.e.innerHTML = html;
1119
- this.n = Array.from(this.e.nodeName === 'TEMPLATE' ? (this.e ).content.childNodes : this.e.childNodes);
1120
- }
1121
-
1122
- i(anchor) {
1123
- for (let i = 0; i < this.n.length; i += 1) {
1124
- insert(this.t, this.n[i], anchor);
1125
- }
1126
- }
1127
-
1128
- p(html) {
1129
- this.d();
1130
- this.h(html);
1131
- this.i(this.a);
1132
- }
1133
-
1134
- d() {
1135
- this.n.forEach(detach);
1136
- }
1137
- }
1138
-
1139
- class HtmlTagHydration extends HtmlTag {
1140
- // hydration claimed nodes
1141
-
1142
-
1143
- constructor(claimed_nodes, is_svg = false) {
1144
- super(is_svg);
1145
- this.e = this.n = null;
1146
- this.l = claimed_nodes;
1147
- }
1148
- c(html) {
1149
- if (this.l) {
1150
- this.n = this.l;
1151
- } else {
1152
- super.c(html);
1153
- }
1154
- }
1155
- i(anchor) {
1156
- for (let i = 0; i < this.n.length; i += 1) {
1157
- insert_hydration(this.t, this.n[i], anchor);
1158
- }
1159
- }
1160
- }
1161
-
1162
- function attribute_to_object(attributes) {
1163
- const result = {};
1164
- for (const attribute of attributes) {
1165
- result[attribute.name] = attribute.value;
1166
- }
1167
- return result;
1168
- }
1169
-
1170
- function get_custom_elements_slots(element) {
1171
- const result = {};
1172
- element.childNodes.forEach((node) => {
1173
- result[node.slot || 'default'] = true;
1174
- });
1175
- return result;
1176
- }
1177
-
1178
- function construct_svelte_component(component, props) {
1179
- return new component(props);
1180
- }
1181
-
1182
- // we need to store the information for multiple documents because a Svelte application could also contain iframes
1183
- // https://github.com/sveltejs/svelte/issues/3624
1184
- const managed_styles = new Map();
1185
- let active = 0;
1186
-
1187
- // https://github.com/darkskyapp/string-hash/blob/master/index.js
1188
- function hash(str) {
1189
- let hash = 5381;
1190
- let i = str.length;
1191
-
1192
- while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
1193
- return hash >>> 0;
1194
- }
1195
-
1196
- function create_style_information(doc, node) {
1197
- const info = { stylesheet: append_empty_stylesheet(node), rules: {} };
1198
- managed_styles.set(doc, info);
1199
- return info;
1200
- }
1201
-
1202
- function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {
1203
- const step = 16.666 / duration;
1204
- let keyframes = '{\n';
1205
-
1206
- for (let p = 0; p <= 1; p += step) {
1207
- const t = a + (b - a) * ease(p);
1208
- keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`;
1209
- }
1210
-
1211
- const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`;
1212
- const name = `__svelte_${hash(rule)}_${uid}`;
1213
- const doc = get_root_for_style(node);
1214
-
1215
- const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);
1216
-
1217
- if (!rules[name]) {
1218
- rules[name] = true;
1219
- stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);
1220
- }
1221
-
1222
- const animation = node.style.animation || '';
1223
- node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;
1224
-
1225
- active += 1;
1226
- return name;
1227
- }
1228
-
1229
- function delete_rule(node, name) {
1230
- const previous = (node.style.animation || '').split(', ');
1231
- const next = previous.filter(name
1232
- ? anim => anim.indexOf(name) < 0 // remove specific animation
1233
- : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations
1234
- );
1235
- const deleted = previous.length - next.length;
1236
- if (deleted) {
1237
- node.style.animation = next.join(', ');
1238
- active -= deleted;
1239
- if (!active) clear_rules();
1240
- }
1241
- }
1242
-
1243
- function clear_rules() {
1244
- raf(() => {
1245
- if (active) return;
1246
- managed_styles.forEach(info => {
1247
- const { ownerNode } = info.stylesheet;
1248
- // there is no ownerNode if it runs on jsdom.
1249
- if (ownerNode) detach(ownerNode);
1250
- });
1251
- managed_styles.clear();
1252
- });
1253
- }
1254
-
1255
- let current_component;
1256
-
1257
- function set_current_component(component) {
1258
- current_component = component;
1259
- }
1260
-
1261
- function get_current_component() {
1262
- if (!current_component) throw new Error('Function called outside component initialization');
1263
- return current_component;
1264
- }
1265
-
1266
- /**
1267
- * Schedules a callback to run immediately before the component is updated after any state change.
1268
- *
1269
- * The first time the callback runs will be before the initial `onMount`
1270
- *
1271
- * https://svelte.dev/docs#run-time-svelte-beforeupdate
1272
- */
1273
- function beforeUpdate(fn) {
1274
- get_current_component().$$.before_update.push(fn);
1275
- }
1276
-
1277
- /**
1278
- * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
1279
- * It must be called during the component's initialisation (but doesn't need to live *inside* the component;
1280
- * it can be called from an external module).
1281
- *
1282
- * If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.
1283
- *
1284
- * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
1285
- *
1286
- * https://svelte.dev/docs#run-time-svelte-onmount
1287
- */
1288
- function onMount(fn) {
1289
- get_current_component().$$.on_mount.push(fn);
1290
- }
1291
-
1292
- /**
1293
- * Schedules a callback to run immediately after the component has been updated.
1294
- *
1295
- * The first time the callback runs will be after the initial `onMount`
1296
- */
1297
- function afterUpdate(fn) {
1298
- get_current_component().$$.after_update.push(fn);
1299
- }
1300
-
1301
- /**
1302
- * Schedules a callback to run immediately before the component is unmounted.
1303
- *
1304
- * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the
1305
- * only one that runs inside a server-side component.
1306
- *
1307
- * https://svelte.dev/docs#run-time-svelte-ondestroy
1308
- */
1309
- function onDestroy(fn) {
1310
- get_current_component().$$.on_destroy.push(fn);
1311
- }
1312
-
1313
-
1314
-
1315
-
1316
-
1317
-
1318
-
1319
-
1320
-
1321
-
1322
-
1323
-
1324
-
1325
-
1326
-
1327
-
1328
- /**
1329
- * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
1330
- * Event dispatchers are functions that can take two arguments: `name` and `detail`.
1331
- *
1332
- * Component events created with `createEventDispatcher` create a
1333
- * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).
1334
- * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).
1335
- * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
1336
- * property and can contain any type of data.
1337
- *
1338
- * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:
1339
- * ```ts
1340
- * const dispatch = createEventDispatcher<{
1341
- * loaded: never; // does not take a detail argument
1342
- * change: string; // takes a detail argument of type string, which is required
1343
- * optional: number | null; // takes an optional detail argument of type number
1344
- * }>();
1345
- * ```
1346
- *
1347
- * https://svelte.dev/docs#run-time-svelte-createeventdispatcher
1348
- */
1349
- function createEventDispatcher() {
1350
- const component = get_current_component();
1351
-
1352
- return ((type, detail, { cancelable = false } = {}) => {
1353
- const callbacks = component.$$.callbacks[type];
1354
-
1355
- if (callbacks) {
1356
- // TODO are there situations where events could be dispatched
1357
- // in a server (non-DOM) environment?
1358
- const event = custom_event(type, detail, { cancelable });
1359
- callbacks.slice().forEach(fn => {
1360
- fn.call(component, event);
1361
- });
1362
- return !event.defaultPrevented;
1363
- }
1364
-
1365
- return true;
1366
- }) ;
1367
- }
1368
-
1369
- /**
1370
- * Associates an arbitrary `context` object with the current component and the specified `key`
1371
- * and returns that object. The context is then available to children of the component
1372
- * (including slotted content) with `getContext`.
1373
- *
1374
- * Like lifecycle functions, this must be called during component initialisation.
1375
- *
1376
- * https://svelte.dev/docs#run-time-svelte-setcontext
1377
- */
1378
- function setContext(key, context) {
1379
- get_current_component().$$.context.set(key, context);
1380
- return context;
1381
- }
1382
-
1383
- /**
1384
- * Retrieves the context that belongs to the closest parent component with the specified `key`.
1385
- * Must be called during component initialisation.
1386
- *
1387
- * https://svelte.dev/docs#run-time-svelte-getcontext
1388
- */
1389
- function getContext(key) {
1390
- return get_current_component().$$.context.get(key);
1391
- }
1392
-
1393
- /**
1394
- * Retrieves the whole context map that belongs to the closest parent component.
1395
- * Must be called during component initialisation. Useful, for example, if you
1396
- * programmatically create a component and want to pass the existing context to it.
1397
- *
1398
- * https://svelte.dev/docs#run-time-svelte-getallcontexts
1399
- */
1400
- function getAllContexts() {
1401
- return get_current_component().$$.context;
1402
- }
1403
-
1404
- /**
1405
- * Checks whether a given `key` has been set in the context of a parent component.
1406
- * Must be called during component initialisation.
1407
- *
1408
- * https://svelte.dev/docs#run-time-svelte-hascontext
1409
- */
1410
- function hasContext(key) {
1411
- return get_current_component().$$.context.has(key);
1412
- }
1413
-
1414
- // TODO figure out if we still want to support
1415
- // shorthand events, or if we want to implement
1416
- // a real bubbling mechanism
1417
- function bubble(component, event) {
1418
- const callbacks = component.$$.callbacks[event.type];
1419
-
1420
- if (callbacks) {
1421
- // @ts-ignore
1422
- callbacks.slice().forEach(fn => fn.call(this, event));
1423
- }
1424
- }
1425
-
1426
- const dirty_components = [];
1427
- const intros = { enabled: false };
1428
-
1429
- const binding_callbacks = [];
1430
- let render_callbacks = [];
1431
- const flush_callbacks = [];
1432
-
1433
- const resolved_promise = /* @__PURE__ */ Promise.resolve();
1434
- let update_scheduled = false;
1435
-
1436
- function schedule_update() {
1437
- if (!update_scheduled) {
1438
- update_scheduled = true;
1439
- resolved_promise.then(flush);
1440
- }
1441
- }
1442
-
1443
- function tick() {
1444
- schedule_update();
1445
- return resolved_promise;
1446
- }
1447
-
1448
- function add_render_callback(fn) {
1449
- render_callbacks.push(fn);
1450
- }
1451
-
1452
- function add_flush_callback(fn) {
1453
- flush_callbacks.push(fn);
1454
- }
1455
-
1456
- // flush() calls callbacks in this order:
1457
- // 1. All beforeUpdate callbacks, in order: parents before children
1458
- // 2. All bind:this callbacks, in reverse order: children before parents.
1459
- // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
1460
- // for afterUpdates called during the initial onMount, which are called in
1461
- // reverse order: children before parents.
1462
- // Since callbacks might update component values, which could trigger another
1463
- // call to flush(), the following steps guard against this:
1464
- // 1. During beforeUpdate, any updated components will be added to the
1465
- // dirty_components array and will cause a reentrant call to flush(). Because
1466
- // the flush index is kept outside the function, the reentrant call will pick
1467
- // up where the earlier call left off and go through all dirty components. The
1468
- // current_component value is saved and restored so that the reentrant call will
1469
- // not interfere with the "parent" flush() call.
1470
- // 2. bind:this callbacks cannot trigger new flush() calls.
1471
- // 3. During afterUpdate, any updated components will NOT have their afterUpdate
1472
- // callback called a second time; the seen_callbacks set, outside the flush()
1473
- // function, guarantees this behavior.
1474
- const seen_callbacks = new Set();
1475
- let flushidx = 0; // Do *not* move this inside the flush() function
1476
- function flush() {
1477
- // Do not reenter flush while dirty components are updated, as this can
1478
- // result in an infinite loop. Instead, let the inner flush handle it.
1479
- // Reentrancy is ok afterwards for bindings etc.
1480
- if (flushidx !== 0) {
1481
- return;
1482
- }
1483
-
1484
- const saved_component = current_component;
1485
-
1486
- do {
1487
- // first, call beforeUpdate functions
1488
- // and update components
1489
- try {
1490
- while (flushidx < dirty_components.length) {
1491
- const component = dirty_components[flushidx];
1492
- flushidx++;
1493
- set_current_component(component);
1494
- update(component.$$);
1495
- }
1496
- } catch (e) {
1497
- // reset dirty state to not end up in a deadlocked state and then rethrow
1498
- dirty_components.length = 0;
1499
- flushidx = 0;
1500
- throw e;
1501
- }
1502
-
1503
- set_current_component(null);
1504
-
1505
- dirty_components.length = 0;
1506
- flushidx = 0;
1507
-
1508
- while (binding_callbacks.length) binding_callbacks.pop()();
1509
-
1510
- // then, once components are updated, call
1511
- // afterUpdate functions. This may cause
1512
- // subsequent updates...
1513
- for (let i = 0; i < render_callbacks.length; i += 1) {
1514
- const callback = render_callbacks[i];
1515
-
1516
- if (!seen_callbacks.has(callback)) {
1517
- // ...so guard against infinite loops
1518
- seen_callbacks.add(callback);
1519
-
1520
- callback();
1521
- }
1522
- }
1523
-
1524
- render_callbacks.length = 0;
1525
- } while (dirty_components.length);
1526
-
1527
- while (flush_callbacks.length) {
1528
- flush_callbacks.pop()();
1529
- }
1530
-
1531
- update_scheduled = false;
1532
- seen_callbacks.clear();
1533
- set_current_component(saved_component);
1534
- }
1535
-
1536
- function update($$) {
1537
- if ($$.fragment !== null) {
1538
- $$.update();
1539
- run_all($$.before_update);
1540
- const dirty = $$.dirty;
1541
- $$.dirty = [-1];
1542
- $$.fragment && $$.fragment.p($$.ctx, dirty);
1543
-
1544
- $$.after_update.forEach(add_render_callback);
1545
- }
1546
- }
1547
-
1548
- /**
1549
- * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
1550
- */
1551
- function flush_render_callbacks(fns) {
1552
- const filtered = [];
1553
- const targets = [];
1554
- render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
1555
- targets.forEach((c) => c());
1556
- render_callbacks = filtered;
1557
- }
1558
-
1559
- let promise;
1560
-
1561
-
1562
-
1563
-
1564
-
1565
-
1566
-
1567
-
1568
-
1569
-
1570
-
1571
-
1572
-
1573
-
1574
-
1575
-
1576
-
1577
- function wait() {
1578
- if (!promise) {
1579
- promise = Promise.resolve();
1580
- promise.then(() => {
1581
- promise = null;
1582
- });
1583
- }
1584
-
1585
- return promise;
1586
- }
1587
-
1588
- function dispatch(node, direction, kind) {
1589
- node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));
1590
- }
1591
-
1592
- const outroing = new Set();
1593
- let outros;
1594
-
1595
- function group_outros() {
1596
- outros = {
1597
- r: 0, // remaining outros
1598
- c: [], // callbacks
1599
- p: outros // parent group
1600
- };
1601
- }
1602
-
1603
- function check_outros() {
1604
- if (!outros.r) {
1605
- run_all(outros.c);
1606
- }
1607
- outros = outros.p;
1608
- }
1609
-
1610
- function transition_in(block, local) {
1611
- if (block && block.i) {
1612
- outroing.delete(block);
1613
- block.i(local);
1614
- }
1615
- }
1616
-
1617
- function transition_out(block, local, detach, callback) {
1618
- if (block && block.o) {
1619
- if (outroing.has(block)) return;
1620
- outroing.add(block);
1621
-
1622
- outros.c.push(() => {
1623
- outroing.delete(block);
1624
- if (callback) {
1625
- if (detach) block.d(1);
1626
- callback();
1627
- }
1628
- });
1629
-
1630
- block.o(local);
1631
- } else if (callback) {
1632
- callback();
1633
- }
1634
- }
1635
-
1636
- const null_transition = { duration: 0 };
1637
-
1638
-
1639
-
1640
-
1641
- function create_in_transition(node, fn, params) {
1642
- const options = { direction: 'in' };
1643
- let config = fn(node, params, options);
1644
- let running = false;
1645
- let animation_name;
1646
- let task;
1647
- let uid = 0;
1648
-
1649
- function cleanup() {
1650
- if (animation_name) delete_rule(node, animation_name);
1651
- }
1652
-
1653
- function go() {
1654
- const {
1655
- delay = 0,
1656
- duration = 300,
1657
- easing = identity,
1658
- tick = noop,
1659
- css
1660
- } = config || null_transition;
1661
-
1662
- if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);
1663
- tick(0, 1);
1664
-
1665
- const start_time = now() + delay;
1666
- const end_time = start_time + duration;
1667
-
1668
- if (task) task.abort();
1669
- running = true;
1670
-
1671
- add_render_callback(() => dispatch(node, true, 'start'));
1672
-
1673
- task = loop(now => {
1674
- if (running) {
1675
- if (now >= end_time) {
1676
- tick(1, 0);
1677
-
1678
- dispatch(node, true, 'end');
1679
-
1680
- cleanup();
1681
- return running = false;
1682
- }
1683
-
1684
- if (now >= start_time) {
1685
- const t = easing((now - start_time) / duration);
1686
- tick(t, 1 - t);
1687
- }
1688
- }
1689
-
1690
- return running;
1691
- });
1692
- }
1693
-
1694
- let started = false;
1695
-
1696
- return {
1697
- start() {
1698
- if (started) return;
1699
-
1700
- started = true;
1701
- delete_rule(node);
1702
-
1703
- if (is_function(config)) {
1704
- config = config(options);
1705
- wait().then(go);
1706
- } else {
1707
- go();
1708
- }
1709
- },
1710
-
1711
- invalidate() {
1712
- started = false;
1713
- },
1714
-
1715
- end() {
1716
- if (running) {
1717
- cleanup();
1718
- running = false;
1719
- }
1720
- }
1721
- };
1722
- }
1723
-
1724
- function create_out_transition(node, fn, params) {
1725
- const options = { direction: 'out' };
1726
- let config = fn(node, params, options);
1727
- let running = true;
1728
- let animation_name;
1729
-
1730
- const group = outros;
1731
-
1732
- group.r += 1;
1733
-
1734
- function go() {
1735
- const {
1736
- delay = 0,
1737
- duration = 300,
1738
- easing = identity,
1739
- tick = noop,
1740
- css
1741
- } = config || null_transition;
1742
-
1743
- if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css);
1744
-
1745
- const start_time = now() + delay;
1746
- const end_time = start_time + duration;
1747
-
1748
- add_render_callback(() => dispatch(node, false, 'start'));
1749
-
1750
- loop(now => {
1751
- if (running) {
1752
- if (now >= end_time) {
1753
- tick(0, 1);
1754
-
1755
- dispatch(node, false, 'end');
1756
-
1757
- if (!--group.r) {
1758
- // this will result in `end()` being called,
1759
- // so we don't need to clean up here
1760
- run_all(group.c);
1761
- }
1762
-
1763
- return false;
1764
- }
1765
-
1766
- if (now >= start_time) {
1767
- const t = easing((now - start_time) / duration);
1768
- tick(1 - t, t);
1769
- }
1770
- }
1771
-
1772
- return running;
1773
- });
1774
- }
1775
-
1776
- if (is_function(config)) {
1777
- wait().then(() => {
1778
- // @ts-ignore
1779
- config = config(options);
1780
- go();
1781
- });
1782
- } else {
1783
- go();
1784
- }
1785
-
1786
- return {
1787
- end(reset) {
1788
- if (reset && config.tick) {
1789
- config.tick(1, 0);
1790
- }
1791
-
1792
- if (running) {
1793
- if (animation_name) delete_rule(node, animation_name);
1794
- running = false;
1795
- }
1796
- }
1797
- };
1798
- }
1799
-
1800
-
1801
-
1802
-
1803
-
1804
-
1805
-
1806
-
1807
-
1808
-
1809
-
1810
-
1811
-
1812
-
1813
-
1814
-
1815
-
1816
-
1817
-
1818
- function create_bidirectional_transition(node, fn, params, intro) {
1819
- const options = { direction: 'both' };
1820
- let config = fn(node, params, options);
1821
-
1822
- let t = intro ? 0 : 1;
1823
-
1824
- let running_program = null;
1825
- let pending_program = null;
1826
- let animation_name = null;
1827
-
1828
- function clear_animation() {
1829
- if (animation_name) delete_rule(node, animation_name);
1830
- }
1831
-
1832
- function init(program, duration) {
1833
- const d = (program.b - t) ;
1834
- duration *= Math.abs(d);
1835
-
1836
- return {
1837
- a: t,
1838
- b: program.b,
1839
- d,
1840
- duration,
1841
- start: program.start,
1842
- end: program.start + duration,
1843
- group: program.group
1844
- };
1845
- }
1846
-
1847
- function go(b) {
1848
- const {
1849
- delay = 0,
1850
- duration = 300,
1851
- easing = identity,
1852
- tick = noop,
1853
- css
1854
- } = config || null_transition;
1855
-
1856
- const program = {
1857
- start: now() + delay,
1858
- b
1859
- };
1860
-
1861
- if (!b) {
1862
- // @ts-ignore todo: improve typings
1863
- program.group = outros;
1864
- outros.r += 1;
1865
- }
1866
-
1867
- if (running_program || pending_program) {
1868
- pending_program = program;
1869
- } else {
1870
- // if this is an intro, and there's a delay, we need to do
1871
- // an initial tick and/or apply CSS animation immediately
1872
- if (css) {
1873
- clear_animation();
1874
- animation_name = create_rule(node, t, b, duration, delay, easing, css);
1875
- }
1876
-
1877
- if (b) tick(0, 1);
1878
-
1879
- running_program = init(program, duration);
1880
- add_render_callback(() => dispatch(node, b, 'start'));
1881
-
1882
- loop(now => {
1883
- if (pending_program && now > pending_program.start) {
1884
- running_program = init(pending_program, duration);
1885
- pending_program = null;
1886
-
1887
- dispatch(node, running_program.b, 'start');
1888
-
1889
- if (css) {
1890
- clear_animation();
1891
- animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);
1892
- }
1893
- }
1894
-
1895
- if (running_program) {
1896
- if (now >= running_program.end) {
1897
- tick(t = running_program.b, 1 - t);
1898
- dispatch(node, running_program.b, 'end');
1899
-
1900
- if (!pending_program) {
1901
- // we're done
1902
- if (running_program.b) {
1903
- // intro — we can tidy up immediately
1904
- clear_animation();
1905
- } else {
1906
- // outro — needs to be coordinated
1907
- if (!--running_program.group.r) run_all(running_program.group.c);
1908
- }
1909
- }
1910
-
1911
- running_program = null;
1912
- } else if (now >= running_program.start) {
1913
- const p = now - running_program.start;
1914
- t = running_program.a + running_program.d * easing(p / running_program.duration);
1915
- tick(t, 1 - t);
1916
- }
1917
- }
1918
-
1919
- return !!(running_program || pending_program);
1920
- });
1921
- }
1922
- }
1923
-
1924
- return {
1925
- run(b) {
1926
- if (is_function(config)) {
1927
- wait().then(() => {
1928
- const opts = { direction: b ? 'in' : 'out' };
1929
-
1930
- // @ts-ignore
1931
- config = config(opts);
1932
- go(b);
1933
- });
1934
- } else {
1935
- go(b);
1936
- }
1937
- },
1938
-
1939
- end() {
1940
- clear_animation();
1941
- running_program = pending_program = null;
1942
- }
1943
- };
1944
- }
1945
-
1946
- function bind(component, name, callback) {
1947
- const index = component.$$.props[name];
1948
- if (index !== undefined) {
1949
- component.$$.bound[index] = callback;
1950
- callback(component.$$.ctx[index]);
1951
- }
1952
- }
1953
-
1954
- function create_component(block) {
1955
- block && block.c();
1956
- }
1957
-
1958
- function claim_component(block, parent_nodes) {
1959
- block && block.l(parent_nodes);
1960
- }
1961
-
1962
- function mount_component(component, target, anchor, customElement) {
1963
- const { fragment, after_update } = component.$$;
1964
-
1965
- fragment && fragment.m(target, anchor);
1966
-
1967
- if (!customElement) {
1968
- // onMount happens before the initial afterUpdate
1969
- add_render_callback(() => {
1970
-
1971
- const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
1972
- // if the component was destroyed immediately
1973
- // it will update the `$$.on_destroy` reference to `null`.
1974
- // the destructured on_destroy may still reference to the old array
1975
- if (component.$$.on_destroy) {
1976
- component.$$.on_destroy.push(...new_on_destroy);
1977
- } else {
1978
- // Edge case - component was destroyed immediately,
1979
- // most likely as a result of a binding initialising
1980
- run_all(new_on_destroy);
1981
- }
1982
- component.$$.on_mount = [];
1983
- });
1984
- }
1985
-
1986
- after_update.forEach(add_render_callback);
1987
- }
1988
-
1989
- function destroy_component(component, detaching) {
1990
- const $$ = component.$$;
1991
- if ($$.fragment !== null) {
1992
- flush_render_callbacks($$.after_update);
1993
-
1994
- run_all($$.on_destroy);
1995
-
1996
- $$.fragment && $$.fragment.d(detaching);
1997
-
1998
- // TODO null out other refs, including component.$$ (but need to
1999
- // preserve final state?)
2000
- $$.on_destroy = $$.fragment = null;
2001
- $$.ctx = [];
2002
- }
2003
- }
2004
-
2005
- function make_dirty(component, i) {
2006
- if (component.$$.dirty[0] === -1) {
2007
- dirty_components.push(component);
2008
- schedule_update();
2009
- component.$$.dirty.fill(0);
2010
- }
2011
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
2012
- }
2013
-
2014
- function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
2015
- const parent_component = current_component;
2016
- set_current_component(component);
2017
-
2018
- const $$ = component.$$ = {
2019
- fragment: null,
2020
- ctx: [],
2021
-
2022
- // state
2023
- props,
2024
- update: noop,
2025
- not_equal,
2026
- bound: blank_object(),
2027
-
2028
- // lifecycle
2029
- on_mount: [],
2030
- on_destroy: [],
2031
- on_disconnect: [],
2032
- before_update: [],
2033
- after_update: [],
2034
- context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
2035
-
2036
- // everything else
2037
- callbacks: blank_object(),
2038
- dirty,
2039
- skip_bound: false,
2040
- root: options.target || parent_component.$$.root
2041
- };
2042
-
2043
- append_styles && append_styles($$.root);
2044
-
2045
- let ready = false;
2046
-
2047
- $$.ctx = instance
2048
- ? instance(component, options.props || {}, (i, ret, ...rest) => {
2049
- const value = rest.length ? rest[0] : ret;
2050
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
2051
- if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
2052
- if (ready) make_dirty(component, i);
2053
- }
2054
- return ret;
2055
- })
2056
- : [];
2057
-
2058
- $$.update();
2059
- ready = true;
2060
- run_all($$.before_update);
2061
-
2062
- // `false` as a special case of no DOM component
2063
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
2064
-
2065
- if (options.target) {
2066
- if (options.hydrate) {
2067
- start_hydrating();
2068
- const nodes = children(options.target);
2069
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2070
- $$.fragment && $$.fragment.l(nodes);
2071
- nodes.forEach(detach);
2072
- } else {
2073
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2074
- $$.fragment && $$.fragment.c();
2075
- }
2076
-
2077
- if (options.intro) transition_in(component.$$.fragment);
2078
- mount_component(component, options.target, options.anchor, options.customElement);
2079
- end_hydrating();
2080
- flush();
2081
- }
2082
-
2083
- set_current_component(parent_component);
2084
- }
2085
-
2086
- let SvelteElement;
2087
- if (typeof HTMLElement === 'function') {
2088
- SvelteElement = class extends HTMLElement {
2089
-
2090
-
2091
- constructor() {
2092
- super();
2093
- this.attachShadow({ mode: 'open' });
2094
- }
2095
-
2096
- connectedCallback() {
2097
- const { on_mount } = this.$$;
2098
- this.$$.on_disconnect = on_mount.map(run).filter(is_function);
2099
-
2100
- // @ts-ignore todo: improve typings
2101
- for (const key in this.$$.slotted) {
2102
- // @ts-ignore todo: improve typings
2103
- this.appendChild(this.$$.slotted[key]);
2104
- }
2105
- }
2106
-
2107
- attributeChangedCallback(attr, _oldValue, newValue) {
2108
- this[attr] = newValue;
2109
- }
2110
-
2111
- disconnectedCallback() {
2112
- run_all(this.$$.on_disconnect);
2113
- }
2114
-
2115
- $destroy() {
2116
- destroy_component(this, 1);
2117
- this.$destroy = noop;
2118
- }
2119
-
2120
- $on(type, callback) {
2121
- // TODO should this delegate to addEventListener?
2122
- if (!is_function(callback)) {
2123
- return noop;
2124
- }
2125
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
2126
- callbacks.push(callback);
2127
-
2128
- return () => {
2129
- const index = callbacks.indexOf(callback);
2130
- if (index !== -1) callbacks.splice(index, 1);
2131
- };
2132
- }
2133
-
2134
- $set($$props) {
2135
- if (this.$$set && !is_empty($$props)) {
2136
- this.$$.skip_bound = true;
2137
- this.$$set($$props);
2138
- this.$$.skip_bound = false;
2139
- }
2140
- }
2141
- };
2142
- }
2143
-
2144
- /**
2145
- * Base class for Svelte components. Used when dev=false.
2146
- */
2147
- class SvelteComponent {
2148
-
2149
-
2150
-
2151
- $destroy() {
2152
- destroy_component(this, 1);
2153
- this.$destroy = noop;
2154
- }
2155
-
2156
- $on(type, callback) {
2157
- if (!is_function(callback)) {
2158
- return noop;
2159
- }
2160
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
2161
- callbacks.push(callback);
2162
-
2163
- return () => {
2164
- const index = callbacks.indexOf(callback);
2165
- if (index !== -1) callbacks.splice(index, 1);
2166
- };
2167
- }
2168
-
2169
- $set($$props) {
2170
- if (this.$$set && !is_empty($$props)) {
2171
- this.$$.skip_bound = true;
2172
- this.$$set($$props);
2173
- this.$$.skip_bound = false;
2174
- }
2175
- }
2176
- }
2177
-
2178
- export { HtmlTag, HtmlTagHydration, ResizeObserverSingleton, SvelteComponent, SvelteElement, action_destroyer, add_flush_callback, add_iframe_resize_listener, add_location, add_render_callback, afterUpdate, append, append_empty_stylesheet, append_hydration, append_styles, assign, attr, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_comment, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, comment, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, contenteditable_truthy_values, createEventDispatcher, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_rule, create_slot, current_component, custom_event, delete_rule, destroy_component, destroy_each, detach, dirty_components, element, element_is, empty, end_hydrating, exclude_internal_props, flush, flush_render_callbacks, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_current_component, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_store_value, get_svelte_dataset, globals, group_outros, hasContext, has_prop, head_selector, identity, init, init_binding_group, init_binding_group_dynamic, insert, insert_hydration, intros, is_client, is_crossorigin, is_empty, is_function, is_promise, listen, loop, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, prevent_default, query_selector_all, raf, resize_observer_border_box, resize_observer_content_box, resize_observer_device_pixel_content_box, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_custom_element_data_map, set_data, set_data_contenteditable, set_data_maybe_contenteditable, set_dynamic_element_data, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, split_css_unit, src_url_equal, start_hydrating, stop_immediate_propagation, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, trusted, update_slot, update_slot_base, validate_store, xlink_attr };