495 lines
17 KiB
JavaScript
495 lines
17 KiB
JavaScript
|
|
||
|
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
|
||
|
function noop() { }
|
||
|
function add_location(element, file, line, column, char) {
|
||
|
element.__svelte_meta = {
|
||
|
loc: { file, line, column, char }
|
||
|
};
|
||
|
}
|
||
|
function run(fn) {
|
||
|
return fn();
|
||
|
}
|
||
|
function blank_object() {
|
||
|
return Object.create(null);
|
||
|
}
|
||
|
function run_all(fns) {
|
||
|
fns.forEach(run);
|
||
|
}
|
||
|
function is_function(thing) {
|
||
|
return typeof thing === 'function';
|
||
|
}
|
||
|
function safe_not_equal(a, b) {
|
||
|
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
|
||
|
}
|
||
|
let src_url_equal_anchor;
|
||
|
function src_url_equal(element_src, url) {
|
||
|
if (!src_url_equal_anchor) {
|
||
|
src_url_equal_anchor = document.createElement('a');
|
||
|
}
|
||
|
src_url_equal_anchor.href = url;
|
||
|
return element_src === src_url_equal_anchor.href;
|
||
|
}
|
||
|
function is_empty(obj) {
|
||
|
return Object.keys(obj).length === 0;
|
||
|
}
|
||
|
function append(target, node) {
|
||
|
target.appendChild(node);
|
||
|
}
|
||
|
function insert(target, node, anchor) {
|
||
|
target.insertBefore(node, anchor || null);
|
||
|
}
|
||
|
function detach(node) {
|
||
|
node.parentNode.removeChild(node);
|
||
|
}
|
||
|
function destroy_each(iterations, detaching) {
|
||
|
for (let i = 0; i < iterations.length; i += 1) {
|
||
|
if (iterations[i])
|
||
|
iterations[i].d(detaching);
|
||
|
}
|
||
|
}
|
||
|
function element(name) {
|
||
|
return document.createElement(name);
|
||
|
}
|
||
|
function svg_element(name) {
|
||
|
return document.createElementNS('http://www.w3.org/2000/svg', name);
|
||
|
}
|
||
|
function text(data) {
|
||
|
return document.createTextNode(data);
|
||
|
}
|
||
|
function space() {
|
||
|
return text(' ');
|
||
|
}
|
||
|
function empty() {
|
||
|
return text('');
|
||
|
}
|
||
|
function listen(node, event, handler, options) {
|
||
|
node.addEventListener(event, handler, options);
|
||
|
return () => node.removeEventListener(event, handler, options);
|
||
|
}
|
||
|
function attr(node, attribute, value) {
|
||
|
if (value == null)
|
||
|
node.removeAttribute(attribute);
|
||
|
else if (node.getAttribute(attribute) !== value)
|
||
|
node.setAttribute(attribute, value);
|
||
|
}
|
||
|
function set_custom_element_data(node, prop, value) {
|
||
|
if (prop in node) {
|
||
|
node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;
|
||
|
}
|
||
|
else {
|
||
|
attr(node, prop, value);
|
||
|
}
|
||
|
}
|
||
|
function children(element) {
|
||
|
return Array.from(element.childNodes);
|
||
|
}
|
||
|
function set_style(node, key, value, important) {
|
||
|
if (value === null) {
|
||
|
node.style.removeProperty(key);
|
||
|
}
|
||
|
else {
|
||
|
node.style.setProperty(key, value, important ? 'important' : '');
|
||
|
}
|
||
|
}
|
||
|
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
|
||
|
const e = document.createEvent('CustomEvent');
|
||
|
e.initCustomEvent(type, bubbles, cancelable, detail);
|
||
|
return e;
|
||
|
}
|
||
|
class HtmlTag {
|
||
|
constructor(is_svg = false) {
|
||
|
this.is_svg = false;
|
||
|
this.is_svg = is_svg;
|
||
|
this.e = this.n = null;
|
||
|
}
|
||
|
c(html) {
|
||
|
this.h(html);
|
||
|
}
|
||
|
m(html, target, anchor = null) {
|
||
|
if (!this.e) {
|
||
|
if (this.is_svg)
|
||
|
this.e = svg_element(target.nodeName);
|
||
|
else
|
||
|
this.e = element(target.nodeName);
|
||
|
this.t = target;
|
||
|
this.c(html);
|
||
|
}
|
||
|
this.i(anchor);
|
||
|
}
|
||
|
h(html) {
|
||
|
this.e.innerHTML = html;
|
||
|
this.n = Array.from(this.e.childNodes);
|
||
|
}
|
||
|
i(anchor) {
|
||
|
for (let i = 0; i < this.n.length; i += 1) {
|
||
|
insert(this.t, this.n[i], anchor);
|
||
|
}
|
||
|
}
|
||
|
p(html) {
|
||
|
this.d();
|
||
|
this.h(html);
|
||
|
this.i(this.a);
|
||
|
}
|
||
|
d() {
|
||
|
this.n.forEach(detach);
|
||
|
}
|
||
|
}
|
||
|
function attribute_to_object(attributes) {
|
||
|
const result = {};
|
||
|
for (const attribute of attributes) {
|
||
|
result[attribute.name] = attribute.value;
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
let current_component;
|
||
|
function set_current_component(component) {
|
||
|
current_component = component;
|
||
|
}
|
||
|
function get_current_component() {
|
||
|
if (!current_component)
|
||
|
throw new Error('Function called outside component initialization');
|
||
|
return current_component;
|
||
|
}
|
||
|
/**
|
||
|
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
|
||
|
* It must be called during the component's initialisation (but doesn't need to live *inside* the component;
|
||
|
* it can be called from an external module).
|
||
|
*
|
||
|
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
|
||
|
*
|
||
|
* https://svelte.dev/docs#run-time-svelte-onmount
|
||
|
*/
|
||
|
function onMount(fn) {
|
||
|
get_current_component().$$.on_mount.push(fn);
|
||
|
}
|
||
|
/**
|
||
|
* Associates an arbitrary `context` object with the current component and the specified `key`
|
||
|
* and returns that object. The context is then available to children of the component
|
||
|
* (including slotted content) with `getContext`.
|
||
|
*
|
||
|
* Like lifecycle functions, this must be called during component initialisation.
|
||
|
*
|
||
|
* https://svelte.dev/docs#run-time-svelte-setcontext
|
||
|
*/
|
||
|
function setContext(key, context) {
|
||
|
get_current_component().$$.context.set(key, context);
|
||
|
return context;
|
||
|
}
|
||
|
/**
|
||
|
* Retrieves the context that belongs to the closest parent component with the specified `key`.
|
||
|
* Must be called during component initialisation.
|
||
|
*
|
||
|
* https://svelte.dev/docs#run-time-svelte-getcontext
|
||
|
*/
|
||
|
function getContext(key) {
|
||
|
return get_current_component().$$.context.get(key);
|
||
|
}
|
||
|
|
||
|
const dirty_components = [];
|
||
|
const binding_callbacks = [];
|
||
|
const render_callbacks = [];
|
||
|
const flush_callbacks = [];
|
||
|
const resolved_promise = Promise.resolve();
|
||
|
let update_scheduled = false;
|
||
|
function schedule_update() {
|
||
|
if (!update_scheduled) {
|
||
|
update_scheduled = true;
|
||
|
resolved_promise.then(flush);
|
||
|
}
|
||
|
}
|
||
|
function add_render_callback(fn) {
|
||
|
render_callbacks.push(fn);
|
||
|
}
|
||
|
// flush() calls callbacks in this order:
|
||
|
// 1. All beforeUpdate callbacks, in order: parents before children
|
||
|
// 2. All bind:this callbacks, in reverse order: children before parents.
|
||
|
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
|
||
|
// for afterUpdates called during the initial onMount, which are called in
|
||
|
// reverse order: children before parents.
|
||
|
// Since callbacks might update component values, which could trigger another
|
||
|
// call to flush(), the following steps guard against this:
|
||
|
// 1. During beforeUpdate, any updated components will be added to the
|
||
|
// dirty_components array and will cause a reentrant call to flush(). Because
|
||
|
// the flush index is kept outside the function, the reentrant call will pick
|
||
|
// up where the earlier call left off and go through all dirty components. The
|
||
|
// current_component value is saved and restored so that the reentrant call will
|
||
|
// not interfere with the "parent" flush() call.
|
||
|
// 2. bind:this callbacks cannot trigger new flush() calls.
|
||
|
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
|
||
|
// callback called a second time; the seen_callbacks set, outside the flush()
|
||
|
// function, guarantees this behavior.
|
||
|
const seen_callbacks = new Set();
|
||
|
let flushidx = 0; // Do *not* move this inside the flush() function
|
||
|
function flush() {
|
||
|
const saved_component = current_component;
|
||
|
do {
|
||
|
// first, call beforeUpdate functions
|
||
|
// and update components
|
||
|
while (flushidx < dirty_components.length) {
|
||
|
const component = dirty_components[flushidx];
|
||
|
flushidx++;
|
||
|
set_current_component(component);
|
||
|
update(component.$$);
|
||
|
}
|
||
|
set_current_component(null);
|
||
|
dirty_components.length = 0;
|
||
|
flushidx = 0;
|
||
|
while (binding_callbacks.length)
|
||
|
binding_callbacks.pop()();
|
||
|
// then, once components are updated, call
|
||
|
// afterUpdate functions. This may cause
|
||
|
// subsequent updates...
|
||
|
for (let i = 0; i < render_callbacks.length; i += 1) {
|
||
|
const callback = render_callbacks[i];
|
||
|
if (!seen_callbacks.has(callback)) {
|
||
|
// ...so guard against infinite loops
|
||
|
seen_callbacks.add(callback);
|
||
|
callback();
|
||
|
}
|
||
|
}
|
||
|
render_callbacks.length = 0;
|
||
|
} while (dirty_components.length);
|
||
|
while (flush_callbacks.length) {
|
||
|
flush_callbacks.pop()();
|
||
|
}
|
||
|
update_scheduled = false;
|
||
|
seen_callbacks.clear();
|
||
|
set_current_component(saved_component);
|
||
|
}
|
||
|
function update($$) {
|
||
|
if ($$.fragment !== null) {
|
||
|
$$.update();
|
||
|
run_all($$.before_update);
|
||
|
const dirty = $$.dirty;
|
||
|
$$.dirty = [-1];
|
||
|
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
||
|
$$.after_update.forEach(add_render_callback);
|
||
|
}
|
||
|
}
|
||
|
const outroing = new Set();
|
||
|
function transition_in(block, local) {
|
||
|
if (block && block.i) {
|
||
|
outroing.delete(block);
|
||
|
block.i(local);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const globals = (typeof window !== 'undefined'
|
||
|
? window
|
||
|
: typeof globalThis !== 'undefined'
|
||
|
? globalThis
|
||
|
: global);
|
||
|
function mount_component(component, target, anchor, customElement) {
|
||
|
const { fragment, after_update } = component.$$;
|
||
|
fragment && fragment.m(target, anchor);
|
||
|
if (!customElement) {
|
||
|
// onMount happens before the initial afterUpdate
|
||
|
add_render_callback(() => {
|
||
|
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
||
|
// if the component was destroyed immediately
|
||
|
// it will update the `$$.on_destroy` reference to `null`.
|
||
|
// the destructured on_destroy may still reference to the old array
|
||
|
if (component.$$.on_destroy) {
|
||
|
component.$$.on_destroy.push(...new_on_destroy);
|
||
|
}
|
||
|
else {
|
||
|
// Edge case - component was destroyed immediately,
|
||
|
// most likely as a result of a binding initialising
|
||
|
run_all(new_on_destroy);
|
||
|
}
|
||
|
component.$$.on_mount = [];
|
||
|
});
|
||
|
}
|
||
|
after_update.forEach(add_render_callback);
|
||
|
}
|
||
|
function destroy_component(component, detaching) {
|
||
|
const $$ = component.$$;
|
||
|
if ($$.fragment !== null) {
|
||
|
run_all($$.on_destroy);
|
||
|
$$.fragment && $$.fragment.d(detaching);
|
||
|
// TODO null out other refs, including component.$$ (but need to
|
||
|
// preserve final state?)
|
||
|
$$.on_destroy = $$.fragment = null;
|
||
|
$$.ctx = [];
|
||
|
}
|
||
|
}
|
||
|
function make_dirty(component, i) {
|
||
|
if (component.$$.dirty[0] === -1) {
|
||
|
dirty_components.push(component);
|
||
|
schedule_update();
|
||
|
component.$$.dirty.fill(0);
|
||
|
}
|
||
|
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
|
||
|
}
|
||
|
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
|
||
|
const parent_component = current_component;
|
||
|
set_current_component(component);
|
||
|
const $$ = component.$$ = {
|
||
|
fragment: null,
|
||
|
ctx: [],
|
||
|
// state
|
||
|
props,
|
||
|
update: noop,
|
||
|
not_equal,
|
||
|
bound: blank_object(),
|
||
|
// lifecycle
|
||
|
on_mount: [],
|
||
|
on_destroy: [],
|
||
|
on_disconnect: [],
|
||
|
before_update: [],
|
||
|
after_update: [],
|
||
|
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
||
|
// everything else
|
||
|
callbacks: blank_object(),
|
||
|
dirty,
|
||
|
skip_bound: false,
|
||
|
root: options.target || parent_component.$$.root
|
||
|
};
|
||
|
append_styles && append_styles($$.root);
|
||
|
let ready = false;
|
||
|
$$.ctx = instance
|
||
|
? instance(component, options.props || {}, (i, ret, ...rest) => {
|
||
|
const value = rest.length ? rest[0] : ret;
|
||
|
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
||
|
if (!$$.skip_bound && $$.bound[i])
|
||
|
$$.bound[i](value);
|
||
|
if (ready)
|
||
|
make_dirty(component, i);
|
||
|
}
|
||
|
return ret;
|
||
|
})
|
||
|
: [];
|
||
|
$$.update();
|
||
|
ready = true;
|
||
|
run_all($$.before_update);
|
||
|
// `false` as a special case of no DOM component
|
||
|
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
||
|
if (options.target) {
|
||
|
if (options.hydrate) {
|
||
|
const nodes = children(options.target);
|
||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||
|
$$.fragment && $$.fragment.l(nodes);
|
||
|
nodes.forEach(detach);
|
||
|
}
|
||
|
else {
|
||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||
|
$$.fragment && $$.fragment.c();
|
||
|
}
|
||
|
if (options.intro)
|
||
|
transition_in(component.$$.fragment);
|
||
|
mount_component(component, options.target, options.anchor, options.customElement);
|
||
|
flush();
|
||
|
}
|
||
|
set_current_component(parent_component);
|
||
|
}
|
||
|
let SvelteElement;
|
||
|
if (typeof HTMLElement === 'function') {
|
||
|
SvelteElement = class extends HTMLElement {
|
||
|
constructor() {
|
||
|
super();
|
||
|
this.attachShadow({ mode: 'open' });
|
||
|
}
|
||
|
connectedCallback() {
|
||
|
const { on_mount } = this.$$;
|
||
|
this.$$.on_disconnect = on_mount.map(run).filter(is_function);
|
||
|
// @ts-ignore todo: improve typings
|
||
|
for (const key in this.$$.slotted) {
|
||
|
// @ts-ignore todo: improve typings
|
||
|
this.appendChild(this.$$.slotted[key]);
|
||
|
}
|
||
|
}
|
||
|
attributeChangedCallback(attr, _oldValue, newValue) {
|
||
|
this[attr] = newValue;
|
||
|
}
|
||
|
disconnectedCallback() {
|
||
|
run_all(this.$$.on_disconnect);
|
||
|
}
|
||
|
$destroy() {
|
||
|
destroy_component(this, 1);
|
||
|
this.$destroy = noop;
|
||
|
}
|
||
|
$on(type, callback) {
|
||
|
// TODO should this delegate to addEventListener?
|
||
|
if (!is_function(callback)) {
|
||
|
return noop;
|
||
|
}
|
||
|
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
|
||
|
callbacks.push(callback);
|
||
|
return () => {
|
||
|
const index = callbacks.indexOf(callback);
|
||
|
if (index !== -1)
|
||
|
callbacks.splice(index, 1);
|
||
|
};
|
||
|
}
|
||
|
$set($$props) {
|
||
|
if (this.$$set && !is_empty($$props)) {
|
||
|
this.$$.skip_bound = true;
|
||
|
this.$$set($$props);
|
||
|
this.$$.skip_bound = false;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function dispatch_dev(type, detail) {
|
||
|
document.dispatchEvent(custom_event(type, Object.assign({ version: '3.52.0' }, detail), { bubbles: true }));
|
||
|
}
|
||
|
function append_dev(target, node) {
|
||
|
dispatch_dev('SvelteDOMInsert', { target, node });
|
||
|
append(target, node);
|
||
|
}
|
||
|
function insert_dev(target, node, anchor) {
|
||
|
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
|
||
|
insert(target, node, anchor);
|
||
|
}
|
||
|
function detach_dev(node) {
|
||
|
dispatch_dev('SvelteDOMRemove', { node });
|
||
|
detach(node);
|
||
|
}
|
||
|
function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {
|
||
|
const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
|
||
|
if (has_prevent_default)
|
||
|
modifiers.push('preventDefault');
|
||
|
if (has_stop_propagation)
|
||
|
modifiers.push('stopPropagation');
|
||
|
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
|
||
|
const dispose = listen(node, event, handler, options);
|
||
|
return () => {
|
||
|
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
|
||
|
dispose();
|
||
|
};
|
||
|
}
|
||
|
function attr_dev(node, attribute, value) {
|
||
|
attr(node, attribute, value);
|
||
|
if (value == null)
|
||
|
dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
|
||
|
else
|
||
|
dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
|
||
|
}
|
||
|
function set_data_dev(text, data) {
|
||
|
data = '' + data;
|
||
|
if (text.wholeText === data)
|
||
|
return;
|
||
|
dispatch_dev('SvelteDOMSetData', { node: text, data });
|
||
|
text.data = data;
|
||
|
}
|
||
|
function validate_each_argument(arg) {
|
||
|
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
|
||
|
let msg = '{#each} only iterates over array-like objects.';
|
||
|
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
|
||
|
msg += ' You can use a spread to convert this iterable into an array.';
|
||
|
}
|
||
|
throw new Error(msg);
|
||
|
}
|
||
|
}
|
||
|
function validate_slots(name, slot, keys) {
|
||
|
for (const slot_key of Object.keys(slot)) {
|
||
|
if (!~keys.indexOf(slot_key)) {
|
||
|
console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export { setContext as A, run_all as B, svg_element as C, empty as D, is_function as E, HtmlTag as H, SvelteElement as S, attribute_to_object as a, insert_dev as b, validate_slots as c, dispatch_dev as d, element as e, space as f, add_location as g, attr_dev as h, init as i, src_url_equal as j, append_dev as k, detach_dev as l, destroy_each as m, noop as n, onMount as o, set_custom_element_data as p, flush as q, globals as r, safe_not_equal as s, text as t, binding_callbacks as u, validate_each_argument as v, set_style as w, listen_dev as x, set_data_dev as y, getContext as z };
|